0% found this document useful (0 votes)
39 views2 pages

Untitled

This document contains 40 questions about querying data from movie rental database tables to analyze actor information, film genres, revenue, and customer data. It involves using joins, subqueries, views and deleting views.

Uploaded by

Roshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Untitled

This document contains 40 questions about querying data from movie rental database tables to analyze actor information, film genres, revenue, and customer data. It involves using joins, subqueries, views and deleting views.

Uploaded by

Roshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Which actors have the first name ‘Scarlett’


2. Which actors have the last name ‘Johansson’
3. How many distinct actors last names are there?
4. Which last names are not repeated?
5. Which last names appear more than once?
6. Which actor has appeared in the most films?
7. Is ‘Academy Dinosaur’ available for rent from Store 1?
8. Insert a record to represent Mary Smith renting ‘Academy Dinosaur’ from Mike Hillyer
at Store 1 today.
9. When is ‘Academy Dinosaur’ due?
10. What is that average running time of all the films in the sakila DB?
11. What is the average running time of films by category?
12. Why does this query return the empty set?
13. Display the first and last names of all actors from the table actor.
14. Display the first and last name of each actor in a single column in upper case
15. You need to find the ID number, first name, and last name of an actor, of whom you
know only the first name, “Joe.” What is one query would you use to obtain this
information?
16. Find all actors whose last name contain the letters GEN:
Find all actors whose last names contain the letters LI. This time, order the rows by last
name and first name, in that order
17. Using IN, display the country_id and country columns of the following countries:
Afghanistan, Bangladesh, and China:
18. Add a middle name column to the table actor. Position it between first name and last-named.

19. You realize that some of these actors have tremendously long last names. Change the
data type of the middle name column to blobs.
20. List the last names of actors, as well as how many actors have that last name.
21. List last names of actors and the number of actors who have that last name, but only for
names that are shared by at least two actors
22. Oh, no! The actor HARPO WILLIAMS was accidentally entered in the actor table as GROUCHO
WILLIAMS, the name of Harpo’s second cousin’s husband’s yoga teacher. Write a query to
fix the record.
23. Perhaps we were too hasty in changing GROUCHO to HARPO. It turns out that GROUCHO
was the correct name after all! In a single query, if the first name of the actor is
currently HARPO, change it to GROUCHO. Otherwise, change the first name to MUCHO
GROUCHO, as that is exactly what the actor will be with the grievous error. BE CAREFUL
NOT TO CHANGE THE FIRST NAME OF EVERY ACTOR TO MUCHO GROUCHO, HOWEVER!
24. You cannot locate the schema of the address table. Which query would you use to re-
create it?
25. Use JOIN to display the first and last names, as well as the address, of each staff member.
Use the tables staff and address:
26. Use JOIN to display the total amount rung up by each staff member in August of 2005.
Use tables staff and payment.
27. List each film and the number of actors who are listed for that film. Use tables film_actor
and film. Use inner join.
28. How many copies of the film Hunchback Impossible exist in the inventory system?
29. Using the tables payment and customer and the JOIN command, list the total paid by each
customer. List the customers alphabetically by last name:
30. The music of Queen and Kris Kristofferson have seen an unlikely resurgence. As an
unintended consequence, films starting with the letters K and Q have also soared in
popularity. Use subqueries to display the titles of movies starting with the letters K and Q
whose language is English.
31. Use subqueries to display all actors who appear in the film Alone Trip.
32. You want to run an email marketing campaign in Canada, for which you will need the
names and email addresses of all Canadian customers. Use joins to retrieve this
information.
33. Sales have been lagging among young families, and you wish to target all family movies
for a promotion. Identify all movies categorized as famiy films.
34. Display the most frequently rented movies in descending order.
35. Write a query to display how much business, in dollars, each store brought in.
36. Write a query to display for each store its store ID, city, and country.
37. List the top five genres in gross revenue in descending order.
38. In your new role as an executive, you would like to have an easy way of viewing the Top
five genres by gross revenue. Use the solution from the problem above to create a view.
If you have not solved 7h, you can substitute another query to create a view.
39. How would you display the view that you created in 8a?
40. You find that you no longer need the view top_five_genres. Write a query to delete it.

You might also like