SQL语句多表查询:显示前5位同学的姓名、课程及成绩
作者:互联网
MariaDB [hellodb]> select name,course,score from (select * from students limit 5) as st inner join scores sc on st.stuid=sc.stuid inner join courses co on sc.courseid=co.courseid;
+-------------+----------------+-------+
| name | course | score |
+-------------+----------------+-------+
| Shi Zhongyu | Kuihua Baodian | 77 |
| Shi Zhongyu | Weituo Zhang | 93 |
| Shi Potian | Kuihua Baodian | 47 |
| Shi Potian | Daiyu Zanghua | 97 |
| Xie Yanke | Kuihua Baodian | 88 |
| Xie Yanke | Weituo Zhang | 75 |
| Ding Dian | Daiyu Zanghua | 71 |
| Ding Dian | Kuihua Baodian | 89 |
| Yu Yutong | Hamo Gong | 39 |
| Yu Yutong | Dagou Bangfa | 63 |
+-------------+----------------+-------+
标签:语句,Dian,多表,Baodian,SQL,Kuihua,sc,Shi,+-------------+----------------+-------+ 来源: https://blog.csdn.net/weixin_51867896/article/details/122792357