This repository was archived by the owner on Aug 17, 2024. It is now read-only.
MANCHESTER -CLASS-5-Miguel-Cabral-SQL-Coursework-WEEK-2#189
Open
Miguel-Cabral wants to merge 4 commits intoCodeYourFuture:mainfrom
Open
MANCHESTER -CLASS-5-Miguel-Cabral-SQL-Coursework-WEEK-2#189Miguel-Cabral wants to merge 4 commits intoCodeYourFuture:mainfrom
Miguel-Cabral wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
savagematt
reviewed
Feb 25, 2023
| 2. Retrieve all the customers in ascending name sequence | ||
| A = SELECT * FROM customers ORDER BY name ASC; | ||
| 3. Retrieve all the products whose name contains the word `socks` | ||
| A = SELECT * FROM products WHERE lower(product_name) LIKE '%socks%'; |
There was a problem hiding this comment.
Excellent that you've made the casing match on both sides, and correctly used LIKE with wildcards % at each end
| ON product_availability.supp_id = suppliers.id AND suppliers.country = 'United Kingdom'; | ||
|
|
||
| 8. Retrieve all orders, including order items, from customer ID `1`. Include order id, reference, date and total cost (calculated as quantity * unit price). | ||
| A = SELECT orders.id, orders.order_reference, orders.order_date, order_items.quantity * product_availability.unit_price AS total_cost |
There was a problem hiding this comment.
Putting an explicit name for the calculated column as total_cost is good!
You've split the rest of the query on to one line per clause, which makes this easy to read. Sometimes it's good to split each field in the select clause into a separate line as well so I can quickly see exactly what fields are returned, without my eyes need to scan past commas.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?