当前位置:网站首页>Tutorial on principles and applications of database system (047) -- MySQL query (IX): connection query
Tutorial on principles and applications of database system (047) -- MySQL query (IX): connection query
2022-07-24 00:50:00 【Rsda DBA_ WGX】
Database system principle and Application Tutorial (047)—— MySQL Inquire about ( Nine ): Link query
Catalog
Join query is to query data from multiple tables , Usually, the data in the two tables connected has a one to many connection , Rely on the foreign key in the child table and the primary key in the corresponding parent table to establish association conditions .
One 、 Syntax format of join query
MySQL The syntax format of connection query is as follows :
FROM surface 1 [INNER|left outer|right outer] JOIN surface 2
ON surface 1. Foreign keys = surface 2. Primary key
[
[INNER|left outer|right outer] JOIN surface 3
ON surface 2. Foreign keys = surface 3. Primary key
...]
-- or
FROM surface 1, surface 2, surface 3,...
WHERE surface 1. Foreign keys = surface 2. Primary key and surface 2. Foreign keys = surface 3. Primary key ...
/* explain : (1) Connection type :[inner] join|( Internal connection ),left [outer] join( Left connection ),right [outer] join( The right connection ). (2) The connection type of the second format is inner connection . */
Two 、 The join of two tables
1、 The cartesian product (CROSS JOIN)
Connect each row in the left table with each row in the right table , The result is all combinations of rows of data in these two tables . Cartesian product is actually a join query without any conditions .
for example :
mysql> select * from teacher;
+-------+-----------+-----------+-------------+
| t_id | t_name | job_title | phone |
+-------+-----------+-----------+-------------+
| T8001 | Ouyang xiu | professor | 13703735666 |
| T8002 | Hua Luogeng | professor | 13703735888 |
| T8003 | Zhong Nanshan | professor | 13703735675 |
| T8004 | Qian xuesen | professor | 13703735638 |
| T8005 | Li Bai | associate professor | 13703735828 |
| T8006 | Confucius | professor | 13703735457 |
| T8007 | Wang Anshi | associate professor | 13703735369 |
+-------+-----------+-----------+-------------+
7 rows in set (0.00 sec)
mysql> select * from course;
+------+-----------------+-------+
| c_id | c_name | t_id |
+------+-----------------+-------+
| C101 | Ancient literature | T8001 |
| C102 | Advanced mathematics | T8002 |
| C103 | linear algebra | T8002 |
| C104 | Clinical medicine | T8003 |
| C105 | Infectious diseases | T8003 |
| C106 | College Physics | T8004 |
| C107 | Poetry appreciation | T8005 |
| C108 | pedagogy | T8006 |
| C109 | criminal procedure law | T8007 |
| C110 | economic law | T8007 |
+------+-----------------+-------+
10 rows in set (0.00 sec)
mysql> select * from course,teacher;
+------+-----------------+-------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_id | t_name | job_title | phone |
+------+-----------------+-------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | T8001 | Ouyang xiu | professor | 13703735666 |
| C101 | Ancient literature | T8001 | T8002 | Hua Luogeng | professor | 13703735888 |
| C101 | Ancient literature | T8001 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C101 | Ancient literature | T8001 | T8004 | Qian xuesen | professor | 13703735638 |
| C101 | Ancient literature | T8001 | T8005 | Li Bai | associate professor | 13703735828 |
| C101 | Ancient literature | T8001 | T8006 | Confucius | professor | 13703735457 |
| C101 | Ancient literature | T8001 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C102 | Advanced mathematics | T8002 | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | T8002 | Hua Luogeng | professor | 13703735888 |
| C102 | Advanced mathematics | T8002 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C102 | Advanced mathematics | T8002 | T8004 | Qian xuesen | professor | 13703735638 |
| C102 | Advanced mathematics | T8002 | T8005 | Li Bai | associate professor | 13703735828 |
| C102 | Advanced mathematics | T8002 | T8006 | Confucius | professor | 13703735457 |
| C102 | Advanced mathematics | T8002 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C103 | linear algebra | T8002 | T8001 | Ouyang xiu | professor | 13703735666 |
| C103 | linear algebra | T8002 | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C103 | linear algebra | T8002 | T8004 | Qian xuesen | professor | 13703735638 |
| C103 | linear algebra | T8002 | T8005 | Li Bai | associate professor | 13703735828 |
| C103 | linear algebra | T8002 | T8006 | Confucius | professor | 13703735457 |
| C103 | linear algebra | T8002 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C104 | Clinical medicine | T8003 | T8001 | Ouyang xiu | professor | 13703735666 |
| C104 | Clinical medicine | T8003 | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C104 | Clinical medicine | T8003 | T8004 | Qian xuesen | professor | 13703735638 |
| C104 | Clinical medicine | T8003 | T8005 | Li Bai | associate professor | 13703735828 |
| C104 | Clinical medicine | T8003 | T8006 | Confucius | professor | 13703735457 |
| C104 | Clinical medicine | T8003 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C105 | Infectious diseases | T8003 | T8001 | Ouyang xiu | professor | 13703735666 |
| C105 | Infectious diseases | T8003 | T8002 | Hua Luogeng | professor | 13703735888 |
| C105 | Infectious diseases | T8003 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | T8004 | Qian xuesen | professor | 13703735638 |
| C105 | Infectious diseases | T8003 | T8005 | Li Bai | associate professor | 13703735828 |
| C105 | Infectious diseases | T8003 | T8006 | Confucius | professor | 13703735457 |
| C105 | Infectious diseases | T8003 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C106 | College Physics | T8004 | T8001 | Ouyang xiu | professor | 13703735666 |
| C106 | College Physics | T8004 | T8002 | Hua Luogeng | professor | 13703735888 |
| C106 | College Physics | T8004 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | T8004 | Qian xuesen | professor | 13703735638 |
| C106 | College Physics | T8004 | T8005 | Li Bai | associate professor | 13703735828 |
| C106 | College Physics | T8004 | T8006 | Confucius | professor | 13703735457 |
| C106 | College Physics | T8004 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C107 | Poetry appreciation | T8005 | T8001 | Ouyang xiu | professor | 13703735666 |
| C107 | Poetry appreciation | T8005 | T8002 | Hua Luogeng | professor | 13703735888 |
| C107 | Poetry appreciation | T8005 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C107 | Poetry appreciation | T8005 | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | T8005 | Li Bai | associate professor | 13703735828 |
| C107 | Poetry appreciation | T8005 | T8006 | Confucius | professor | 13703735457 |
| C107 | Poetry appreciation | T8005 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C108 | pedagogy | T8006 | T8001 | Ouyang xiu | professor | 13703735666 |
| C108 | pedagogy | T8006 | T8002 | Hua Luogeng | professor | 13703735888 |
| C108 | pedagogy | T8006 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C108 | pedagogy | T8006 | T8004 | Qian xuesen | professor | 13703735638 |
| C108 | pedagogy | T8006 | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | T8006 | Confucius | professor | 13703735457 |
| C108 | pedagogy | T8006 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C109 | criminal procedure law | T8007 | T8001 | Ouyang xiu | professor | 13703735666 |
| C109 | criminal procedure law | T8007 | T8002 | Hua Luogeng | professor | 13703735888 |
| C109 | criminal procedure law | T8007 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C109 | criminal procedure law | T8007 | T8004 | Qian xuesen | professor | 13703735638 |
| C109 | criminal procedure law | T8007 | T8005 | Li Bai | associate professor | 13703735828 |
| C109 | criminal procedure law | T8007 | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | T8001 | Ouyang xiu | professor | 13703735666 |
| C110 | economic law | T8007 | T8002 | Hua Luogeng | professor | 13703735888 |
| C110 | economic law | T8007 | T8003 | Zhong Nanshan | professor | 13703735675 |
| C110 | economic law | T8007 | T8004 | Qian xuesen | professor | 13703735638 |
| C110 | economic law | T8007 | T8005 | Li Bai | associate professor | 13703735828 |
| C110 | economic law | T8007 | T8006 | Confucius | professor | 13703735457 |
| C110 | economic law | T8007 | T8007 | Wang Anshi | associate professor | 13703735369 |
+------+-----------------+-------+-------+-----------+-----------+-------------+
70 rows in set (0.01 sec)
2、 Internal connection (INNER JOIN)
The query result contains the public fields of two tables ( The foreign key of the child table and the primary key of the parent table ) Records with equal values . When connecting queries, if the columns that need to be used appear in multiple tables , You need to prefix the column name with the table name to qualify , using 【 Table name . Name 】 In the form of .
There are two forms of inner join query :
A) Between the tables INNER JOIN or JOIN Express , The connection conditions are in ON Back .
B) The tables are separated by commas , The connection conditions are in WHERE Back .
for example :
(1) Query the teacher information of each course .
-- Format 1
mysql> select c.*, t_name,job_title,phone from course c,teacher t where c.t_id=t.t_id;
+------+-----------------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_name | job_title | phone |
+------+-----------------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | Wang Anshi | associate professor | 13703735369 |
+------+-----------------+-------+-----------+-----------+-------------+
10 rows in set (0.01 sec)
-- Format two
mysql> select c.*, t_name,job_title,phone from course c join teacher t on c.t_id=t.t_id;
+------+-----------------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_name | job_title | phone |
+------+-----------------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | Wang Anshi | associate professor | 13703735369 |
+------+-----------------+-------+-----------+-----------+-------------+
10 rows in set (0.00 sec)
3、 External connection
The outer connection includes the left connection (LEFT OUTER JOIN)、 The right connection (RIGHT OUTER JOIN)、 Complete connection (FULL OUTER JOIN,MySQL I won't support it ). The meanings of various external connections are as follows :
A) Left connection : The result set includes rows that meet the specified connection conditions after two tables are connected , It also shows JOIN All rows in the table on the left of the keyword that meet the search conditions , How can a row in the left table have no matching row in the right table , Then in the result , All the selected columns in the right table are NULL.
B) The right connection : Is the reverse connection of the left connection .
C) Complete connection : The result set of a complete outer join query includes the result set of two inner join tables and rows that do not meet the conditions in the left table and the right table .
(1) stay course and teacher Insert the following data into the table :
mysql> insert into course values('C111', ' College English I',NULL);
Query OK, 1 row affected (0.00 sec)
mysql> insert into course values('C112', ' College English II',NULL);
Query OK, 1 row affected (0.00 sec)
mysql> select * from course;
+------+-----------------+-------+
| c_id | c_name | t_id |
+------+-----------------+-------+
| C101 | Ancient literature | T8001 |
| C102 | Advanced mathematics | T8002 |
| C103 | linear algebra | T8002 |
| C104 | Clinical medicine | T8003 |
| C105 | Infectious diseases | T8003 |
| C106 | College Physics | T8004 |
| C107 | Poetry appreciation | T8005 |
| C108 | pedagogy | T8006 |
| C109 | criminal procedure law | T8007 |
| C110 | economic law | T8007 |
| C111 | College English I | NULL |
| C112 | College English II | NULL |
+------+-----------------+-------+
12 rows in set (0.00 sec)
mysql> insert into teacher values('T8008',' Qian Zhongshu ',' professor ','13637351245');
Query OK, 1 row affected (0.00 sec)
mysql> insert into teacher values('T8009',' Lin Huiyin ',' professor ','13637354548');
Query OK, 1 row affected (0.00 sec)
mysql> select * from teacher;
+-------+-----------+-----------+-------------+
| t_id | t_name | job_title | phone |
+-------+-----------+-----------+-------------+
| T8001 | Ouyang xiu | professor | 13703735666 |
| T8002 | Hua Luogeng | professor | 13703735888 |
| T8003 | Zhong Nanshan | professor | 13703735675 |
| T8004 | Qian xuesen | professor | 13703735638 |
| T8005 | Li Bai | associate professor | 13703735828 |
| T8006 | Confucius | professor | 13703735457 |
| T8007 | Wang Anshi | associate professor | 13703735369 |
| T8008 | Qian Zhongshu | professor | 13637351245 |
| T8009 | Lin Huiyin | professor | 13637354548 |
+-------+-----------+-----------+-------------+
9 rows in set (0.00 sec)
(2) Query the teacher information of all courses .
-- Using the left link, you can query the courses that have no teachers for the time being , here , The corresponding teacher information of this course is NULL value
mysql> select c.*, t_name,job_title,phone
-> from course c left join teacher t on c.t_id=t.t_id;
+------+-----------------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_name | job_title | phone |
+------+-----------------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C111 | College English I | NULL | NULL | NULL | NULL |
| C112 | College English II | NULL | NULL | NULL | NULL |
+------+-----------------+-------+-----------+-----------+-------------+
12 rows in set (0.00 sec)
(3) Query the course information undertaken by all teachers .
-- Using the right connection, you can query the information of teachers who do not undertake any courses , here , The corresponding course information of the teacher is NULL value
mysql> select c.*, t_name,job_title,phone
-> from course c right join teacher t on c.t_id=t.t_id;
+------+-----------------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_name | job_title | phone |
+------+-----------------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | Wang Anshi | associate professor | 13703735369 |
| NULL | NULL | NULL | Qian Zhongshu | professor | 13637351245 |
| NULL | NULL | NULL | Lin Huiyin | professor | 13637354548 |
+------+-----------------+-------+-----------+-----------+-------------+
12 rows in set (0.00 sec)
(4) Query the teacher information of all courses and the course information of all teachers . because MySQL Full connection is not supported , have access to UNION Merge the left join and the right join to get the query result .
/* select c.*, t_name,job_title,phone from course c left join teacher t on c.t_id=t.t_id union select c.*, t_name,job_title,phone from course c right join teacher t on c.t_id=t.t_id; */
mysql> select c.*, t_name,job_title,phone
-> from course c left join teacher t on c.t_id=t.t_id
-> union
-> select c.*, t_name,job_title,phone
-> from course c right join teacher t on c.t_id=t.t_id;
+------+-----------------+-------+-----------+-----------+-------------+
| c_id | c_name | t_id | t_name | job_title | phone |
+------+-----------------+-------+-----------+-----------+-------------+
| C101 | Ancient literature | T8001 | Ouyang xiu | professor | 13703735666 |
| C102 | Advanced mathematics | T8002 | Hua Luogeng | professor | 13703735888 |
| C103 | linear algebra | T8002 | Hua Luogeng | professor | 13703735888 |
| C104 | Clinical medicine | T8003 | Zhong Nanshan | professor | 13703735675 |
| C105 | Infectious diseases | T8003 | Zhong Nanshan | professor | 13703735675 |
| C106 | College Physics | T8004 | Qian xuesen | professor | 13703735638 |
| C107 | Poetry appreciation | T8005 | Li Bai | associate professor | 13703735828 |
| C108 | pedagogy | T8006 | Confucius | professor | 13703735457 |
| C109 | criminal procedure law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C110 | economic law | T8007 | Wang Anshi | associate professor | 13703735369 |
| C111 | College English I | NULL | NULL | NULL | NULL |
| C112 | College English II | NULL | NULL | NULL | NULL |
| NULL | NULL | NULL | Qian Zhongshu | professor | 13637351245 |
| NULL | NULL | NULL | Lin Huiyin | professor | 13637354548 |
+------+-----------------+-------+-----------+-----------+-------------+
14 rows in set (0.02 sec)
3、 ... and 、 Multiple table joins
The connection query of multiple tables can be understood in this way : First, join the two tables to generate a new table , Then use this new table to join and query with the third table , And so on .
The syntax is as follows :
FROM surface 1 [INNER] JOIN surface 2 ON surface 1. Foreign keys = surface 2. Primary key
[
[INNER] JOIN surface 3 ON surface 2. Foreign keys = surface 3. Primary key
...]
-- or
FROM surface 1, surface 2, surface 3,...
WHERE surface 1. Foreign keys = surface 2. Primary key and surface 2. Foreign keys = surface 3. Primary key ...
for example :
(1) Query students' course selection information , Including the student number of the student , full name , The course number of the course , Course name and grades .
/* select s.s_id, s.s_name, c.c_id, c.c_name, score from student s join score sc on s.s_id = sc.s_id join course c on c.c_id = sc.c_id; */
mysql> select s.s_id, s.s_name, c.c_id, c.c_name, score
-> from student s join score sc on s.s_id = sc.s_id
-> join course c on c.c_id = sc.c_id;
+-------+-----------+------+-----------------+-------+
| s_id | s_name | c_id | c_name | score |
+-------+-----------+------+-----------------+-------+
| S2011 | Zhang Xiaogang | C102 | Advanced mathematics | 84 |
| S2011 | Zhang Xiaogang | C105 | Infectious diseases | 90 |
| S2011 | Zhang Xiaogang | C106 | College Physics | 79 |
| S2011 | Zhang Xiaogang | C109 | criminal procedure law | 65 |
| S2012 | Liu Xiaoqing | C101 | Ancient literature | 67 |
| S2012 | Liu Xiaoqing | C102 | Advanced mathematics | 52 |
| S2012 | Liu Xiaoqing | C103 | linear algebra | 55 |
| S2012 | Liu Xiaoqing | C104 | Clinical medicine | 86 |
| S2012 | Liu Xiaoqing | C105 | Infectious diseases | 87 |
| S2012 | Liu Xiaoqing | C106 | College Physics | 64 |
| S2012 | Liu Xiaoqing | C107 | Poetry appreciation | 62 |
| S2012 | Liu Xiaoqing | C108 | pedagogy | 73 |
| S2012 | Liu Xiaoqing | C109 | criminal procedure law | 78 |
| S2012 | Liu Xiaoqing | C110 | economic law | 89 |
| S2013 | Cao mengde | C102 | Advanced mathematics | 97 |
| S2013 | Cao mengde | C103 | linear algebra | 68 |
| S2013 | Cao mengde | C104 | Clinical medicine | 66 |
| S2013 | Cao mengde | C105 | Infectious diseases | 68 |
| S2014 | Liu Yan | C102 | Advanced mathematics | 90 |
| S2014 | Liu Yan | C103 | linear algebra | 85 |
| S2014 | Liu Yan | C104 | Clinical medicine | 77 |
| S2014 | Liu Yan | C105 | Infectious diseases | 96 |
| S2015 | Liu Yan | C101 | Ancient literature | 69 |
| S2015 | Liu Yan | C102 | Advanced mathematics | 66 |
| S2015 | Liu Yan | C103 | linear algebra | 88 |
| S2015 | Liu Yan | C104 | Clinical medicine | 69 |
| S2015 | Liu Yan | C105 | Infectious diseases | 66 |
| S2015 | Liu Yan | C106 | College Physics | 88 |
| S2015 | Liu Yan | C107 | Poetry appreciation | 69 |
| S2015 | Liu Yan | C108 | pedagogy | 66 |
| S2015 | Liu Yan | C109 | criminal procedure law | 88 |
| S2015 | Liu Yan | C110 | economic law | 69 |
| S2016 | Liu Ruofei | C101 | Ancient literature | 65 |
| S2016 | Liu Ruofei | C102 | Advanced mathematics | 69 |
| S2016 | Liu Ruofei | C107 | Poetry appreciation | 82 |
| S2016 | Liu Ruofei | C108 | pedagogy | 56 |
| S2021 | Dong Wenhua | C102 | Advanced mathematics | 72 |
| S2021 | Dong Wenhua | C103 | linear algebra | 90 |
| S2021 | Dong Wenhua | C104 | Clinical medicine | 90 |
| S2021 | Dong Wenhua | C105 | Infectious diseases | 57 |
| S2022 | Zhou Huajian | C102 | Advanced mathematics | 88 |
| S2022 | Zhou Huajian | C103 | linear algebra | 93 |
| S2022 | Zhou Huajian | C109 | criminal procedure law | 47 |
| S2022 | Zhou Huajian | C110 | economic law | 62 |
| S2023 | trump | C102 | Advanced mathematics | 68 |
| S2023 | trump | C103 | linear algebra | 86 |
| S2023 | trump | C109 | criminal procedure law | 56 |
| S2023 | trump | C110 | economic law | 91 |
| S2024 | Obama | C102 | Advanced mathematics | 87 |
| S2024 | Obama | C103 | linear algebra | 97 |
| S2024 | Obama | C109 | criminal procedure law | 80 |
| S2024 | Obama | C110 | economic law | 81 |
| S2025 | Zhou Jianhua | C102 | Advanced mathematics | 61 |
| S2025 | Zhou Jianhua | C105 | Infectious diseases | 62 |
| S2025 | Zhou Jianhua | C106 | College Physics | 87 |
| S2025 | Zhou Jianhua | C109 | criminal procedure law | 82 |
| S2026 | Zhang Xueyou | C102 | Advanced mathematics | 59 |
| S2026 | Zhang Xueyou | C105 | Infectious diseases | 48 |
| S2026 | Zhang Xueyou | C106 | College Physics | 90 |
| S2026 | Zhang Xueyou | C109 | criminal procedure law | 73 |
+-------+-----------+------+-----------------+-------+
60 rows in set (0.00 sec)
(2) Inquire about 【 trump 】 Classmate 【 Advanced mathematics 】 achievement
/* select score from student s, course c, score sc where s.s_id = sc.s_id and c.c_id = sc.c_id and s_name = ' trump ' and c_name = ' Advanced mathematics '; */
mysql> select score
-> from student s, course c, score sc
-> where s.s_id = sc.s_id and c.c_id = sc.c_id
-> and s_name = ' trump ' and c_name = ' Advanced mathematics ';
+-------+
| score |
+-------+
| 68 |
+-------+
1 row in set (0.00 sec)
边栏推荐
- Flutter | the easiest way to add header and footer to listview
- Tutorial on principles and applications of database system (039) -- MySQL query (I): syntax analysis of select command
- postman测试接口在URL配置正确的情况下出现404或者500错误
- Design details related to sap e-commerce cloud Spartacus UI store
- Classic example of C language - print the input two digits in reverse order
- Testers who have been employed for 3 months are facing employment confirmation. Leaders: 1 year of work experience is packaged into 5 years, and the probation period is eliminated
- Comparison of the shortcomings of redis master-slave, sentinel and cluster architectures
- 工作3年的测试员跳槽后工资是原来的2倍,秘诀原来是......
- Database connection pool & dbutils
- C language book recommendation
猜你喜欢

