Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added week-2/.DS_Store
Binary file not shown.
Binary file added week-2/mandatory/.DS_Store
Binary file not shown.
64 changes: 64 additions & 0 deletions week-2/mandatory/2-ecommerce-db/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,70 @@ Below you will find a set of tasks for you to complete to set up a database for

To submit this homework write the correct commands for each question here:
```sql
1- select * from customers where country = 'United States';

2- select * from customers order by name asc;

3- select * from products where product_name like '%socks%';

4- select p.id, p.product_name, pa.supp_id, pa.unit_price
from products p
join product_availability pa on pa.prod_id = p.id
where pa.unit_price >= 100;

5- select p.id, p.product_name, pa.supp_id, pa.unit_price
from products p
join product_availability pa on pa.prod_id = p.id
order by pa.unit_price
desc limit 5;

6- select p.product_name, pa.unit_price, s.supplier_name
from products p
join product_availability pa on p.id= pa.prod_id
join suppliers s on pa.supp_id = s.id;

7-select p.product_name, s.supplier_name from products p
join product_availability pa on p.id = pa.prod_id
join suppliers s on s.id = pa.supp_id
where s.country = 'United Kingdom';

8- select o.id, o.order_reference, o.order_date,
item.quantity * pa.unit_price as "total cost" from orders o
join customers c on o.customer_id = c.id
join order_items item on o.id = item.order_id
join product_availability pa on item.product_id = pa.prod_id
where c.id = 1;

9- select o.customer_id, o.id, o.order_reference, o.order_date,
item.product_id, item.supplier_id, item.quantity from orders o
join order_items item on o.id = item.order_id
join customers c on o.customer_id = c.id
where c.name = 'Hope Crosby';

10- select p.product_name, oi.quantity, pa.unit_price from products p
join product_availability pa on pa.prod_id = p.id
join order_items oi on oi.product_id = pa.prod_id
join orders o on o.id = oi.order_id
where o.order_reference = 'ORD006';

11- select c.name, o.order_reference, o.order_date, p.product_name,
s.supplier_name, oi.quantity from customers c
join orders o on o.customer_id = c.id
join order_items oi on oi.order_id = o.id
join products p on p.id = oi.product_id
join suppliers s on s.id = oi.supplier_id;

12- select c.name, s.country from customers c
join orders o on o.customer_id = c.id
join order_items oi on oi.order_id = o.id
join suppliers s on s.id = oi.supplier_id
where s.country = 'China';

13- select c.name, o.order_reference, o.order_date, sum(i.quantity * a.unit_price) as total from customers c
join orders o on (o.customer_id = c.id)
join order_items i on (i.order_id = o.id)
join product_availability a on (i.supplier_id = a.supp_id and i.product_id = a.prod_id)
group by c.name, o.order_reference, o.order_date order by total desc;


```
Expand Down
Binary file added week-3/mandatory/.DS_Store
Binary file not shown.
Binary file added week-3/mandatory/2-api/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions week-3/mandatory/2-api/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions week-3/mandatory/2-api/node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

236 changes: 236 additions & 0 deletions week-3/mandatory/2-api/node_modules/accepts/HISTORY.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions week-3/mandatory/2-api/node_modules/accepts/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading