Write SQL command for the following table named 'Movies':
Answers
a) List the different types of movies.
- Select distinct Type from Movies;
b) Display the list of all movies with price over 200 rupees and sorted by rating.
- Select Title from Movies where Price > 200 order by Rating;
c) Display the number of seats left for action movies.
- Select Seats_left from Movies where Type = 'Action';
d) Display a report listing the movie number, current price, updated price, for each movie in the above table if their price is increased by 15%.
- Select No, Price as 'Current Price', (0.15*Price) + Price as 'Updated Price' from Movies;
Explanation:
a)
SELECT DISTINCT TITLE
FROM Movie;
b)
SELECT TITLE
FROM Movie
WHERE PRICE>200
WHERE PRICE>200ORDER BY RATING;
BY default ORDER BY will give output in ascending order. To get output in descending order. You can write ORDER BY RATING DESC.
c)
SELECT Sum(SEATS_LEFT)
FROM Movie
WHERE TYPE = 'ACTION' ;
d)
SELECT No as 'Movie Number', PRICE as 'Current Price', (PRICE + PRICE*0.15) as 'Updated Price'
FROM Movie;
Hope it helps...
pls mark me as Brainliest and pls give me thanks..
Thank you.