Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
);
29 changes: 29 additions & 0 deletions lesson_25/db/db_app/src/main/resources/queries/marthao.sql
Original file line number Diff line number Diff line change
@@ -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;
Binary file modified lesson_25/db/db_app/src/main/resources/sqlite/data.db
Binary file not shown.