diff --git a/lesson_25/db/db_app/src/main/resources/queries/create_library_users.sql b/lesson_25/db/db_app/src/main/resources/queries/create_library_users.sql new file mode 100644 index 000000000..9b8b8f66d --- /dev/null +++ b/lesson_25/db/db_app/src/main/resources/queries/create_library_users.sql @@ -0,0 +1,7 @@ +CREATE TABLE library_users ( + id TEXT PRIMARY KEY, + email TEXT UNIQUE NOT NULL, + first_name TEXT NOT NULL, + last_name TEXT NOT NULL, + password TEXT NOT NULL +); \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/resources/queries/marthao.sql b/lesson_25/db/db_app/src/main/resources/queries/marthao.sql new file mode 100644 index 000000000..73c561a84 --- /dev/null +++ b/lesson_25/db/db_app/src/main/resources/queries/marthao.sql @@ -0,0 +1,29 @@ +SELECT + type, + COUNT(*) AS item_count +FROM + media_items +GROUP BY + type; + +SELECT + email, + SUM(pages) AS total_pages +FROM + checked_out_items +JOIN + media_items ON checked_out_items.item_id = media_items.id +GROUP BY + email; + +//A SELECT query that shows all 5 guests and any corresponding records in the checked_out_items table. + +SELECT + guests.name, + guests.email, + checked_out_items.item_id, + checked_out_items.due_date +FROM + guests +LEFT JOIN + checked_out_items ON guests.email = checked_out_items.email; \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/resources/sqlite/data.db b/lesson_25/db/db_app/src/main/resources/sqlite/data.db index 8baa982d2..5a5eba570 100644 Binary files a/lesson_25/db/db_app/src/main/resources/sqlite/data.db and b/lesson_25/db/db_app/src/main/resources/sqlite/data.db differ