SQL Movie-Rating Modification Exercises - Feedback - Solutions



SQL Movie-Rating Modification Exercises - Feedback

Note: These are pretty easey SQL modification Exercises (INSERT - UPDATE - DELETE). You should have finished them in 10 minutes if you have watched the very good video.

Question 1
  • Add the reviewer Roger Ebert to your database, with an rID of 209.
  • Insert into Reviewer Values (209,'Roger Ebert')



Question 2
  • Insert 5-star ratings by James Cameron for all movies in the database. Leave the review date as NULL.
  • Insert into Rating Select rID,mID,5,NULL from Reviewer,Movie where Reviewer.name = 'James Cameron'
Question 3
  • For all movies that have an average rating of 4 stars or higher, add 25 to the release year. (Update the existing tuples; don't insert new tuples.)
  • Update Movie Set year = year+25 Where mID in ( select mID from Rating Group By mID having avg(stars) >=4)

Σχόλια

Δημοφιλείς αναρτήσεις