Skip to content
This repository was archived by the owner on Aug 17, 2024. It is now read-only.

Conversation

Miguel-Cabral
Copy link

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

3. Retrieve all the products whose name contains the word `socks`
A = SELECT * FROM products WHERE lower(product_name) LIKE '%socks%';

Choose a reason for hiding this comment

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

Excellent that you've made the casing match on both sides, and correctly used LIKE with wildcards % at each end

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

Choose a reason for hiding this comment

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

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants