Conversation
monzchan
approved these changes
Nov 19, 2025
|
|
||
| SELECT *, quantity * cost_to_customer_per_qty as price | ||
| FROM customer_purchases | ||
| WHERE product_id BETWEEN 8 and 10; |
There was a problem hiding this comment.
should be customer_id instead of product_id
| -- option 1 | ||
| SELECT *, quantity * cost_to_customer_per_qty as price | ||
| FROM customer_purchases | ||
| WHERE product_id >= 8 and product_id <= 10; |
There was a problem hiding this comment.
should be customer_id instead of product_id
|
|
||
| SELECT product_id, product_name, | ||
| case when product_qty_type = 'unit' THEN 'unit' else 'bulk' end as prod_qty_type_condensed, | ||
| CASE WHEN product_name like '%peppers%' THEN 1 else 0 end as pepper_flag |
There was a problem hiding this comment.
LIKE '%pepper%' -- this will not match "Pepper" or "PEPPER". Consider using LOWER(...) LIKE '...'
| /* 1. Write a query that determines how many times each vendor has rented a booth | ||
| at the farmer’s market by counting the vendor booth assignments per vendor_id. */ | ||
|
|
||
| SELECT vendor_id, count (booth_number) |
There was a problem hiding this comment.
The question requires he vendor booth assignments per vendor_id. count (*) or count (vendor_id) would be more appropriate here.
| customer_last_name, | ||
| sum(cp.quantity * cp.cost_to_customer_per_qty) as tot_spd | ||
| FROM customer c | ||
| left join customer_purchases cp |
There was a problem hiding this comment.
LEFT JOIN includes customers with no purchases, generating NULL totals. INNER JOIN would be a better option here.
| VALUES | ||
| (10, 'Thomass Superfood Store', 'Fresh Focused', 'Thomas', 'Rosenthal'); | ||
|
|
||
| SELECT * FROM "new_vendor"; |
There was a problem hiding this comment.
here should be temp.new_vendor instead of new_vendor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
completed assignment one of SQL module.
What did you learn from the changes you have made?
intended course content.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
none.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
none.
How were these changes tested?
test with test queries and results are expected.
A reference to a related issue in your repository (if applicable)
not applicable.
Checklist