Skip to content

Commit 5626c09

Browse files
author
calvin
committed
feat: added 3 sql queries to my sql file
1 parent 5b827e8 commit 5626c09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Query 1: Counts of media items by type
2+
SELECT type, COUNT(*) as count FROM media_items GROUP BY type;
3+
4+
-- Query 2: Sum of total pages checked out by guests
5+
SELECT SUM(mi.pages) as total_pages_checked_out FROM checked_out_items coi JOIN media_items mi ON coi.item_id = mi.id;
6+
7+
-- Query 3: All guests and their corresponding checked out items
8+
SELECT g.name, g.email, coi.item_id, coi.due_date FROM guests g LEFT JOIN checked_out_items coi ON g.email = coi.email;

0 commit comments

Comments
 (0)