Skip to content

UofT-DSI | SQL - Assignment #2 Section 1, Section 2 and Section 3#2

Open
AmmarMahzan wants to merge 4 commits intomainfrom
assignment-two
Open

UofT-DSI | SQL - Assignment #2 Section 1, Section 2 and Section 3#2
AmmarMahzan wants to merge 4 commits intomainfrom
assignment-two

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)

  • Section 1: Logical Model ERD design and writeup
  • Section 2: Advanced SQL queries (COALESCE, Windowed Functions, String Manipulations, UNION)
  • Section 3: SQL operations (CROSS JOIN, INSERT, DELETE, UPDATE)

What did you learn from the changes you have made?

Learned how to create logical models, manage changing data, and apply advanced SQL concepts like window functions and string manipulation.

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

No other major approaches considered.

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

Faced small challenges handling CROSS JOIN explosion and UPDATE queries, especially referencing correct latest quantities, but managed to solve them.

How were these changes tested?

Tested all queries in DB Browser for SQLite. Execution finished successfully.

Execution finished without errors.
Result: query executed successfully. Took 2ms
At line 227:
-- Update current_quantity from vendor_inventory
UPDATE product_units
SET current_quantity = (
SELECT COALESCE(vi.quantity, 0)
FROM vendor_inventory vi
WHERE vi.product_id = product_units.product_id
ORDER BY vi.market_date DESC
LIMIT 1
)
WHERE EXISTS (
SELECT 1
FROM vendor_inventory vi
WHERE vi.product_id = product_units.product_id
);

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

Checklist

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

Copy link
Copy Markdown

@niyazmnazari niyazmnazari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting assignment 2. All queries are correct but you missed section 1.
Point: 20/70

@AmmarMahzan
Copy link
Copy Markdown
Owner Author

AmmarMahzan commented Apr 30, 2025 via email

@AmmarMahzan
Copy link
Copy Markdown
Owner Author

Hi, I’ve updated Section 1 to align with the correct submission format. Previously, I submitted my written response as a PDF (AmmarMahzan_SQL_Assignment#2-Section1.pdf), but I now understand that the response should be written directly in Assignment2.md and supported by ERD diagrams. I’ve now moved the content accordingly and uploaded the required diagrams.
@AmmarMahzan
Copy link
Copy Markdown
Owner Author

I’ve updated Section 1 to follow the correct format. The written content is now included directly in Assignment2.md, and all ERD diagrams have been uploaded as .png files in the same folder. This completes the Section 1 submission requirements.

Copy link
Copy Markdown

@niyazmnazari niyazmnazari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! 70/70

You have 4 'Sales' tables in first page and you fixed it in next pages.

@AmmarMahzan
Copy link
Copy Markdown
Owner Author

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.

2 participants