diff --git a/lesson_28/db/db_app/src/main/resources/queries/chanelhutt.sql b/lesson_28/db/db_app/src/main/resources/queries/chanelhutt.sql new file mode 100644 index 000000000..95255ad73 --- /dev/null +++ b/lesson_28/db/db_app/src/main/resources/queries/chanelhutt.sql @@ -0,0 +1,19 @@ +/*Count the media items by types*/ +SELECT type, COUNT(*) AS count +FROM media_items +GROUP BY type; + +SELECT SUM(pages) AS total_pages +FROM checked_out_items x +JOIN media_items y ON y.id = x.item_id; + +SELECT g.email, g.name, g.type, +GROUP_CONCAT(c.item_id) AS checked_out_items +FROM guests g +LEFT JOIN checked_out_items c ON g.email = c.email +GROUP BY g.email, g.name, g.type +LIMIT 5; + + + + diff --git a/lesson_28/db/db_app/src/main/resources/sqlite/data.db b/lesson_28/db/db_app/src/main/resources/sqlite/data.db index 8baa982d2..dba8e003a 100644 Binary files a/lesson_28/db/db_app/src/main/resources/sqlite/data.db and b/lesson_28/db/db_app/src/main/resources/sqlite/data.db differ