Skip to content

assignment-two completed#3

Open
AbrahimSA wants to merge 2 commits intomainfrom
assignment-two
Open

assignment-two completed#3
AbrahimSA wants to merge 2 commits intomainfrom
assignment-two

Conversation

@AbrahimSA
Copy link
Copy Markdown
Owner

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

Complete assignment two

What did you learn from the changes you have made?

Very good task; it took me some time to complete.

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

NA

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

Yes, there were, because of complexity I had two doubts about the approach I should take

How were these changes tested?

Using SQLite

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

@efantinatti efantinatti left a comment

Choose a reason for hiding this comment

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

Dear Abrahim Senra Abrahao

Session 1:
1 - OK.

Session 2:
2 - Partial
-- Windowed Functions - Q3: Missing transaction time, output also not sorted.
-- String manipulations - Q1: Try making it without the product names or partially product names. The question asks with a very specific character.
-- Union - Q1: Marked OK. Just a hint. Could be ranked over asc for the first part.

Session 3:
3 - Partial
-- CROSS JOIN - Q1: The result seems not resoanable. Based on your question about understanding the question you can try it without counting customers and grouping by after the CROSS JOIN. You ay think it visually.
-- INSERT - Q2: Seens like you added a product that doesn't exist in the products table ("Pasture-raised eggs") and the DELETE clause won't work for the older same product. Please review it.
-- UPDATE - Q1: Missing the "ALTER TABLE product_units ADD current_quantity INT;", your query can't work without it. Also, you have two UPDATE clauses with some issues (check if ";" is important too) and check why your result is resulting in 0 (zero).

Final:
4 - Review the points aforementioned prior merging your feature branch assignment-two to main.

Mark: 62 points.

@AbrahimSA
Copy link
Copy Markdown
Owner Author

@efantinatti , thanks for review my assignment, I updated the queries related the points you highlight and push this again with some comments , I would really appreciate it if you could look into this again.

@efantinatti
Copy link
Copy Markdown

Consider running your queries.

This one runs into error because of a comma (query is good now but must be tested prior delivery):

-- String manipulations - Q1:
SELECT
product_name,
TRIM(SUBSTR(product_name, INSTR(product_name, '-') + 2)) AS product_description,
FROM product
WHERE INSTR(product_name, '-') > 0;

-- UPDATE - Q1: Still with error. Consider runningm your query prior to delivery.

@AbrahimSA
Copy link
Copy Markdown
Owner Author

select-product_units-after-update
update-without-error
Thanks again @efantinatti , sorry the select query has comma after product_description column.
Related of UPDATE query I could not figure out the error you found I executed this one without problem.

@efantinatti
Copy link
Copy Markdown

Hi @AbrahimSA

The SQL query as written is not syntactically correct. It contains multiple issues, including duplicate SET clauses and overly complex subquery nesting that isn't properly structured, assuming you want to update product_units.current_quantity based on the most recent quantity in vendor_inventory for each product_id.

Think on a simplifyed version of it.

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