diff options
Diffstat (limited to 'projects/3/queries.sql')
| -rw-r--r-- | projects/3/queries.sql | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/projects/3/queries.sql b/projects/3/queries.sql new file mode 100644 index 0000000..eed58d0 --- /dev/null +++ b/projects/3/queries.sql @@ -0,0 +1,22 @@ +-- Find all rentals in January 2024 +select media.title, rentals.due_at, customers.first_name, customers.last_name +from rentals +inner join media on media.id = rentals.media_id +inner join customers on customers.id = rentals.customer_id +inner join categories on categories.id = media.category_id +where rentals.rented_at > '2024-01-01 00:00:00' +and rentals.due_at < '2024-02-01 00:00:00'; + +-- Find all rentals for Documentaries +select media.title, rentals.due_at, customers.first_name, customers.last_name +from rentals +inner join media on media.id = rentals.media_id +inner join customers on customers.id = rentals.customer_id +inner join categories on categories.id = media.category_id +and categories.title = 'Documentary'; + +-- Find all media in the Action category +select media.* +from media +inner join categories on categories.id = media.category_id +and categories.title = 'Action'; |
