Skip to content

Add completed assignment1.sql and ERD diagram for Assignment 1#1

Open
AmmarMahzan wants to merge 1 commit intomainfrom
assignment_one
Open

Add completed assignment1.sql and ERD diagram for Assignment 1#1
AmmarMahzan wants to merge 1 commit intomainfrom
assignment_one

Conversation

@AmmarMahzan
Copy link
Copy Markdown
Owner

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

Added completed SQL queries for Assignment 1 and the ERD diagram (DSI_SQL_A1.png) showing the relationship between customer and customer_purchases.

What did you learn from the changes you have made?

I practiced writing SQL queries using SELECT, WHERE, JOIN, CASE, AGGREGATE, and DATE functions. I also learned how to create logical data models and represent table relationships clearly in an ERD.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

Not sure

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

Yes. Setting up the Git SSH connection and troubleshooting GitHub permission errors was challenging but rewarding. Because for this assignment, I'm using my wife's laptop. Also, using STRFTIME and CASE required some testing.

How were these changes tested?

All SQL queries were tested using DB Browser for SQLite with the provided farmersmarket.db file. The entire script executed without errors and returned correct results.
Execution finished without errors.
Result: 25 rows returned in 29ms
At line 151:
/* 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!! */
-- 2. Total money spent in April 2022
SELECT customer_id,
SUM(quantity * cost_to_customer_per_qty) AS april_2022_spent
FROM customer_purchases
WHERE STRFTIME('%m', market_date) = '04'
AND STRFTIME('%Y', market_date) = '2022'
GROUP BY customer_id;

A reference to a related issue in your repository (if applicable)

Checklist

  • [ X] I can confirm that my changes are working as intended

@AmmarMahzan
Copy link
Copy Markdown
Owner Author

Are my steps for this SQL assignment correct?

@AmmarMahzan
Copy link
Copy Markdown
Owner Author

Hi! Here’s my work for SQL Assignment #1. Please review and merge if it looks good. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant