London 9 - Andriana Saffo - Module-Databases - Week 2 - #34
Closed
AndrianaOS wants to merge 4 commits into
Closed
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
No changes are required to this file for your PR
There was a problem hiding this comment.
No changes are required to this file for your PR
There was a problem hiding this comment.
No changes are required to this file for the Week 2 exercise
There was a problem hiding this comment.
No changes are required to this file for this PR
There was a problem hiding this comment.
No changes are required to this file for this PR
| - [ ] List the 5 most expensive products | ||
|
|
||
| ```sql | ||
| SELECT p.id, p.product_name, pa.unit_price FROM products p INNER JOIN product_availability pa ON p.id = pa.prod_id ORDER BY pa.unit_price DESC LIMIT 5; |
| - [ ] List all the products sold by suppliers based in the United Kingdom. The result should only contain the columns product_name and supplier_name | ||
|
|
||
| ```sql | ||
| SELECT p.product_name, s.supplier_name FROM products p INNER JOIN product_availability pa ON p.id = pa.prod_id INNER JOIN suppliers s ON pa.supp_id = s.id WHERE s.country = 'United Kingdom'; |
| - [ ] List all orders, including order items, from customer named Hope Crosby | ||
|
|
||
| ```sql | ||
| SELECT o.*, oi.* FROM orders o INNER JOIN order_items oi ON o.id = oi.order_id INNER JOIN customers c ON o.customer_id = c.id WHERE c.name = 'Hope Crosby'; |
| - [ ] List all the products in the order ORD006. The result should only contain the columns product_name, unit_price, and quantity | ||
|
|
||
| ```sql | ||
| SELECT p.product_name, pa.unit_price, oi.quantity FROM products p INNER JOIN product_availability pa ON p.id = pa.prod_id INNER JOIN order_items oi ON oi.product_id = pa.prod_id INNER JOIN orders o ON o.id = oi.order_id WHERE o.order_reference = 'ORD006'; |
| - [ ] List all the products with their supplier for all orders of all customers. The result should only contain the columns name (from customer), order_reference, order_date, product_name, supplier_name, and quantity | ||
|
|
||
| ```sql | ||
| SELECT c.name, o.order_reference, o.order_date, p.product_name, s.supplier_name, oi.quantity FROM order_items oi INNER JOIN orders o ON oi.order_id = o.id INNER JOIN customers c ON c.id = o.customer_id INNER JOIN product_availability pa ON oi.product_id = pa.prod_id INNER JOIN products p ON p.id = pa.prod_id INNER JOIN suppliers s ON s.id = pa.supp_id; |
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.








Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.