The given SQL creates a Movie table and inserts some movies. The SELECT statement selects all movies released before January 1, 2000 Modify the SELECT statement to select the title and release date of PG-13 movies that are released after February 1, 2008. Run your solution and verify the result table shows just the titles and release dates for The Dark Knight and Crazy Rich Asians. 3 6 1 CREATE TABLE Movie ( 2 ID INT AUTO_INCREMENT, Title VARCHAR(100), 4 Rating CHAR(5) CHECK (Rating IN ('G', 'PG', 'PG-13', 'R')), 5 ReleaseDate DATE, PRIMARY KEY (ID) 7); 8 9 INSERT INTO Movie (Title, Rating, ReleaseDate) VALUES 19 ('Casablanca', 'PG', '1943-01-23'), 11 ("Bridget Jones's Diary', 'PG-13', '2001-04-13'), 12 ('The Dark Knight', 'PG-13', '2008-07-18'), 13 ("Hidden Figures', 'PG', '2017-01-06'), 14 ('Toy Story', 'G', '1995-11-22'), 15 ("Rocky', 'PG', '1976-11-21'), 16 ('Crazy Rich Asians', 'PG-13', '2018-08-15'); 17 18 -- Modify the SELECT statement: 19 SELECT * 20 FROM Movie 21 WHERE ReleaseDate < '2000-01-01'; 22

Respuesta :

Answer:

The modified SQL code is as follows:

SELECT Title, ReleaseDate FROM movie WHERE Rating = "PG-13" and ReleaseDate >  '2008-02-01'

Explanation:

The syntax of an SQL select statement is:

SELECT c1, c2, c...n FROM table WHERE condition-1, AND/OR condition-n

In this query, we are to select only the title and the release date.

So, we have:

SELECT Title, ReleaseDate

The table name is Movie.

So, we have:

SELECT Title, ReleaseDate FROM movie

And the condition for selection is that:

Ratings must be PG-13

And the date must be later than February 1, 2008

This implies that:

Rating = "PG-13"

ReleaseDate >  '2008-02-01'

So, the complete query is:

SELECT Title, ReleaseDate FROM movie WHERE Rating = "PG-13" and ReleaseDate >  '2008-02-01'