Dba Course Project
Dba Course Project
TEAM DETAILS:
1. SANDEEP - 117
2. MANISH - 127
3. HRISHIKESH - 118
4. SUHAS - 128
ER DIAGRAM
SCHEMA DIAGRAM
**SQL QUERIES**
*****QUERIES*****
select name
from customer, Orders
where orders.cst_id = customer.C_id
having count(O_id) >= 1
group by name;
2. What is the total price for all orders that are still
pending?
*****AGGREGATE FUNCTIONS*****
******Complex queries******:
SELECT delivery_note.*
FROM delivery_note
INNER JOIN orders ON delivery_note.order_id =
orders.O_id
WHERE orders.status = 'delivered' OR orders.status =
'out for delivery'
ORDER BY delivery_date ASC;
3)Find the name and email of customers who have
placed orders that are out for delivery,
and order the results by the delivery address in
ascending order:
*****Correlated queries******
SELECT name
FROM customer
WHERE C_id IN (SELECT cst_id
FROM orders
WHERE cst_id = customer.C_id
GROUP BY cst_id
HAVING COUNT(*) >= 1);
*****Nested queries*****
SELECT name
FROM administrator
WHERE A_id NOT IN (SELECT admin_id
FROM orders
WHERE admin_id = administrator.A_id);
SELECT *
FROM orders o
WHERE EXISTS (
SELECT *
FROM complaints c
WHERE c.ord_id = o.O_id);
Table - Customer
Table: administrator
Table : Orders
order custome produc order_d quant unit_pr delivery_no delivery_ad
status
_id r_id t_id ate ity ice te_id dress
2022- pendin
1 1 2 10 100.00 1 123 Main St.
01-01 g
2022- shippe
2 2 3 5 50.00 2 456 Oak St.
01-02 d
2022- deliver
3 3 1 8 80.00 3 789 Elm St.
01-03 ed
out for
2022-
4 4 4 4 90.00 deliver 4 111 Pine St.
01-04
y
2022- shippe
8 8 8 15 150.00 8 555 Birch St.
01-08 d
2022- deliver
9 9 9 4 40.00 9 666 Ash St.
01-09 ed
2022- pendin
10 10 10 7 70.00 10 777 Pine St.
01-10 g
444 Walnut
7 7 2022-01-17 shipped Delivery Person 7 555-6789
St.
Delivery Person
10 10 2022-01-20 delivered 777 Pine St. 555-9012
10
TABLE : DELIVERY_NOTE
TABLE : COMPLAINTS
complai order custom complaint_de complaint_ complaint resolutio resolution_co
nt_id _id er_id scription status _date n_date mment
Product arrived 2022-01-
1 1 2 pending null Null
damaged 03
Wrong product 2022-01- 2022-01- Product
2 2 3 resolved
delivered 04 06 replaced
Product never 2022-01-
3 3 4 pending null Null
arrived 05
Product not as 2022-01- 2022-01-
4 4 5 resolved Refund issued
described 06 09
Shipping took 2022-01- 2022-01- Partial refund
5 5 6 resolved
too long 07 10 issued
Product arrived 2022-01- 2022-01- Product
6 6 7 resolved
damaged 08 11 replaced
Product never 2022-01- 2022-01- Product re-
7 7 8 resolved
arrived 09 12 shipped
Product not as 2022-01-
8 8 9 pending null null
described 10
Shipping took 2022-01- 2022-01- Partial refund
9 9 10 resolved
too long 11 14 issued
Product arrived 2022-01-
10 10 10 pending null null
damaged 12