当前位置:网站首页>SQL learning notes nine connections 2
SQL learning notes nine connections 2
2022-07-01 06:35:00 【Small dollar】
Equivalent connection vs Non equivalent connection
SELECT last_name,salary ,job_grades.grade_level from employees,job_grades
WHERE employees.salary >= job_grades.lowest_salAND employees.salary < job_grades.highest_sal;
External connection , Internal connection
The left outer join , Right connection
-sql 92 Syntax implementation external connection
SELECT a.first_name,a.employee_id,a.department_id FROM employees a ,departments b
WHERE a.department_id = b.department_id(+);
-mysql I won't support it sql92 grammar -
-99 Syntax left outer join
SELECT a.first_name,a.employee_id,a.department_id FROM employees a LEFT OUTER JOIN departments b
ON a.department_id = b.department_id;
outer Can be omitted
The left outer connection shows the whole picture on the left
The right outer connection is the whole picture on the right
union
because sql in full join You can't use , Therefore use union Take the union of two tables
- union all Two graphs a Map and b Figure merge , There is an extra copy of the repeated part , Although redundant , But in the development, try to use union all

Chinese : Internal connection
SELECT a.first_name,a.employee_id,a.department_id FROM employees a JOIN departments b
ON a.department_id = b.department_id;
Top left
SELECT a.first_name,a.employee_id,a.department_id FROM employees a LEFT JOIN departments b
ON a.department_id = b.department_id;
Top right
SELECT a.first_name,a.employee_id,a.department_id FROM employees a RIGHT JOIN departments b
ON a.department_id = b.department_id;
Middle left
SELECT a.first_name,a.employee_id,a.department_id FROM employees a LEFT JOIN departments b
ON a.department_id = b.department_id
WHERE a.department_id = NULL;
Middle right
SELECT a.first_name,a.employee_id,a.department_id FROM employees a RIGHT JOIN departments b
ON a.department_id = b.department_id
WHERE b.deparment_id = NULL;
Full outer join
Top left UNION ALL Middle right
SELECT a.first_name,a.employee_id,a.department_id FROM employees a LEFT JOIN departments b
ON a.department_id = b.department_id;
UNION ALL
SELECT a.first_name,a.employee_id,a.department_id FROM employees a RIGHT JOIN departments b
ON a.department_id = b.department_id
WHERE b.deparment_id = NULL;
边栏推荐
- Docker 安装部署Redis
- Software engineering review
- SQL learning notes 2
- [ManageEngine Zhuohao] mobile terminal management solution, helping the digital transformation of Zhongzhou aviation industry
- 在支付宝上买基金安全吗?哪里可以买基金
- [network security tool] what is the use of USB control software
- Internet worm
- C language course set up salary management system (big homework)
- Idea easy to use plug-in summary!!!
- ESP32 ESP-IDF GPIO按键中断响应
猜你喜欢

产品学习(一)——结构图
![[unity shader stroke effect _ case sharing first]](/img/bd/5cd1bef24e6b6378854114c2c05bd9.png)
[unity shader stroke effect _ case sharing first]

C语言课设物业费管理系统(大作业)

Software engineering review

【微信小程序低代码开发】二,在实操中化解小程序的代码组成

On siem

Idea easy to use plug-in summary!!!

JMM details

Design of sales management system for C language course (big homework)

【#Unity Shader#Amplify Shader Editor(ASE)_第九篇】
随机推荐
@Propagation property of transactional requires_ New in-depth understanding
Async and await
Docker 安装部署Redis
sql中TCL语句(事务控制语句)
产品学习(三)——需求列表
TCL statements in SQL (transaction control statements)
【微信小程序】视图容器和基本内容组件
Interview questions for HW (OD) post
C语言课设物业费管理系统(大作业)
三分钟带你快速了解网站开发的整个流程
[unity shader custom material panel part I]
Design of sales management system for C language course (big homework)
概率论学习笔记
C language course is provided with employee information management system (large operation)
[unity shader custom material panel part II]
Promise
HW(OD)岗面试题
[ManageEngine Zhuohao] helps Julia college, the world's top Conservatory of music, improve terminal security
MySQL learning
【Unity Shader 描边效果_案例分享第一篇】