5) List all unique replacement costs from the film table
cmd: SELECT DISTINCT replacement_cost FROM film;
SAMPLE OP:
replacement_cost
19.99
25.99
13.99
10.99
23.99
18.99
20.99
6) List all films' title and length in minutes. Alias length as "Duration (min)".
cmd: SELECT title, length AS "Duration (min)" FROM film;
SAMPLE OP:
title | Duration (min)
-----------------------------+----------------
Chamber Italian | 117
Grosse Wonderful | 49
Airport Pollock | 54
Bright Encounters | 73
Academy Dinosaur | 86
Ace Goldfinger | 48
Adaptation Holes | 50
Affair Prejudice | 117
7) Retrieve customer first and last names along with their active status. Alias active as "Is Active".
cmd: SELECT first_name, last_name AS "Is Active" FROM CUSTOMER;
SAMPLE OP:
first_name | Is Active
-------------+--------------
Jared | Ely
Mary | Smith
Patricia | Johnson
Linda | Williams
Barbara | Jones
8) Retrieve the list of film categories sorted alphabetically.
cmd: SELECT name FROM category ORDER BY name ASC;
SAMPLE OP:
name
Action
Animation
Children
Classics
Comedy
Documentary
9) List films by length, sorted in descending order. Include only the title and length
cmd: SELECT title,length FROM film ORDER BY length DESC;
SAMPLE OP:
title | length
-----------------------------+--------
Muscle Bright | 185
Control Anthem | 185
Sweet Brotherhood | 185
Pond Seattle | 185
Chicago North | 185
Worst Banger | 18
10) Retrieve all actor names, sorted by their first name in descending order.
cmd: SELECT first_name,last_name FROM actor ORDER BY first_name DESC;
SAMPLE OP:
first_name | last_name
-------------+--------------
Zero | Cage
Woody | Hoffman
Woody | Jolie
William | Hackman
Will | Wilson
Whoopi | Hurt
11) List all unique ratings available in the film table.
cmd: SELECT DISTINCT rating FROM film;
SAMPLE OP:
rating
PG
R
G
PG-13
NC-17
12) Find all unique rental durations from the film table.
cmd: SELECT DISTINCT rental_duration FROM film;
SAMPLE OP:
rental_duration
4
6
7
3
5
13) Find all unique rental durations from the film table.
cmd: SELECT DISTINCT customer_id, active FROM customer ORDER BY customer_id;
SAMPLE OP:
customer_id | active
-------------+--------
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
Top comments (0)