main
1-- Find all rentals in January 2024
2select media.title, rentals.due_at, customers.first_name, customers.last_name
3from rentals
4inner join media on media.id = rentals.media_id
5inner join customers on customers.id = rentals.customer_id
6inner join categories on categories.id = media.category_id
7where rentals.rented_at > '2024-01-01 00:00:00'
8and rentals.due_at < '2024-02-01 00:00:00';
9
10-- Find all rentals for Documentaries
11select media.title, rentals.due_at, customers.first_name, customers.last_name
12from rentals
13inner join media on media.id = rentals.media_id
14inner join customers on customers.id = rentals.customer_id
15inner join categories on categories.id = media.category_id
16and categories.title = 'Documentary';
17
18-- Find all media in the Action category
19select media.*
20from media
21inner join categories on categories.id = media.category_id
22and categories.title = 'Action';