首页 小组 文章 相册 留言本 用户 搜索 我的社区 在线学堂 商城 购物车 支付钱包

[打卡]MySQL-03

2024-04-16 12:14:50
0
200

-- Mysql分为外连接和内连接
-- 外连接有SQL92 和 SQL99
-- SQL92不能在Mysql中使用

-- SQL99内连接
SELECT employee_id,department_name
FROM employees e inner join departments d
on e.department_id=d.department_id;

SELECT employee_id,department_name,city
FROM employees e inner join departments d
on e.department_id=d.department_id
INNER JOIN locations l
on d.location_id=l.location_id;

-- SQL99外连接
-- 左连接
SELECT employee_id,department_name
FROM employees e left outer join departments d
on e.department_id=d.department_id;

SELECT employee_id,department_name
FROM employees e right outer join departments d
on e.department_id=d.department_id;

评论
意见反馈