- Film titles with rental rates:- SELECT title AS "Movie Title", rental_rate AS "Rate" FROM film;
- Customer names and email:-
SELECT first_name AS "First Name", last_name AS "Last Name", email FROM customer;
- Films sorted by rental rate (desc), then title:-
SELECT title, rental_rate FROM film ORDER BY rental_rate DESC, title ASC;
- Actor names sorted by last name, then first name:- SELECT first_name, last_name FROM actor ORDER BY last_name ASC, first_name ASC;
- Unique replacement costs:- SELECT DISTINCT replacement_cost FROM film;
- Film title and duration:- SELECT title, length AS "Duration (min)" FROM film;
- Customer active status:- SELECT first_name, last_name, active AS "Is Active" FROM customer;
- Film categories sorted alphabetically:- SELECT nameFROM category ORDER BY name ASC;
- Films by length (descending):- SELECT title, length FROM film ORDER BY length DESC;
- Actor names sorted by first name (descending) SELECT first_name, last_name FROM actor ORDER BY first_name DESC;
- Unique ratings:- SELECT DISTINCT rating FROM film;
- Unique rental durations:- SELECT DISTINCT rental_duration FROM film;
- First unique customer ID based on active status:- SELECT DISTINCT customer_id, active FROM customer ORDER BY customer_id LIMIT 1;
- Earliest rental date for each customer:- SELECT customer_id, MIN(rental_date) AS rental_date FROM rental GROUP BY customer_id ORDER BY customer_id;
- 10 shortest films SELECT title, length FROM film ORDER BY length ASC LIMIT 10;
- Top 5 customers with highest customer_id:- SELECT first_name, last_name FROM customer ORDER BY customer_id DESC LIMIT 5;
- Unique store IDs from inventory:- SELECT DISTINCT store_id FROM inventory;
- Unique replacement_cost sorted ascending SELECT DISTINCT replacement_cost FROM film ORDER BY replacement_cost ASC;
- First rental date for each store:- SELECT i.store_id, MIN(r.rental_date) AS rental_date FROM rental r JOIN inventory i ON r.inventory_id = i.inventory_id GROUP BY i.store_id ORDER BY i.store_id;
- Unique film ratings sorted alphabetically:- SELECT DISTINCT rating FROM film ORDER BY rating ASC;
- Films by rating (asc) and length (desc):- SELECT title, rating, length FROM film ORDER BY rating ASC, length DESC;
- Actor names sorted last asc, first desc SELECT first_name, last_name FROM actor ORDER BY last_name ASC, first_name DESC;
- Films by replacement_cost asc and rental_rate desc SELECT title, replacement_cost, rental_rate FROM film ORDER BY replacement_cost ASC, rental_rate DESC;
- Customers sorted last asc, first desc SELECT first_name, last_name FROM customer ORDER BY last_name ASC, first_name DESC;
- Rentals sorted by customer_id asc, rental_date desc SELECT * FROM rental ORDER BY customer_id ASC, rental_date DESC;
- Films ordered by rental_duration asc and title desc SELECT title, rental_duration FROM film ORDER BY rental_duration ASC, title DESC;
Top comments (0)