Question: 3 . 1 0 . 1 : LAB - Select number of movies grouped by year 0 / 1 0 The Movie table has the

3.10.1: LAB - Select number of movies grouped by year
0/10
The Movie table has the following columns:
ID - integer, primary key
Title - variable-length string
Genre - variable-length string
RatingCode - variable-length string
Year - integer
Write a SELECT statement to select the year and the total number of movies for that year.
Hint: Use the -- Initialize Movie table
DROP TABLE IF EXISTS Movie;
CREATE TABLE Movie (
ID INT unsigned NOT NULL AUTO_INCREMENT,
Title VARCHAR(30),
Genre VARCHAR(20),
RatingCode VARCHAR(5),
Year INT,
PRIMARY KEY (ID)
);
INSERT INTO Movie
VALUES
(1,'Becoming','Documentary','PG',2020),
(2,'Den of Theives','Action','R',2019),
(3,'Arctic Dogs','Family','PG',2019),
(4,'Dangerous Lies','Action',NULL,2020),
(5,'All Day and a Night','Drama','R',2020),
(6,'Extraction','Action','R',2020),
(7,'Madagascar: Escape 2 Africa','Family','PG',2008),
(8,'The Willoughbys','Family','PG',2020),
(9,'Despicable Me','Family','PG',2010),
(10,'Armed Response','Action','R',2017);
COUNT() function and GROUP BY clause.
-- Initialize database
source Initialize.sql
-- Your SELECT statement goes here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!