Classic example of C language - commodity inspection code

Beifeng communication appeared in China (Xiamen) emergency exhibition | intelligent communication means are strong and eye-catching!

Installation and use of appscan

The most basic code interpretation of C language

【LeetCode第 83 场双周赛】

Flutter | the easiest way to add header and footer to listview

Redis common commands

How to use SAP intelligent robotic process automation to automate Excel

Expérience du système réseau: résoudre les problèmes de ping

SAP 实施项目中涉及到编程方式操作 Excel 的几种场景介绍
随机推荐
Tutorial on principles and applications of database system (041) -- MySQL query (III): setting query conditions
Classic example of C language - convert the input two digits into English
Tutorial on principles and applications of database system (045) -- MySQL query (VII): aggregate function
《天幕红尘》笔记与思考(六)因缺而需
Bean Validation使用篇----05
Okaleido tiger NFT is about to log in to the binance NFT platform. Are you looking forward to it?
Application of SCA on devsecops platform
【LeetCode第 83 场双周赛】
Memory forensics nssctf otterctf 2018 (replay)
Prometheus+node exporter+grafana monitoring server system resources
The postman test interface has 404 or 500 errors when the URL is configured correctly
MySQL之数据查询(SELECT)
Small farmers also have big goals in the test, and the latest big bat interview summary (constantly updating...)
Tutorial on principles and applications of database system (039) -- MySQL query (I): syntax analysis of select command
Classic examples of C language - adding two scores
MySQL data query (select)
postman测试接口在URL配置正确的情况下出现404或者500错误
Redis persistence mechanism RDB, AOF
Flutter | firstwhere error reporting
Selection method of geometric objects in Creo 9.0