sqlzoo练习13-join-quiz2
还是通过下面的3
张表进行练习
练习
- Select the statement which lists the unfortunate directors of the movies which have caused financial loses (gross < budget)
找出毛利小于预算的导演
需要注意的是导演们的名字也是在actor表中的
1 | select name |
- Select the correct example of JOINing three tables
3个表的联结通过两个Join实现:
actor—>casting—>movie
1 | select * |
- Select the statement that shows the list of actors called ‘John’ by order of number of movies in which they acted
找出由名字中包含
John
的演员的电影(通配符的使用),根据电影数量排序笔记:
order by
排序的时候可以使用字段名字,也可以使用字段的相对位置
1 | select name, count(movieid) -- 统计数量 |
- Select the result that would be obtained from the following code:
选择由该演员出演主角的电影
1 | select title |
- Select the statement that lists all the actors that starred in movies directed by Ridley Scott who has id 351
找出由RS导演的电影的主演
1 | select name |
- There are two sensible ways to connect movie and actor. They are:
两种方式将
movie
和actor
表进行联结
- 通过director字段和actor表中的主键相连接
- 通过casting表将另外两个表连接
- Select the result that would be obtained from the following code:
通过代码选出正确答案
1 | select title, yr |