From 6ef13833d920b27279ebc57e1aaf52e17e7c4060 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 2 Dec 2024 20:43:14 +0000 Subject: [PATCH] feat: adds sql files to my own personal file. lesson_28 -JosephCaballero --- .../resources/queries/josephcaballero.sql | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lesson_28/db/db_app/src/main/resources/queries/josephcaballero.sql diff --git a/lesson_28/db/db_app/src/main/resources/queries/josephcaballero.sql b/lesson_28/db/db_app/src/main/resources/queries/josephcaballero.sql new file mode 100644 index 000000000..2cd289040 --- /dev/null +++ b/lesson_28/db/db_app/src/main/resources/queries/josephcaballero.sql @@ -0,0 +1,20 @@ +--gets all the types and their occurences +SELECT type, COUNT(*) +FROM media_items +GROUP BY type; + +--gets the pages that were checked-out +SELECT pages +FROM media_items +WHERE id +IN (SELECT item_id FROM checked_out_items); + +--returns the info of an email +SELECT * +FROM checked_out_items c +WHERE c.email IN (SELECT email FROM guests); + + + + +