-
Notifications
You must be signed in to change notification settings - Fork 17
Fwrw #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fwrw
wants to merge
10
commits into
fabiomrtins:main
Choose a base branch
from
fwrw:fwrw
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fwrw #7
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2ae0cae
Create 01.sql
fwrw ed4aeba
Create 02.sql
fwrw 447dc44
Create 03.sql
fwrw 7bbfb56
Update 02.sql
fwrw a087e24
Update 01.sql
fwrw 00196dd
Create 04.sql
fwrw 3af1eb3
Create 05.sql
fwrw 21de084
Create 06.sql
fwrw 9d3430a
Create 07.sql
fwrw 5da6f48
Create 08.sql
fwrw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| -- Liste os produtos. (products) | ||
| SELECT | ||
| product_name | ||
| FROM products; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Liste os produtos e o nome de seus fornecedores. (products / suppliers) | ||
| SELECT | ||
| products.product_name as produto, | ||
| suppliers.company_name as fornecedor | ||
| FROM products | ||
| LEFT JOIN suppliers on suppliers.supplier_id = products.supplier_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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- Recupere os pedidos com os nomes dos clientes e dos funcionários responsáveis. (orders / customers / employees) | ||
| SELECT | ||
| orders.order_id, | ||
| customers.contact_name as cliente, | ||
| employees.first_name as funcionario | ||
| FROM orders | ||
| LEFT JOIN customers ON customers.customer_id = orders.customer_id | ||
| LEFT JOIN employees ON employees.employee_id = orders.employee_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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Liste os produtos, suas categorias e o nome dos fornecedores. (products / categories / suppliers) | ||
| SELECT | ||
| products.product_name, categories.category_name, suppliers.company_name | ||
| FROM products | ||
| LEFT JOIN categories on categories.category_id = products.category_id | ||
| LEFT JOIN suppliers ON suppliers.supplier_id = products.supplier_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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- Quantos pedidos cada cliente já fez? (orders / custoers) | ||
| SELECT | ||
| customers.company_name, | ||
| COUNT(orders.order_id) as total_pedido | ||
| FROM customers | ||
| LEFT JOIN orders on orders.customer_id = customers.customer_id | ||
| GROUP BY customers.company_name | ||
| ORDER BY total_pedido DESC |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| -- Valor total vendido por cada funcionário (considerando os pedidos já enviados). (orders / employees) | ||
| SELECT | ||
| employees.first_name, | ||
| SUM(orders.freight) AS total | ||
| FROM employees | ||
| LEFT JOIN orders ON employees.employee_id = orders.employee_id | ||
| WHERE orders.shipped_date IS NOT NULL | ||
|
|
||
| GROUP BY employees.employee_id | ||
| ORDER BY total DESC; | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Média de preços dos produtos por categoria. (products / categories) | ||
| select | ||
| categories.category_name, avg(unit_price) | ||
| from products | ||
| left join categories on products.category_id = categories.category_id | ||
| group by categories.category_name | ||
| order by categories.category_name ASC |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Quais os clientes que nunca fizeram pedidos? (customers / orders) | ||
| select | ||
| customers.contact_name | ||
| from customers | ||
| left join orders on customers.customer_id = orders.customer_id | ||
| where orders.customer_id is null; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orders.freighté o valor do frete a informação dos preços. A tabelaorder_detailscontêm informações de preço do produto vendido, a quantidade e o desconto dado.