1. Find the title of each SELECT title FROM movies;
Movies Table:
Id
Title
Director
Year
Length_minutes
2. Find the title and director of each film SELECT title, director FROM
movies;
Movies Table:
Id
Title
Director
Year
Length_minutes
3. Find the movie with a row id of 6 SELECT Id, Title FROM
Movies WHERE Id = 6;
Movies Table:
Id
Title
Director
Year
Length_minutes
4. Find the movies not released in the years SELECT title, year FROM
between 2000 and 2010 movies
WHERE year < 2000 OR year
Movies Table: > 2010;
Id
Title
Director
Year
Length_minutes
5. Find all Toy Story movies. SELECT title, director FROM
movies
, WGU D427
Movies Table: WHERE title LIKE "Toy Sto-
Id ry%";
Title
Director
Year
Length_minutes
6. List all directors of Pixar movies (alphabet- SELECT DISTINCT Director
ically), without duplicates FROM Movies
ORDER BY Director ASC;
Movies Table:
Id
Title
Director
Year
Length_minutes
7. List the last four Pixar movies released (or- SELECT Title, Year FROM
dered from most recent to least) Movies
ORDER BY Year DESC
Movies Table: LIMIT 4;
Id
Title
Director
Year
Length_minutes
8. List the next five Pixar movies sorted alpha- SELECT title
betically FROM movies
ORDER BY title ASC
Movies Table: LIMIT 5 OFFSET 5;
Id
Title
Director
Year
Length_minutes
9. List all buildings and the distinct employ- SELECT DISTINCT build-
ee roles in each building (including empty ing_name, role
buildings) FROM buildings
, WGU D427
LEFT JOIN employees
Buildings Table: ON building_name = build-
Building_name, Capacity ing;
10. Find the name and role of all employees SELECT name, role FROM
who have not been assigned to a building employees
WHERE building IS NULL;
Buildings Table:
Building_name, Capacity
11. Find the names of the buildings that hold no SELECT DISTINCT build-
employees ing_name
FROM buildings
Buildings Table: LEFT JOIN employees
Building_name, Capacity ON building_name = building
WHERE role IS NULL;
Employees Table:
Role, Name, Building, Years_employed
12. Select the number of movies grouped by SELECT count(title), year
year FROM movie
GROUP BY year;
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
13. Write a SELECT statement to select the SELECT title, year, descrip-
Title, Year, and rating Description. Display tion
all movies, whether or not a RatingCode is FROM movie
available. LEFT JOIN rating
ON ratingcode = code;
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Aplusplus. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.