Advertisement
hgr24

Untitled

Mar 30th, 2022
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.74 KB | None | 0 0
  1. SELECT M.MOV_TITLE
  2.  FROM MOVIES M,DIRECTOR D
  3.  WHERE M.DIR_ID=D.DIR_ID
  4.  AND D.DIR_NAME = 'HITCHCOCK';
  5.  
  6.  
  7. SELECT MOV_TITLE
  8.  FROM MOVIES M, MOVIE_CAST MV
  9.  WHERE M.MOV_ID=MV.MOV_ID AND
  10.  MV.ACT_ID IN (SELECT ACT_ID
  11.  FROM MOVIE_CAST
  12. GROUP BY ACT_ID
  13.  HAVING COUNT (*)>1);
  14.  
  15.  
  16. SELECT A.ACT_NAME
  17. FROM ACTOR A
  18. JOIN MOVIE_CAST C
  19.  ON A.ACT_ID=C.ACT_ID
  20. JOIN MOVIES M
  21.  ON C.MOV_ID=M.MOV_ID
  22. WHERE M.MOV_YEAR NOT BETWEEN 2000 AND 2015;
  23.  
  24.  
  25. SELECT MOV_TITLE, MAX(REV_STARS)
  26. FROM MOVIES
  27. INNER JOIN RATING USING (MOV_ID)
  28. GROUP BY MOV_TITLE
  29. HAVING MAX (REV_STARS)>0
  30. ORDER BY MOV_TITLE;
  31.  
  32.  
  33. UPDATE RATING
  34. SET REV_STARS=5
  35. WHERE MOV_ID IN (SELECT M.MOV_ID FROM MOVIES M,DIRECTOR D
  36.  WHERE M.DIR_ID=D.DIR_ID AND
  37.  D.DIR_NAME = 'STEVEN SPIELBERG');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement