Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
50 changes: 50 additions & 0 deletions publications(SOLUTION).sqbpro
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="C:/Users/asus/Downloads/Iron hack/WEEK5/SQL/publications.sqlite" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="3"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="735"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="authors" custom_title="0" dock_id="4" table="4,7:mainauthors"/><dock_state state="000000ff00000000fd0000000100000002000003a100000226fc0100000004fb000000160064006f0063006b00420072006f00770073006500310100000000ffffffff0000000000000000fb000000160064006f0063006b00420072006f00770073006500320100000000ffffffff0000000000000000fb000000160064006f0063006b00420072006f007700730065003301000000000000033b0000000000000000fb000000160064006f0063006b00420072006f00770073006500340100000000000003a10000011e00ffffff000002580000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="authors" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="93"/><column index="2" value="117"/><column index="3" value="93"/><column index="4" value="101"/><column index="5" value="163"/><column index="6" value="117"/><column index="7" value="36"/><column index="8" value="46"/><column index="9" value="54"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1*">SELECT
authors.au_id AS &quot;AUTHOR ID&quot;,
authors.au_lname AS &quot;LAST NAME&quot;,
authors.au_fname AS &quot;FIRST NAME&quot;,
titles.title AS &quot;TITLE&quot;,
COALESCE(publishers.pub_name, 'Unknown') AS &quot;PUBLISHER&quot;
FROM authors
JOIN titleauthor ON authors.au_id = titleauthor.au_id
JOIN titles ON titleauthor.title_id = titles.title_id
LEFT JOIN publishers ON titles.pub_id = publishers.pub_id;

SELECT
authors.au_id AS &quot;AUTHOR ID&quot;,
authors.au_lname AS &quot;LAST NAME&quot;,
authors.au_fname AS &quot;FIRST NAME&quot;,
COALESCE(publishers.pub_name, 'Unknown') AS &quot;PUBLISHER&quot;,
COUNT(titles.title) AS &quot;TITLE COUNT&quot;
FROM authors
JOIN titleauthor ON authors.au_id = titleauthor.au_id
JOIN titles ON titleauthor.title_id = titles.title_id
LEFT JOIN publishers ON titles.pub_id = publishers.pub_id
GROUP BY authors.au_id, publishers.pub_name
ORDER BY &quot;TITLE COUNT&quot; DESC;

SELECT
authors.au_id AS &quot;AUTHOR ID&quot;,
authors.au_lname AS &quot;LAST NAME&quot;,
authors.au_fname AS &quot;FIRST NAME&quot;,
COALESCE(SUM(sales.qty), 0) AS &quot;TOTAL&quot;
FROM authors
JOIN titleauthor ON authors.au_id = titleauthor.au_id
JOIN titles ON titleauthor.title_id = titles.title_id
LEFT JOIN sales ON titles.title_id = sales.title_id
GROUP BY authors.au_id
ORDER BY &quot;TOTAL&quot; DESC
LIMIT 3;

SELECT
authors.au_id AS &quot;AUTHOR ID&quot;,
authors.au_lname AS &quot;LAST NAME&quot;,
authors.au_fname AS &quot;FIRST NAME&quot;,
COALESCE(SUM(sales.qty), 0) AS &quot;TOTAL&quot;
FROM authors
LEFT JOIN titleauthor ON authors.au_id = titleauthor.au_id
LEFT JOIN titles ON titleauthor.title_id = titles.title_id
LEFT JOIN sales ON titles.title_id = sales.title_id
GROUP BY authors.au_id, authors.au_lname, authors.au_fname
HAVING COALESCE(SUM(sales.qty), 0) = 0
ORDER BY &quot;TOTAL&quot; DESC;
</sql><current_tab id="0"/></tab_sql></sqlb_project>
Expand Down