From 48ab3af50da9b8dbd18a7ca47708070a7616fabf Mon Sep 17 00:00:00 2001 From: Haroon Date: Wed, 29 Jul 2026 04:56:02 +0400 Subject: [PATCH 1/7] Add assignment one ERD --- 05_src/assignment_one.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 05_src/assignment_one.sql diff --git a/05_src/assignment_one.sql b/05_src/assignment_one.sql new file mode 100644 index 000000000..e69de29bb From ae135afe0f2a5646684a8bea9753523e9789c4fd Mon Sep 17 00:00:00 2001 From: Haroon Date: Wed, 29 Jul 2026 05:02:45 +0400 Subject: [PATCH 2/7] Add assignment one ERD diagram --- 05_src/{assignment_one.sql => assignment_one.png} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 05_src/{assignment_one.sql => assignment_one.png} (100%) diff --git a/05_src/assignment_one.sql b/05_src/assignment_one.png similarity index 100% rename from 05_src/assignment_one.sql rename to 05_src/assignment_one.png From 2a609d1a54847725cec1b115b7eb7a2041b4db18 Mon Sep 17 00:00:00 2001 From: Haroon Date: Wed, 29 Jul 2026 15:46:32 +0400 Subject: [PATCH 3/7] Replace empty ERD with actual diagram --- 05_src/data/assignment_one.drawio.png | Bin 0 -> 22978 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 05_src/data/assignment_one.drawio.png diff --git a/05_src/data/assignment_one.drawio.png b/05_src/data/assignment_one.drawio.png new file mode 100644 index 0000000000000000000000000000000000000000..9fef216ad26cacf94bc4e7534d01739b807ecb39 GIT binary patch literal 22978 zcmeHv1yq#l`mX{4!XRMLEhPfO44o1JDy67&42?7lT_OS^LkZF$f}pf?gLHSNlnmV> zeZL|0_UygS`Ja2wx$B&})?Le`^S$5OPyL?w^i`0P!owlOxp3hE-hF9_#}_VKtO0)K zU}FM*3kN1$xp09}27XT&ZsuTMY^r~O9x8tNiyi_tvao^ELnY`T5SXPUo1QVu&>CiD z!)C4z2bzHQHo7oV{nHL$Hr~@V9Sdtcee1JER1@?bJy;azjQRr=Kbr)2Fo&6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v$6DO(pEWtz;dun^Y>p=7+=BHW=9;$>^;=Six zNgmYqdy+x7P&gB{+%PJeZDubxa#pUJO^9~Q2*mST7jkl^s7`<93rIl^vsQ+a`bh8t zAd??(we7dM+dIIQiA8rT)SmI9zA*&8lB}Ad0U{{t+3i62-N{MouLD)Wx=y+|ssJ&7 z`Z#p7>2BZ)o@r~w9LkfHTWAkaN|D}E7+3C;yu?JnDr_^c(qm^GTF_8mH%@Wu)1MiT zn^%DbTwn8rxbsglFQU%>B056$oJFXB+T%GNt?#HgQJ-e=u4CubTP|i4n!mm3xdH{R z%e!-1-ol2*M(O6R%$An5`p5Ycn#aWr;9)*&5pY}9!(Ck3Uon-Qa{Mb_xxw8 z)8c1k3xJR|qeZUlW1Y@pl223-WpWs39zKFIG&?h^$;Ybr`P jmKOM*m@!c>82y57ozgDfmG9_4%Z2;* Date: Wed, 29 Jul 2026 15:55:04 +0400 Subject: [PATCH 4/7] Move ERD diagram to sql folder --- 05_src/assignment_one.png | 0 05_src/{data => sql}/assignment_one.drawio.png | Bin 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 05_src/assignment_one.png rename 05_src/{data => sql}/assignment_one.drawio.png (100%) diff --git a/05_src/assignment_one.png b/05_src/assignment_one.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/05_src/data/assignment_one.drawio.png b/05_src/sql/assignment_one.drawio.png similarity index 100% rename from 05_src/data/assignment_one.drawio.png rename to 05_src/sql/assignment_one.drawio.png From e3e291eb54021668cba13535d959d492c36d3392 Mon Sep 17 00:00:00 2001 From: Haroon Date: Wed, 29 Jul 2026 16:22:18 +0400 Subject: [PATCH 5/7] Added a assignment-one.sql file --- 05_src/sql/assignment_one.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 05_src/sql/assignment_one.sql diff --git a/05_src/sql/assignment_one.sql b/05_src/sql/assignment_one.sql new file mode 100644 index 000000000..e69de29bb From 3e5b0155770cabd266cb321a48927add1ec1da5b Mon Sep 17 00:00:00 2001 From: Haroon Date: Fri, 31 Jul 2026 04:11:51 +0400 Subject: [PATCH 6/7] Complete SQL assignment section 2 --- .../Microcredential_Cohort/assignment1.sql | 47 +- 04_this_cohort/live_code/module2_personal.sql | 31 ++ .../live_code/module_2/module_2.sqbpro | 434 ++++++++++-------- 3 files changed, 324 insertions(+), 188 deletions(-) create mode 100644 04_this_cohort/live_code/module2_personal.sql diff --git a/02_activities/assignments/Microcredential_Cohort/assignment1.sql b/02_activities/assignments/Microcredential_Cohort/assignment1.sql index 2ec561e2a..075630c85 100644 --- a/02_activities/assignments/Microcredential_Cohort/assignment1.sql +++ b/02_activities/assignments/Microcredential_Cohort/assignment1.sql @@ -7,7 +7,8 @@ /* 1. Write a query that returns everything in the customer table. */ --QUERY 1 - +SELECT * +FROM customer; --END QUERY @@ -17,7 +18,10 @@ sorted by customer_last_name, then customer_first_ name. */ --QUERY 2 - +SELECT * +FROM customer +ORDER BY customer_last_name, customer_first_name +LIMIT 10; --END QUERY @@ -28,7 +32,11 @@ sorted by customer_last_name, then customer_first_ name. */ Limit to 25 rows of output. */ --QUERY 3 - +SELECT * +FROM customer_purchases +WHERE product_id = 4 + OR product_id = 9 +LIMIT 25; --END QUERY @@ -43,9 +51,11 @@ Limit to 25 rows of output. */ --QUERY 4 - - - +SELECT *, + quantity * cost_per_quantity AS price +FROM customer_purchases +WHERE customer_id BETWEEN 8 AND 10 +LIMIT 25; --END QUERY @@ -56,7 +66,13 @@ columns and add a column called prod_qty_type_condensed that displays the word if the product_qty_type is “unit,” and otherwise displays the word “bulk.” */ --QUERY 5 - +SELECT product_id, + product_name, + CASE + WHEN product_qty_type = 'unit' THEN 'unit' + ELSE 'bulk' + END AS prod_qty_type_condensed +FROM product; --END QUERY @@ -67,6 +83,17 @@ add a column to the previous query called pepper_flag that outputs a 1 if the pr contains the word “pepper” (regardless of capitalization), and otherwise outputs 0. */ --QUERY 6 +SELECT product_id, + product_name, + CASE + WHEN product_qty_type = 'unit' THEN 'unit' + ELSE 'bulk' + END AS prod_qty_type_condensed, + CASE + WHEN LOWER(product_name) LIKE '%pepper%' THEN 1 + ELSE 0 + END AS pepper_flag +FROM product; @@ -79,6 +106,12 @@ vendor_id field they both have in common, and sorts the result by market_date, t Limit to 24 rows of output. */ --QUERY 7 +SELECT * +FROM vendor AS v +INNER JOIN vendor_booth_assignments AS vba + ON v.vendor_id = vba.vendor_id +ORDER BY vba.market_date, v.vendor_name +LIMIT 24; diff --git a/04_this_cohort/live_code/module2_personal.sql b/04_this_cohort/live_code/module2_personal.sql new file mode 100644 index 000000000..4933449cb --- /dev/null +++ b/04_this_cohort/live_code/module2_personal.sql @@ -0,0 +1,31 @@ +/* MODULE 2 */ +/* SELECT */ + + +/* 1. Select everything in the customer table */ +SELECT * FROM customer; + +/* 2. Use sql as a calculator */ +SELECT 1+1 AS addition, +10*5 AS multiplacation, pi() as pi; + + +/* 3. Add order by and limit clauses */ +SELECT * FROM customer +ORDER BY customer_first_name DESC +LIMIT 10; + + +/* 4. Select multiple specific columns */ +SELECT +customer_first_name, +customer_last_name, +customer_postal_code + +FROM customer; + +/* 5. Add a static value in a column */ +SELECT 2026 as this_year, 'July' as this_month, customer_id +FROM customer + +-------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/04_this_cohort/live_code/module_2/module_2.sqbpro b/04_this_cohort/live_code/module_2/module_2.sqbpro index 0719e69a4..d7cc9f907 100644 --- a/04_this_cohort/live_code/module_2/module_2.sqbpro +++ b/04_this_cohort/live_code/module_2/module_2.sqbpro @@ -1,181 +1,253 @@ -
/* MODULE 2 */ -/* SELECT */ - - -/* 1. Select everything in the customer table */ -SELECT - -/* 2. Use sql as a calculator */ - - - -/* 3. Add order by and limit clauses */ - - - -/* 4. Select multiple specific columns */ - - - -/* 5. Add a static value in a column */ - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* WHERE */ - -/* 1. Select only customer 1 from the customer table */ -SELECT * -FROM customer -WHERE - - -/* 2. Differentiate between AND and OR */ - - - -/* 3. IN */ - - - -/* 4. LIKE */ - - - -/* 5. Nulls and Blanks*/ - - - -/* 6. BETWEEN x AND y */ - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* CASE */ - - -SELECT * -/* 1. Add a CASE statement declaring which days vendors should come */ - - -/* 2. Add another CASE statement for Pie Day */ - - - -/* 3. Add another CASE statement with an ELSE clause to handle rows evaluating to False */ - - - -FROM vendor - -/* 4. Experiment with selecting a different column instead of just a string value */ - - - - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* DISTINCT */ - - -/* 1. Compare how many customer_ids are in the customer_purchases table, one select with distinct, one without */ - --- 4221 rows -SELECT customer_id FROM customer_purchases - - - -/* 2. Compare the difference between selecting market_day in market_date_info, with and without distinct: - what do these difference mean?*/ - - - -/* 3. Which vendor has sold products to a customer */ - - - -/* 4. Which vendor has sold products to a customer ... and which product was it */ - - - -/* 5. Which vendor has sold products to a customer -... and which product was it? -... AND to whom was it sold*/ - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* INNER JOIN */ - - -/* 1. Get product names (from product table) alongside customer_purchases - ... use an INNER JOIN to see only products that have been purchased */ - --- without table aliases - - - - -/* 2. Using the Query #5 from DISTINCT earlier - (Which vendor has sold products to a customer AND which product was it AND to whom was it sold) - - Add customers' first and last names with an INNER JOIN */ - --- using table aliases - - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* LEFT JOIN */ - - -/* 1. There are products that have been bought -... but are there products that have not been bought? -Use a LEFT JOIN to find out*/ - - -/* 2. Directions of LEFT JOINs matter ...*/ - - - - -/* 3. As do which values you filter on ... */ - - - - -/* 4. Without using a RIGHT JOIN, make this query return the RIGHT JOIN result set -...**Hint, flip the order of the joins** ... - -SELECT * - -FROM product_category AS pc -LEFT JOIN product AS p - ON pc.product_category_id = p.product_category_id - ORDER by pc.product_category_id - -...Note how the row count changed from 24 to 23 -*/ - - - --------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ -/* Multiple Table JOINs */ - - -/* 1. Using the Query #5 from DISTINCT earlier - (Which vendor has sold products to a customer AND which product was it AND to whom was it sold) - - Replace all the IDs (customer, vendor, and product) with the names instead*/ - - - -/* 2. Select product_category_name, everything from the product table, and then LEFT JOIN the customer_purchases table -... how does this LEFT JOIN affect the number of rows? - -Why do we have more rows now?*/ - -
+
-- Reference to file "C:/Users/vijda/OneDrive/Desktop/DSI_Class/repos/SQL/sql/04_this_cohort/live_code/module2_personal.sql" (not supported by this version) --/* MODULE 2 */ +/* WHERE */ + +/* 1. Select only customer 1 from the customer table */ +SELECT * +FROM customer +WHERE customer_id = 1; + + + +/* 2. Differentiate between AND and OR */ +SELECT * +FROM customer +WHERE customer_id = 1 +OR customer_id = 2; + + + +/* 3. IN */ +SELECT* +FROM customer +WHERE customer_id IN (3,4,5,6,7); + + +/* 4. LIKE */ + +SELECT * FROM product +WHERE product_name LIKE '%pepper%'; + + +/* 5. Nulls and Blanks*/ +SELECT * FROM product +WHERE product_size IS NULL +OR product_size = ''; + + +/* 6. BETWEEN x AND y */ +SELECT * +FROM customer +WHERE customer_id BETWEEN 1 AND 20; + +-------------------------------------------------------------------------------------------------------------------------------------------- +/* MODULE 2 */ +/* CASE */ + + +SELECT * +/* 1. Add a CASE statement declaring which days vendors should come */ + +,CASE WHEN vendor_type = 'Fresh Focused' THEN 'Wednesday' + WHEN vendor_type = 'Eggs & Meats' THEN 'Thursday' + ELSE 'Saturday' + END as day_of_specialty + + + +/* 2. Add another CASE statement for Pie Day */ +,CASE WHEN vendor_name = "Annie's Pies" -- double quotes okay here + THEN 'Annie is the best' + END as pie_day + + + + +/* 3. Add another CASE statement with an ELSE clause to handle rows evaluating to False */ +,CASE WHEN vendor_name LIKE '%pie%' + THEN 'Wednesday' -- this came first for Annie even though she sells Prepared Foods too + WHEN vendor_type = 'Prepared Foods' + THEN 'Thursday' + ELSE 'Friday' + END as pies_special_day + +FROM vendor; + +/* 4. Experiment with selecting a different column instead of just a string value */ + +SELECT * +,CASE WHEN cost_per_quantity < 1.00 + THEN cost_per_quantity*5 + ELSE cost_per_quantity + END as inflation + +FROM customer_purchases + + + +-------------------------------------------------------------------------------------------------------------------------------------------- +/* MODULE 2 */ +/* DISTINCT */ + + +/* 1. Compare how many customer_ids are in the customer_purchases table, one select with distinct, one without */ + +-- 4221 rows +SELECT customer_id FROM customer_purchases; + +SELECT DISTINCT customer_id FROM customer_purchases; + + +/* 2. Compare the difference between selecting market_day in market_date_info, with and without distinct: + what do these difference mean?*/ + + -- market is open for 150 days +SELECT market_day +FROM market_date_info; + +-- market is only open 2 days, saturday and wednesday +SELECT DISTINCT market_day +FROM market_date_info; + + +/* 3. Which vendor has sold products to a customer */ + +SELECT DISTINCT vendor_id +FROM customer_purchases; +-- only 3 vendors have sold anything at the farmers market :( + +/* 4. Which vendor has sold products to a customer ... and which product was it */ + +SELECT DISTINCT vendor_id, product_id +FROM customer_purchases; + +/* 5. Which vendor has sold products to a customer +... and which product was it? +... AND to whom was it sold*/ + +SELECT DISTINCT vendor_id, product_id, customer_id +FROM customer_purchases; +-------------------------------------------------------------------------------------------------------------------------------------------- +/* MODULE 2 */ +/* INNER JOIN */ + + +/* 1. Get product names (from product table) alongside customer_purchases + ... use an INNER JOIN to see only products that have been purchased */ + +-- without table aliases + +SELECT product_name, -- coming from the product TABLE +vendor_id, -- rest of these are coming from customer_purchases table +market_date, +customer_id, +customer_purchases.product_id, +product.product_id + + +FROM product +INNER JOIN customer_purchases + ON customer_purchases.product_id = product.product_id; + + +/* 2. Using the Query #5 from DISTINCT earlier + (Which vendor has sold products to a customer AND which product was it AND to whom was it sold) + + Add customers' first and last names with an INNER JOIN */ + +-- using table aliases + +SELECT DISTINCT +vendor_id, -- coming from cp +product_id, -- coming from cp +c.customer_id, -- coming from c (and below) +customer_first_name, +customer_last_name + +FROM customer_purchases AS cp +INNER JOIN customer AS c + ON cp.customer_id = c.customer_id + +-------------------------------------------------------------------------------------------------------------------------------------------- +/* MODULE 2 */ +/* LEFT JOIN */ + + +/* 1. There are products that have been bought +... but are there products that have not been bought? +Use a LEFT JOIN to find out*/ + +SELECT DISTINCT +p.product_id +,cp.product_id as [cp_product_id] +,product_name + +FROM product as p +LEFT JOIN customer_purchases as cp + ON p.product_id = cp.product_id; + + +/* 2. Directions of LEFT JOINs matter ...*/ + +SELECT DISTINCT +p.product_id +,cp.product_id as [cp_product_id] +,product_name + +FROM customer_purchases as cp +LEFT JOIN product as p + ON p.product_id = cp.product_id; + + + +/* 3. As do which values you filter on ... */ + +SELECT DISTINCT +p.product_id +,cp.product_id as [cp_product_id] +,product_name + +FROM product as p +LEFT JOIN customer_purchases as cp + ON p.product_id = cp.product_id +WHERE cp.product_id BETWEEN 1 AND 6; + + +/* 4. Without using a RIGHT JOIN, make this query return the RIGHT JOIN result set +...**Hint, flip the order of the joins** ... + +SELECT * + +FROM product_category AS pc +LEFT JOIN product AS p + ON pc.product_category_id = p.product_category_id + ORDER by pc.product_category_id + +...Note how the row count changed from 24 to 23 +*/ + +SELECT * + +FROM product AS p +LEFT JOIN product_category AS pc + ON pc.product_category_id = p.product_category_id + +ORDER by pc.product_category_id + +-------------------------------------------------------------------------------------------------------------------------------------------- +/* MODULE 2 */ +/* Multiple Table JOINs */ + + +/* 1. Using the Query #5 from DISTINCT earlier + (Which vendor has sold products to a customer AND which product was it AND to whom was it sold) + + Replace all the IDs (customer, vendor, and product) with the names instead*/ + + + +/* 2. Select product_category_name, everything from the product table, and then LEFT JOIN the customer_purchases table +... how does this LEFT JOIN affect the number of rows? + +Why do we have more rows now?*/ + +
From f47a72e932fcb40c310bc3724c29910748c6d4de Mon Sep 17 00:00:00 2001 From: Haroon Date: Mon, 3 Aug 2026 01:36:26 +0400 Subject: [PATCH 7/7] Complete SQL assignment section 3 --- .../Microcredential_Cohort/assignment1.sql | 56 +++++++++++++++++-- .../live_code/module_2/module_2.sqbpro | 15 ++++- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/02_activities/assignments/Microcredential_Cohort/assignment1.sql b/02_activities/assignments/Microcredential_Cohort/assignment1.sql index 075630c85..9bc20dcfb 100644 --- a/02_activities/assignments/Microcredential_Cohort/assignment1.sql +++ b/02_activities/assignments/Microcredential_Cohort/assignment1.sql @@ -126,7 +126,11 @@ LIMIT 24; at the farmer’s market by counting the vendor booth assignments per vendor_id. */ --QUERY 8 - +SELECT vendor_id, + COUNT(*) AS booth_rental_count +FROM vendor_booth_assignments +GROUP BY vendor_id +ORDER BY vendor_id; --END QUERY @@ -139,7 +143,19 @@ of customers for them to give stickers to, sorted by last name, then first name. HINT: This query requires you to join two tables, use an aggregate function, and use the HAVING keyword. */ --QUERY 9 - +SELECT c.customer_id, + c.customer_first_name, + c.customer_last_name, + SUM(cp.quantity * cp.cost_per_quantity) AS total_spent +FROM customer AS c +INNER JOIN customer_purchases AS cp + ON c.customer_id = cp.customer_id +GROUP BY c.customer_id, + c.customer_first_name, + c.customer_last_name +HAVING SUM(cp.quantity * cp.cost_per_quantity) > 2000 +ORDER BY c.customer_last_name, + c.customer_first_name; --END QUERY @@ -158,6 +174,28 @@ VALUES(col1,col2,col3,col4,col5) */ --QUERY 10 +DROP TABLE IF EXISTS temp.new_vendor; + +CREATE TEMP TABLE new_vendor AS +SELECT * +FROM vendor; + +INSERT INTO new_vendor ( + vendor_id, + vendor_name, + vendor_type, + vendor_owner_first_name, + vendor_owner_last_name +) +VALUES ( + 10, + 'Thomass Superfood Store', + 'Fresh Focused', + 'Thomas', + 'Rosenthal' +); + + @@ -172,7 +210,11 @@ and year are! Limit to 25 rows of output. */ --QUERY 11 - +SELECT customer_id, + strftime('%m', market_date) AS month, + strftime('%Y', market_date) AS year +FROM customer_purchases +LIMIT 25; --END QUERY @@ -186,7 +228,13 @@ but remember, STRFTIME returns a STRING for your WHERE statement... AND be sure you remove the LIMIT from the previous query before aggregating!! */ --QUERY 12 - +SELECT customer_id, + SUM(quantity * cost_per_quantity) AS total_spent +FROM customer_purchases +WHERE strftime('%m', market_date) = '04' + AND strftime('%Y', market_date) = '2022' +GROUP BY customer_id +ORDER BY customer_id; --END QUERY diff --git a/04_this_cohort/live_code/module_2/module_2.sqbpro b/04_this_cohort/live_code/module_2/module_2.sqbpro index d7cc9f907..1c97d7a8f 100644 --- a/04_this_cohort/live_code/module_2/module_2.sqbpro +++ b/04_this_cohort/live_code/module_2/module_2.sqbpro @@ -1,4 +1,4 @@ -
-- Reference to file "C:/Users/vijda/OneDrive/Desktop/DSI_Class/repos/SQL/sql/04_this_cohort/live_code/module2_personal.sql" (not supported by this version) --/* MODULE 2 */ +
-- Reference to file "C:/Users/vijda/OneDrive/Desktop/DSI_Class/repos/SQL/sql/04_this_cohort/live_code/module2_personal.sql" (not supported by this version) --/* MODULE 2 */ /* WHERE */ /* 1. Select only customer 1 from the customer table */ @@ -234,7 +234,7 @@ LEFT JOIN product_category AS pc ORDER by pc.product_category_id -------------------------------------------------------------------------------------------------------------------------------------------- -/* MODULE 2 */ +/* MODULE 2 */ /* Multiple Table JOINs */ @@ -243,7 +243,16 @@ ORDER by pc.product_category_id Replace all the IDs (customer, vendor, and product) with the names instead*/ - +/* 2. We want to flag all of the different types of pepper products that are sold at the market. +add a column to the previous query called pepper_flag that outputs a 1 if the product_name +contains the word “pepper” (regardless of capitalization), and otherwise outputs 0. */ +--QUERY 6 + + + + + +--END QUERY /* 2. Select product_category_name, everything from the product table, and then LEFT JOIN the customer_purchases table ... how does this LEFT JOIN affect the number of rows?