Task For each movie which is recorded in the database, return the name of the first customer to preview the movie (or NULL if no customer has previewed the movie) and the number of times that movie has been streamed. Explanation This query should return a table with five columns. The first containing the prefix of the movie, the second containing the suffix of the movie, the third containing the movie name, the fourth containing the name of the first customer to preview the movie, and the fifth containing the number of times that movie has been streamed. If there are several customers who all previewed the movie first, they should all be returned in duplicate rows with the only difference being customer's name. Hint: VIEW.
Please solve using 'CREATE VIEW'.
Other info as follows:
TABLE `Customer` (
`id` int NOT NULL,
`name` varchar(255) NOT NULL,
`dob` date NOT NULL,
`bestFriend` int DEFAULT NULL,
`subscriptionLevel` varchar(25) NOT NULL
TABLE `Movie` (
`prefix` char(4) NOT NULL,
`suffix` char(4) NOT NULL,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`rating` enum('G','PG','M','MA15+','R18+') NOT NULL,
`releaseDate` date DEFAULT NULL
TABLE `Previews` (
`customer` int NOT NULL,
`moviePrefix` char(4) NOT NULL,
`movieSuffix` char(4) NOT NULL,
`timestamp` timestamp NOT NULL
TABLE `Streams` (
`customer` int NOT NULL,
`moviePrefix` char(4) NOT NULL,
`movieSuffix` char(4) NOT NULL,
`timestamp` timestamp NOT NULL,
`duration` int NOT NULL



Step by step
Solved in 2 steps









