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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
21 changes: 21 additions & 0 deletions week-1/mandatory/2-classes-db/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,28 @@ Below you will find a set of tasks for you to complete to consolidate and extend
To submit this homework write the correct commands for each question here:

```sql
1- select * from rooms where rate > 100;

2- select * from reservations where checkin_date BETWEEN '2020-08-01' and '2020-09-01' and checkin_date + 3 < checkout_date;

3- select * from customers where city like 'M%';

4- insert into room_types (room_type , def_rate) values ('PENTHOUSE', '185.00');

5- insert into rooms (room_no, rate, room_type) values ('501' ,'185.00', 'PENTHOUSE'), ('502' ,'185.00', 'PENTHOUSE');

6- insert into rooms (room_no, rate, room_type) values ('503' ,'143.00', 'PREMIER PLUS');

7- SELECT count(distinct room_no) FROM reservations WHERE checkin_date >= date_trunc('month', current_date - interval '1' month) and checkout_date < date_trunc('month', current_date); ===> or SELECT count(room_no) FROM reservations WHERE checkin_date >= date_trunc('month', current_date - interval '1' month);

8- select sum(checkout_date - checkin_date) from reservations where room_no between '201' and '299';

9- select count(total) from invoices where total > 300; =>> number of invoices,,,,,, select AVG(total) from invoices where total > 300; ===> average ,,,,,, select sum(total) from invoices where total > 300; ==> total

10- Floor1 ==> select sum(checkout_date - checkin_date) from reservations where room_no between '101' and '199';
Floor2 ==> select sum(checkout_date - checkin_date) from reservations where room_no between '201' and '299';
Floor3 ==> select sum(checkout_date - checkin_date) from reservations where room_no between '301' and '399';
Floor4 ==> select sum(checkout_date - checkin_date) from reservations where room_no between '401' and '499';

```

Expand Down
26 changes: 26 additions & 0 deletions week-2/mandatory/2-ecommerce-db/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,33 @@ 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 name, address,country 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 pro.id, pro.product_name , pro_ava.unit_price , pro_ava.supp_id from products pro join product_availability pro_ava on (pro_ava.prod_id = pro.id) where pro_ava.unit_price > 100;

5- select pro.product_name, available.prod_id, available.supp_id, available.unit_price from product_availability available join products pro on (available.prod_id = pro.id) order by unit_price desc limit 5;

6- select pro.product_name , pro_avai.unit_price, supp.supplier_name from products pro join product_availability pro_avai on (pro_avai.prod_id = pro.id) join suppliers supp on (pro_avai.supp_id = supp.id);

7- select pro.product_name , supp.supplier_name from products pro join product_availability pro_avai on(pro_avai.prod_id = pro.id) join suppliers supp on(pro_avai.supp_id = supp.id) where supp.country = 'United Kingdom';

8- select ord.id, ord.order_reference, ord.order_date, ord_i.quantity * pro_avai.unit_price as total_cost, ord.customer_id from orders ord join order_items ord_i on (ord_i.order_id = ord.id) join product_availability pro_avai on (pro_avai.prod_id = ord_i.product_id) where ord.customer_id = '1';

9- select ord.* ,ord_i.*, c.name from orders ord join order_items ord_i on (ord_i.order_id = ord.id) inner join customers c on (ord.customer_id = c.id) where c.name = 'Hope Crosby';

10- select pro.product_name , pro_avai.unit_price , ord_i.quantity from products pro join product_availability pro_avai on (pro_avai.prod_id = pro.id) join order_items ord_i on (pro.id = ord_i.product_id) join orders ord on (ord_i.order_id = ord.id) where ord.order_reference = 'ORD006';

11- select c.name, ord.order_reference , ord.order_date, pro.product_name, supp.supplier_name , ord_i.quantity from customers c join orders ord on ( ord.customer_id
= c.id) join order_items ord_i on (ord_i.order_id = ord.id) join suppliers supp on (ord_i.supplier_id = supp.id) join products pro on (ord_i.product_id = pro.id);

12- select c.name from customers c join orders ord on (ord.customer_id = c.id) join order_items ord_i on (ord_i.order_id = ord.id) join suppliers supp on (ord_i.supplier_id = supp.id) where supp.country = 'China';

13- select c.name , ord.order_reference , ord.order_date, ord_i.quantity * pro_avai.unit_price as total_amount from customers c join orders ord on (ord.customer_id
=c.id) join order_items ord_i on (ord_i.order_id = ord.id) join product_availability pro_avai on (pro_avai.prod_id = ord_i.product_id) order by total_amount desc;

```

Expand Down
1 change: 1 addition & 0 deletions week-2/mandatory/3-api/cyf-ecommerce-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Loading