Skip to content
Closed
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
4 changes: 3 additions & 1 deletion 02_activities/assignments/DC_Cohort/Assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,7 @@ Consider, for example, concepts of fariness, inequality, social structures, marg


```
Your thoughts...
My dissertation is about the social construction of data, so I have thought & read a lot about how data systems encode values. The clearest example for me is names and family. I have a married friend who is marked as unmarried in Korean databases because she wanted her child to share her last name, and it is not possible to have two surnames in Korean systems. The assumptions and values built into databases about how parentage, marriage, and naming are linked does not line up with real people's lives. Travel is another place where names and family values, in addition to assumptions about bodies and national borders, play out in databases. Your name, your body, your family, and your itinerary all have to line up across multiple databases. If anything is off, it looks suspicious. The people who are already dealing with complicated situations (migration, gender, non-traditional families) end up having the hardest time, so it adds to inequality that was already there. I can also think about how Netflix blocks password sharing based on IP address, which assumes that your family all lives in the same place and that the people you live with are the people you care about. That leaves out a lot of people, like students living away from home, divorced parents, or relatives in different countries. I also see it at school. A gradebook is one number or letter for each assignment, and it doesn't account for different learning styles, abilities, or personal circumstances. The way we deal with that is by adding "patches" like accessibility accommodations and extensions. Those help, but they treat the student as an exception who has to ask for special treatment, instead of changing how we evaluate people in the first place. The student has to disclose personal stuff and get approved, while the system itself stays the same.

What these examples have in common is that someone decided on the categories ahead of time, and those decisions reflect certain values: standardization over variety, convenience over real life, and a narrow idea of what a family or a person is. When something doesn't fit, the person is the one who has to adjust and prove themselves, not the database. I think that's an ethical problem and not just a technical one, because it decides who gets to be seen as legitimate. If we want fairer systems, we have to ask who made the categories and who gets left out of them.
```
84 changes: 72 additions & 12 deletions 02_activities/assignments/DC_Cohort/assignment1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/* 1. Write a query that returns everything in the customer table. */
--QUERY 1


SELECT * FROM customer


--END QUERY
Expand All @@ -17,7 +17,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
Expand All @@ -28,7 +31,10 @@ 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
Expand All @@ -43,7 +49,10 @@ 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
Expand All @@ -56,7 +65,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
FROM product


--END QUERY
Expand All @@ -67,7 +82,18 @@ 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,
CASE
WHEN product_name LIKE '%pepper%'
THEN 1
ELSE 0
END AS pepper_flag
FROM product


--END QUERY
Expand All @@ -79,7 +105,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
JOIN vendor_booth_assignments as vba
ON v.vendor_id = vba.vendor_id
ORDER BY market_date, vendor_name
LIMIT 24


--END QUERY
Expand All @@ -93,6 +124,9 @@ Limit to 24 rows of output. */
at the farmer’s market by counting the vendor booth assignments per vendor_id. */
--QUERY 8

SELECT vendor_id, COUNT(vendor_id) AS number_of_rentals
FROM vendor_booth_assignments
GROUP BY vendor_id



Expand All @@ -106,7 +140,17 @@ 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
cp.customer_id,
SUM(cp.quantity * cp.cost_per_quantity) AS total_spent,
c.customer_first_name,
c.customer_last_name
FROM customer_purchases as cp
FULL OUTER JOIN customer as c
ON cp.customer_id = c.customer_id
GROUP BY cp.customer_id
HAVING total_spent > 2000
ORDER BY customer_last_name, customer_first_name


--END QUERY
Expand All @@ -125,8 +169,11 @@ VALUES(col1,col2,col3,col4,col5)
*/
--QUERY 10

CREATE TEMP TABLE new_vendor AS
SELECT * FROM vendor;


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

--END QUERY

Expand All @@ -139,8 +186,13 @@ and year are!
Limit to 25 rows of output. */
--QUERY 11



SELECT
customer_id,
market_date,
STRFTIME('%m', market_date) AS market_month,
STRFTIME('%Y', market_date) AS market_year
FROM customer_purchases
LIMIT 25

--END QUERY

Expand All @@ -153,7 +205,15 @@ 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,
market_date,
STRFTIME('%m', market_date) AS market_month,
STRFTIME('%Y', market_date) AS market_year,
quantity*cost_per_quantity AS money_spent
FROM customer_purchases
WHERE market_month = '07' AND market_year = '2022'
GROUP BY customer_id


--END QUERY
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading