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
673 changes: 673 additions & 0 deletions 02_activities/assignments/DC_Cohort/Assignment1.html

Large diffs are not rendered by default.

688 changes: 688 additions & 0 deletions 02_activities/assignments/DC_Cohort/Assignment2.html

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions 02_activities/assignments/DC_Cohort/Assignment2.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* Open a private window in your browser. Copy and paste the link to your pull request into the address bar. Make sure you can see your pull request properly. This helps the technical facilitator and learning support staff review your submission easily.

Checklist:
- [ ] Create a branch called `assignment-two`.
- [ ] Ensure that the repository is public.
- [ ] Review [the PR description guidelines](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md#guidelines-for-pull-request-descriptions) and adhere to them.
- [ ] Verify that the link is accessible in a private browser window.
- [X] Create a branch called `assignment-two`.
- [X] Ensure that the repository is public.
- [X] Review [the PR description guidelines](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md#guidelines-for-pull-request-descriptions) and adhere to them.
- [X] Verify that the link is accessible in a private browser window.

If you encounter any difficulties or have questions, please don't hesitate to reach out to our team via our Slack. Our Technical Facilitators and Learning Support staff are here to help you navigate any challenges.

Expand Down Expand Up @@ -54,7 +54,9 @@ The store wants to keep customer addresses. Propose two architectures for the CU
**HINT:** search type 1 vs type 2 slowly changing dimensions.

```
Your answer...
My understanding is that Slowly Changing Dimensions is the use of two tables that track basically teh same information but one keeps the records (Type 2) while
the other one receives the updated copy (Type 1). This way we are able to keep track of the customer's previous addreses in this case, rather than losing it that data
every tiem there is a change.
```

***
Expand Down Expand Up @@ -183,5 +185,15 @@ Consider, for example, concepts of labour, bias, LLM proliferation, moderating c


```
Your thoughts...
There were a lot of interesting concepts that came to mind as I read the article. There were severa ethical issues. Even though, it was helpful and efficient to use mechanical Amazon Turk
to classify those images, it was a moment where the effect globalization on labour and renumeration was evident. The people working on Amazon Turk are likely from low income countries, and
are being paid very little to complete the monotomous task. This serves as a clear example of the exploitation of labour.
As someone that is currently working on creating my own dataset to try for future machine learning, I have been recently been pondering a lot about the quality of data we use to build these models, it
worries me that any error would be amplified in the final model. This brings to mind the current issues we face regarding AI art, or any creative work, it has been disheartening to see people's work be stolen,
and the. disconnect from the public to realize that just because AI can do it, it doesn't make it easier or pointless to do it yourself, or acquire a piece of art from an actual artist.
One last thing that came to mind, relates back to moderating the content that goes into models, people can be ruthless and cruel when no one is watching. Toxicity towards humans in already a problem in the internet,
I'd imagine some people might be much worse when they know they are talking to a bot. This may for one give them the false sense that it is okay to communicate themselves in such a way, and also could influence the sort of
data available for models to train on.
Overall, this was a thought-provoking article on the deeply intertwinned relationship between human nature and AI models. Since it is all human, and we are full of ethical concerns LOL, it should be expected that
an model without morals would generate all these ethical concerns.
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 85 additions & 8 deletions 02_activities/assignments/DC_Cohort/assignment1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@

--SELECT
/* 1. Write a query that returns everything in the customer table. */

SELECT *
FROM customer;


/* 2. Write a query that displays all of the columns and 10 rows from the cus- tomer table,
sorted by customer_last_name, then customer_first_ name. */

SELECT *
FROM customer
ORDER BY customer_last_name, customer_first_name
LIMIT 10;


--WHERE
/* 1. Write a query that returns all customer purchases of product IDs 4 and 9. */
SELECT *
FROM customer_purchases
WHERE product_id = 4
OR product_id = 9;



Expand All @@ -24,46 +32,77 @@ filtered by customer IDs between 8 and 10 (inclusive) using either:
*/
-- option 1

SELECT *, quantity * cost_to_customer_per_qty as price
FROM customer_purchases
WHERE customer_id >= 8 AND customer_id <= 10;

-- option 2

SELECT *, quantity * cost_to_customer_per_qty as price
FROM customer_purchases
WHERE customer_id BETWEEN 8 AND 10;


--CASE
/* 1. Products can be sold by the individual unit or by bulk measures like lbs. or oz.
Using the product table, write a query that outputs the product_id and product_name
columns and add a column called prod_qty_type_condensed that displays the word “unit”
if the product_qty_type is “unit,” and otherwise displays the word “bulk.” */

SELECT product_id, product_name
,CASE WHEN product_qty_type = 'unit' THEN 'unit'
ELSE 'bulk'
END as prod_qty_type_condensed
FROM product;


/* 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. */

SELECT product_id, product_name
,CASE WHEN product_qty_type = 'unit' THEN 'unit'
ELSE 'bulk'
END as prod_qty_type_condensed
,CASE WHEN product_name LIKE '%pepper%' THEN 1
ELSE 0
END as pepper_flag
FROM product;


--JOIN
/* 1. Write a query that INNER JOINs the vendor table to the vendor_booth_assignments table on the
vendor_id field they both have in common, and sorts the result by vendor_name, then market_date. */


SELECT *
FROM vendor
INNER JOIN vendor_booth_assignments
ON vendor.vendor_id = vendor_booth_assignments.vendor_id
ORDER BY vendor.vendor_name, vendor_booth_assignments.market_date;


/* SECTION 3 */

-- AGGREGATE
/* 1. Write a query that determines how many times each vendor has rented a booth
at the farmer’s market by counting the vendor booth assignments per vendor_id. */

SELECT vendor_id, COUNT(vendor_id) as num_of_rented_booth
FROM vendor_booth_assignments
GROUP BY vendor_id;


/* 2. The Farmer’s Market Customer Appreciation Committee wants to give a bumper
sticker to everyone who has ever spent more than $2000 at the market. Write a query that generates a list
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. */
SELECT c.customer_id,customer_first_name, customer_last_name,
SUM(quantity*cost_to_customer_per_qty) as total_spend

FROM customer_purchases as cp
INNER JOIN customer as c
ON cp.customer_id = c.customer_id

GROUP BY c.customer_id
HAVING total_spend > 3000
ORDER BY customer_last_name, customer_first_name;


--Temp Table
Expand All @@ -78,6 +117,12 @@ When inserting the new vendor, you need to appropriately align the columns to be
VALUES(col1,col2,col3,col4,col5)
*/

CREATE TABLE temp.new_vendor AS
SELECT *
FROM vendor;

INSERT INTO temp.new_vendor
VALUES ('10', 'Thomass Superfood Store', 'Fresh Focused store' , 'Thomas', 'Rosenthal');


-- Date
Expand All @@ -86,11 +131,43 @@ VALUES(col1,col2,col3,col4,col5)
HINT: you might need to search for strfrtime modifers sqlite on the web to know what the modifers for month
and year are! */


SELECT
customer_id,
strftime('%m', market_date) AS month,
strftime('%Y', market_date) AS Year
FROM customer_purchases;

/* 2. Using the previous query as a base, determine how much money each customer spent in April 2022.
Remember that money spent is quantity*cost_to_customer_per_qty.

HINTS: you will need to AGGREGATE, GROUP BY, and filter...
but remember, STRFTIME returns a STRING for your WHERE statement!! */

SELECT
customer_id,
market_date,
SUM(quantity*cost_to_customer_per_qty) AS total_spent

FROM customer_purchases

WHERE
strftime('%m', market_date) = '04' AND
strftime('%Y', market_date) = '2022'

GROUP BY customer_id;
















Loading