Skip to content

Homework-4,5,6#4

Open
dkrishnm wants to merge 8 commits intomainfrom
homework
Open

Homework-4,5,6#4
dkrishnm wants to merge 8 commits intomainfrom
homework

Conversation

@dkrishnm
Copy link
Copy Markdown
Owner

@dkrishnm dkrishnm commented May 24, 2024

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

What did you learn from the changes you have made?

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

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

How were these changes tested?

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

Checklist

  • I can confirm that my changes are working as intended

Copy link
Copy Markdown

@amanda-ng518 amanda-ng518 left a comment

Choose a reason for hiding this comment

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

HW4: good, awaiting UNION SQL to be done in HW5
8/8

@dkrishnm dkrishnm changed the title SQL: homework4 updates SQL: homework4,5 updates May 25, 2024
@dkrishnm
Copy link
Copy Markdown
Owner Author

HW4: good, awaiting UNION SQL to be done in HW5
8/8

Update HW4 with union SQL along with HW5

@dkrishnm dkrishnm changed the title SQL: homework4,5 updates Homework-4,5,6 May 25, 2024
Copy link
Copy Markdown

@amanda-ng518 amanda-ng518 left a comment

Choose a reason for hiding this comment

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

HW5: 8/8, good

INSERT Q2
INSERT INTO product_units (product_id, product_name,
product_size, product_category_id, product_qty_type, snapshot_timestamp)
SELECT
product_id,
product_name,
product_size,
product_category_id,
product_qty_type,
CURRENT_TIMESTAMP
FROM product AS p
WHERE product_id = 7

DELETE Q1
WITH older_record AS
(SELECT product_id
,MIN(snapshot_timestamp) AS snapshot_timestamp
FROM product_units
WHERE product_id = 7)
DELETE FROM product_units
WHERE (product_id =
(SELECT product_id
FROM older_record
)
AND snapshot_timestamp =
(SELECT snapshot_timestamp
FROM older_record
))

UPDATE may include
ALTER TABLE product_units
ADD current_quantity INT;

Copy link
Copy Markdown

@amanda-ng518 amanda-ng518 left a comment

Choose a reason for hiding this comment

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

HW6: 8/8

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