当前位置:网站首页>[MySQL] Cartesian product - multi table query (detailed explanation)
[MySQL] Cartesian product - multi table query (detailed explanation)
2022-06-12 16:39:00 【zbossz】
We usually use the database , It is impossible to check only one table , When we want to combine multiple tables for query , We will perform multi table query .
Let's design the interrelated 4 A watch :

So let's now query by Cartesian product z1 Students' scores of analog circuits and digital circuits :
mysql> select * from class,course,score,student where student.studentId = score.studentId and course.courseId = score.courseId
-> and class.classId = student.studentClassId
-> and studentName = 'z1'
-> and course.courseName = ' Analog and digital circuits ';
+---------+-----------+----------+--------------------+-----------+----------+-------+-----------+-------------+----------------+
| classId | className | courseId | courseName | studentId | courseId | score | studentId | studentName | studentClassId |
+---------+-----------+----------+--------------------+-----------+----------+-------+-----------+-------------+----------------+
| 1 | Computer 1 class | 1 | Analog and digital circuits | 1 | 1 | 78 | 1 | z1 | 1 |
+---------+-----------+----------+--------------------+-----------+----------+-------+-----------+-------------+----------------+
1 row in set (0.00 sec)

The red part in front , Multi table Association . Later, we are conducting data screening .
边栏推荐
- 深入理解 Go Modules 的 go.mod 与 go.sum
- 你的下一台电脑何必是电脑,探索不一样的远程操作
- MySQL面试整理
- generate pivot data 2
- The C programming language (version 2) notes / 8 UNIX system interface / 8.4 random access (lseek)
- Acwing high precision multiplication
- The C programming language (version 2) notes / 8 UNIX system interface / 8.5 instance (implementation of fopen and Getc functions)
- The C Programming Language(第 2 版) 笔记 / 8 UNIX 系统接口 / 8.3 open、creat、close、unlink
- 关于组件传值
- Dynamic loading and execution of programs
猜你喜欢

Leetcode 2190. 数组中紧跟 key 之后出现最频繁的数字(可以,一次过)

pbootcms的if判断失效直接显示标签怎么回事?

Project training of Shandong University rendering engine system (III)

Leetcode 2194. Cellules dans une plage dans un tableau Excel (OK, résolu)

Acwing795 prefix sum (one dimension)

acwing 790. The cubic root of a number (floating-point number in half)

Qcustomplot notes (I): qcustomplot adding data and curves

MySQL面试整理

Sum of acwing796 submatrix

Leetcode 2190. The number that appears most frequently in the array immediately after the key (yes, once)
随机推荐
大规模实时分位数计算——Quantile Sketches 简史
latex表格 在线生成
pbootcms的if判断失效直接显示标签怎么回事?
<山东大学项目实训>渲染引擎系统(七)
Acwing 797 differential
<山东大学项目实训>渲染引擎系统(八-完)
generate pivot data 2
Leetcode 2194. Cells within a range in Excel table (yes, solved)
每日一题-890. 查找和替换模式
The C programming language (version 2) notes / 8 UNIX system interfaces / 8.6 instances (directory list)
Large scale real-time quantile calculation -- a brief history of quantitative sketches
<山东大学项目实训>渲染引擎系统(六)
5-5 configuring MySQL replication log point based replication
Acwing 798 two dimensional difference (difference matrix)
Learning notes of MySQL series by database and table
Acwing 1927 自动补全(知识点:hash,二分,排序)
Project training of Shandong University rendering engine system (VII)
calibration of sth
Project training of Shandong University rendering engine system (III)
Analysis of Nacos config dynamic refresh source code