Kodewick
开始学 →
入门←→0 / 70

知道住哪的

#045入门NULL查询约 2 分钟

学校要把运动会的照片寄到家里,只能寄给填了城市的同学。从 students 表里选出 city 不是空的同学的 name 和 city。

用到的表
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
SELECT name, city
FROM students
-- 在这里写:用 WHERE city IS NOT NULL 留下填了城市的
;
Ctrl + Enter 也能运行
结果

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