数据库sql习题及答案.pdf
《数据库sql习题及答案.pdf》由会员分享,可在线阅读,更多相关《数据库sql习题及答案.pdf(5页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、文档/*Question 1:Find the titles of all movies directed by Steven Spielberg.select title from movie where director=Steven Spielberg Question 2:Find all years that have a movie that received a rating of 4 or 5,and sort them in increasing order.select distinct year from movie,rating where movie.mid=rati
2、ng.mid and stars in(4,5)order by year Question 3:Find the titles of all movies that have no ratings select title from movie where mID in (select mid from Movie except select mid from rating )select title from movie except select title from movie,rating where movie.mid=rating.mid Question 4:Some revi
3、ewers didnt provide a date with their rating.Find the names of all reviewers who have ratings with a NULL value for the date.select name from reviewer,rating where reviewer.rid=rating.rid and ratingdate is null Question 5:Write a query to return the ratings data in a more readable format:reviewer na
4、me,movie title,stars,and ratingDate.Also,sort the data,first by reviewer name,then by movie title,and lastly by number of stars.select name,title,stars,ratingdate from movie,rating,reviewer 文档 where movie.mid=rating.mid and reviewer.rid=rating.rid order by name,title,stars Question 6:For all cases w
5、here the same reviewer rated the same movie twice and gave it a higher rating the second time,return the reviewers name and the title of the movie.select name,title from rating as F,Rating as S,Movie,Reviewer where F.rID=S.rID and F.mID=S.mID and F.starsS.stars and F.ratingDater2.ratingdate and r1.s
6、tarsr2.stars)as r where movie.mid=r.mid and reviewer.rid=r.rid Question 7:For each movie,find the highest number of stars that movie received as a rating.Return the movie title and number of stars.Sort by movie title.select title,MAX(stars)as max_star from rating,Movie where Rating.mID=Movie.mID gro
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据库 sql 习题 答案
限制150内