Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) show the result of the SQL query. Write column headers in gray cells. DECLARE @max_Rating FLOAT= (SELECT MIN(Rating) FROM Movies) SELECT Title, Year,
a) show the result of the SQL query. Write column headers in gray cells. DECLARE @max_Rating FLOAT= (SELECT MIN(Rating) FROM Movies) SELECT Title, Year, Rating FROM Movies WHERE Rating = @max_Rating Movies Title Batman & Robin Spider-Man Monsters, Inc. Waterworld Titanic Troy Terminator 3 Dinosaur Stuart Little Around the World in 80 Days Godzilla Pearl Harbor Year 1997 2002 2001 1995 1997 2004 2003 2000 1999 2004 1998 2001 Length Rating MPAA Genres 125 3.6 PG-13 Action 121 7.3 PG-13 Action 92 8 G Animation, Comedy 176 5.4 PG-13 Action, Drama 194 8 PG-13 Drama, Romance 162 Action, Drama, Romance 109 Action 82 81 120 133 184 7.1 R 6.9 R 6.3 PG 6 PG 5.7 PG 4.4 PG-13 5.4 R Animation Comedy Action, Comedy, Romance Action Action, Drama, Romance SELECT Title, Year, Rating, RANK() OVER (ORDER BY Rating DESC) AS Rank FROM Movies WHERE Year < 1999 ORDER BY Rank DESC c) SELECT Title, Year, Rating FROM (SELECT*, RANK() OVER (ORDER BY Rating DESC) AS Ranking FROM Movies) AS a WHERE Ranking = 1 d) SELECT Title, Length, Rating, Tile FROM (SELECT *, NTILE(4) OVER (ORDER BY Rating DESC) AS Tile FROM Movies) AS a WHERE Tile = 2 e) SELECT MPAA, COUNT(*) AS MovieCnt, CAST(SUM(Action)/COUNT(*) AS DECIMAL (3,2)) AS ActionPct FROM (SELECT *, CASE WHEN Genres LIKE '%action%' THEN 1.0 ELSE 0.0 END AS Action FROM Movies) AS a GROUP BY MPAA ORDER BY MPAA 3 e) SELECT MPAA, COUNT(*) AS MovieCnt, CAST(SUM(Action)/COUNT(*) AS DECIMAL (3,2)) AS ActionPct FROM (SELECT *, CASE WHEN Genres LIKE '%action%' THEN 1.0 ELSE 0.0 END AS Action FROM Movies) AS a GROUP BY MPAA ORDER BY MPAA 3
Step by Step Solution
★★★★★
3.40 Rating (144 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started