Lesson 1: SELECT 查询 101
题目
答案
-
select title from movies
-
select director from movies;
-
select title,director from movies;
-
select title,year from movies;
-
select * from movies;
Lesson 2: 条件查询 (constraints) (Pt. 1)
题目
答案
-
select * from movies where id = 6;
-
select * from movies where year>=2000 and year <=2010;
-
select * from movies where year not between 2000 and 2010;
-
select * from movies where id<6;
-
select * from movies where year>=2010 and length_minutes<120;
-
select year,length_minutes from movies where year = 1999 or year = 2009;
BETWEEN 操作符
操作符 BETWEEN … AND 会选取介于两个值之间的数据范围。这些值可以是数值、文本或者日期。
Lesson 3: 条件查询(constraints) (Pt. 2)
题目
答案:
- select * from movies where title like ‘%Toy Story%’;
- select * from movies where director like ‘%John Lasseter%’;
- select * from movies where director not like ‘%John Lasseter%’;
- select * from movies where title like ‘wall%’;
asseter%’;
4. select * from movies where title like ‘wall%’;
LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式。"%" 可用于定义通配符(模式中缺少的字母)。
以上习题来自下面网站