The join on the grammar
The various connections are shown below (red is the returned data) :
There are three main types of connections
- INNER JOIN: Returns rows if there is at least one match in the table
- LEFT JOIN: Returns all rows from the LEFT table even if there is no match in the right table
- RIGHT JOIN: Returns all rows from the RIGHT table even if there is no match in the left table
Take INNER JOIN: as an example
SELECT s.studentno,studentname,subjectno,studentresult FROM
student AS s INNER JOIN result ASR # alias preventselectStudentno is not determined from which tableON s.`studentno`=R. 'studentno' # intersection, both tables have studentno #onandwhereAlmost the same, are added conditions, the former called connection query, the latter called equivalent queryCopy the code
Select * from student; select * from student; select * from student;
If there are more than two lists of procedures (methodology)
- Join a query with two tables
- Two tables join to form one table (logically)
- Join the table and then join the table.
- And so on