Sei sulla pagina 1di 3

www.oraclecoach.

com 
Offering Live Oracle SQL Training 
 
SQL Queries on the Motion Picture Database 

1. Display the movie name and boxoffice amount for all the movies. 

2. Display the details of all the directors. 

3. Display the musician's name and year of first composition for all award‐winning musicians 

4. Display the name and age of all actors/actresses. Label the second column as age. Order your results 
in decreasing order of age. Round the age to the nearest whole number. 

5. Write a query to display the actor's name and the number of movies acted in, for all actors. Format 
the number of movies to be 5 characters long, right padded with an '*' (asterisk) character. 

Sample output: 

ACTOR_NAME     Numbe 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐      ‐‐‐‐‐‐‐‐‐ 

Brad Grant              18*** 

Christina Lee          5**** 

.... (rest of the output) 

6. Write a query to display the musician's name in lower case and the length of the name. Display the 
result only for those musicians whose name contains the letters F or R in it. 

Name    Length 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐   ‐‐‐‐‐‐‐‐‐ 

elaine roots   12 

robert taylor   13 

7. Display the structure of the MOVIE table. What do each of the columns returned as output represent? 

8. Display a unique listing of the different genre for the movies. 

Live Oracle Training ….www.oraclecoach.com       1 
 
www.oraclecoach.com 
Offering Live Oracle SQL Training 
 
9. Display the following output from the COMPOSER table. 

NUMBER OF RELEASES 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 

John Duke has released 12 albums 

Yanni M has released 6 albums 

10. Display the names of the musicians who released their first composition after 1999. 

11. Display the name and gender of all actors/actresses who were born in the month of June, who have 
acted in more than 10 movies and have been nominated for an Oscar. 

12. Display the names of musicians and the number of albums they released, only for those musicians 
who have not released between 10 to 20 albums. 

13. Display the names of all directors who do not have an email address. 

14. Display teh names of musicians who have composed more albums than the number of years he or 
she has been composing music. 

15. Write a query to display the current date and time in the format given below. Note the exact date 
need not match. 

Date 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 

29 April 2010 10:10:10 

16. Modify the query from 15) to spell out the day of the month. For example, 6 should be displayed as 
Sixth. Also remove any unnecessary spaces in the output. 

Date 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 

Twenty Nineth April 2011 10:10:10 

17. Display the names of all animated movies by Walt Disney. 

18. Display the movie name and boxoffice amount for the movies that earned more than 60 million, and 
less than 30 million in revenue. Note all the amounts in the table are already in millions. 

Live Oracle Training ….www.oraclecoach.com       2 
 
www.oraclecoach.com 
Offering Live Oracle SQL Training 
 
19. Display the director name and email address of all directors. For a director who does not have an 
email address display the character string 'No email'. 

20. Display the name of the longest running movie. 

21. Display a count of the number of action movies made. 

22. Display the number of movies with each genre. Label the columns 'Genre' and 'Number of Movies'. 
Order the results by 'Number of Movies'. 

23. Display the average boxoffice amount for genre type ACTION and FAMILY. 

24. Display the total number of movies based on the gender. The output should be displayed as shown 
below: 

GENDER TOTAL 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 

FEMALE 12 movies 

MALE 60 movies 

25. Display the names of all movies of the same genre as the movie called 'Washington Times'. 

26. Modify the query in 25) to omit the display of 'Washington Times' in the output. 

27. Display the names of all movies where award‐winning musicians composed the music. 

28. Display the firstname followed by the lastname of all directors who released their last movie in the 
same month that Sidney Shewmaker did. 

29. Display the names of all movies that belong to the same genre and have the same rating as the 
movie called 'Washington Times'. 

30. Display the names of all tables in the schema of the user MV1. 

Live Oracle Training ….www.oraclecoach.com       3 
 

Potrebbero piacerti anche