当前位置:网站首页>Simple cases of inner connection and left connection
Simple cases of inner connection and left connection
2022-07-29 03:47:00 【Lunar Yin shortage】
Inner connection is also called equivalent connection , The result set returned is all the matching data in the two tables , And discard the mismatched data . in other words , In this kind of query ,DBMS Return only related rows from the source table , That is, the result table of the query contains two source table rows , Must satisfy ON Search criteria in clause . As a contrast , If the row in the source table has no corresponding row in another table , Then the line is filtered out , Not included in the results table . Inner joins are done using comparison operators . There are two types of internal connections .
1. Equivalent connection
Use the equal sign (=) Compare column values of connected columns , List all the columns in the linked table in the query result , Include the repeating Columns .
Case study : Use INNER JOIN Internal connection query
from STUDENT Table and TEACHER Query student name in the table , Department , The course number of all courses taken and the name of the teacher .
SELECT SNAME,S.DNAME,S.CNO,TNAME
FROM STUDENT AS S
INNER JOIN TEACHER AS T
ON S.CNO = T.CNO
ORDER BY SNAME
Next, write a simple case of left connection
The so-called left connection , namely LEFT JION Clause , It allows us to query data from two or more database tables .
LEFT JION Clause yes SELEC Optional parts of the statement , It appears in FROM After Clause .
Let's assume that we need to start from two tables t1 and t2 Query data . The following statement illustrates the connection of two tables LEFT JOIN Syntax of clause :
SELECT
t1.c1,t1.c2,t2.c1,t2.c2
FROM
t1
LEFT JOIN
t2 ON t1.c1 = t2.c1;
When using LEFT JOIN The clause will t1 Table join t2 Table time , If it comes from the left table t1
边栏推荐
- 深入C语言(3)—— C的输入输出流
- 内连接和左连接简单案例
- Since 2019, you must have stopped using this marketing strategy
- RHCE的at,crontab的基本操作,chrony服务和对称加密和非对称加密
- tron OUT_ OF_ ENERGY
- EMD empirical mode decomposition
- Remote desktop connection error
- 深入C语言(1)——操作符与表达式
- Practical application cases of digital Twins - smart energy
- Kotlin companion object vs global function
猜你喜欢

Shutter start white screen

Cloudera manager platform fault repair record

1985-2020(8个版次)全球地表覆盖下载与介绍

(codeforce547) c-mike and foam

【BGP】小型实验

(2022 Hangdian multi school III) 1002 boss rush (pressure dp+ dichotomy)

Solve the problem of garbled code when opening the project code in idea

新零售O2O 电商模式解析

Connect with third-party QQ login
![Machine learning [numpy]](/img/6b/3e7f08c5d379ce35687e4f14545929.png)
Machine learning [numpy]
随机推荐
Shutter start white screen
Microcomputer principle and interface technology
With more than 5 years of work experience and a salary of 15K, would you accept it if you were me?
LVS+KeepAlived高可用部署实战应用
Configmap configuration and secret encryption
面试必备!TCP协议经典十五连问!
向日葵远程控制为何采用BGP服务器?自动最优路线、跨运营商高速传输
Machine learning based on deepchem
Data too long for column 'xxx' at row 1 solution
Deep understanding of Base64 underlying principles
How to understand clock cycle and formula CPU execution time = number of CPU clock cycles / dominant frequency
In depth C language (4) -- definition and use of switch
Configmap配置与Secret加密
In depth C language (2) -- definition and use of structure
Introduction to static routing and dynamic routing protocols OSPF and rip and static routing configuration commands
Deconstruction assignment of new features of ES6
The function parameters of the new features of ES6 are assigned initial values and rest parameters
华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...
Alibaba Font Icon Library Usage and update methods
String template of ES6 new features and methods to simplify objects and functions