Kodewick
开始学 →
基础←→0 / 70

起个短名字

#041基础连接约 4 分钟

成绩单要列出每条成绩。把 students 和 scores 连起来(scores.student_id = students.id),按顺序选出 name、subject、score。表名太长?可以给表起个短名字。

用到的表
students
idnameclassagecity
1Amy1A12Leeds
2Ben1A13York
3Cara1B12NULL
4Dan1B14Leeds
5Eva1A12Hull
6Finn1C13NULL
7Gus1C12York
7 行
scores
idstudent_idsubjectscore
11math92
21art78
32math65
42art88
53math74
64math55
74art90
85math81
95artNULL
107math99
10 行
query.sql
-- 在这里写:用 AS 给两张表起短名字,连起来选出 name、subject、score
SELECT name
FROM students;
Ctrl + Enter 也能运行
结果

写好了先点「运行」看看结果,没问题再点「提交」。