omis-652 database development project
TRANSCRIPT
![Page 1: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/1.jpg)
NORTHERN ILLINOIS
UNIVERSITY
OMIS 652
Business Applications of Database Management System
3rd Deliverable - Database Diagram & Queries
Submitted by,
Akarsh Vinod Ghanathay (Z1804713)
Nikhilesh Methuku (Z1807570)
Shaik Nisar Ahmed (Z1780816)
Syed Mahmood Hasan (Z1774742)
![Page 2: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/2.jpg)
The Database Diagram
![Page 3: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/3.jpg)
Intern Table
Catalog table
![Page 4: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/4.jpg)
Customer table
Employee table
![Page 5: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/5.jpg)
Inventory requirement order table
Inventory details table
![Page 6: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/6.jpg)
Logistic partner table
Order table
![Page 7: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/7.jpg)
Payment table
Product table
![Page 8: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/8.jpg)
Raw material table
Shipping table
![Page 9: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/9.jpg)
Supplier table
Workshop table
![Page 10: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/10.jpg)
1. Write a query to find the employeeid and customerid whose name matches with customer’sfirst
name?
select e.empid,c.cusid,e.name from final_employee e join final_order o on e.orderID = o.orderID join final_customer c on o.cusID = c.cusID and e.name=c.fname
![Page 11: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/11.jpg)
2. Write a query to display customer id, first name and last name of all the customers who were involved
in more than one purchase.
select cusID, fname, lname from final_customer where cusID in (select cusID from final_order group by cusID having count (cusID)>1)
![Page 12: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/12.jpg)
3. Write a query to display the total sum of sales for each product type
select p.productType, sum(o.price) from final_product p join final_order o on p.productID = o.productID group by p.productType
![Page 13: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/13.jpg)
4. Write a query to find the list of customers with their id, firstname, lastname who have purchased shoes
that are made of ‘leather’.
select cusID, fname, lname from final_customer where cusID in (select cusID from final_order where orderID in ( select orderID from final_product where material like 'leather'))
![Page 14: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/14.jpg)
5. Write a query to display name of the logistic partner who delivered the synthetic products.
select name from final_logistics where logisticID in ( select logisticID from final_shipping where orderID in ( select orderID from final_order where productID in ( select productID from final_product where material='synthetic')))
![Page 15: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/15.jpg)
6. Display the name of employees who were involved in manufacturing orders in workshop type
‘backpack’.
Select name From final_employee Where empID in ( Select empID From final_workshop Where workshoptype = 'backpack')
![Page 16: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/16.jpg)
7. List the name of the material which is supplied from California.
select name from final_rawmaterial where materialID in ( select materialID from final_intventoryrequireorder where requirementorderID in ( select requirementorderID from final_supplier where location = 'california'))
![Page 17: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/17.jpg)
8. List the highest quote for leather.
select s.requirementorderID, MAX(quote) from final_supplier s join final_intventoryrequireorder i on s.requirementorderID=i.requirementorderID join final_rawmaterial f on i.materialID = f.materialID and f.name = 'leather' group by s.requirementorderID
![Page 18: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/18.jpg)
9. Find the name of the raw material which was procured by the supplier id ‘401’.
select name from final_rawmaterial where materialID in ( select materialID from final_intventoryrequireorder where requirementorderID in ( select requirementorderID from final_supplier where supplierID = 401))
![Page 19: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/19.jpg)
10. Find the status of the order by the employee name ‘Show’.
select status from final_shipping where orderID in (select orderID from final_employee where orderID in (select orderID from final_employee where name = 'show'))
![Page 20: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/20.jpg)
11. Write a query to display the logistic partner who delivered the digital leather watch.
select name from final_logistics where logisticID in ( select logisticID from final_shipping where orderID in ( select orderID from final_order where productID in ( select productID from final_product where material='leather' and [desc]='digital')))
![Page 21: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/21.jpg)
12. Write a query to display the employee who processed the orders that were delivered by DHL.
select empID, e.name, l.name from final_employee e, final_order o, final_shipping s, final_logistics l where e.orderID = o.orderID and o.orderID = s.orderID and s.logisticID = l.logisticID and l.name = 'DHL'
![Page 22: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/22.jpg)
13. Display the list of intern that worked on watches
select i.name from final_intern i, final_workshop w, final_employee e, final_order o, final_product p where i.orderID = w.orderID and w.orderID = e.orderID and e.orderID = o.orderID and o.productID = p.productID and productType = 'watch'
![Page 23: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/23.jpg)
14. List the Number of transactions with watches.
select productType, count(transactionID) as NumberofTransactions from final_payment p, final_order o, final_product pr where p.orderID = o.orderID and o.productID = pr.productID and productType = 'watch' group by productType
![Page 24: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/24.jpg)
15. List the Number of orders delivered by DHL.
select i.name as interName, e.name employeeName, e.empID from final_intern i, final_employee e, final_workshop w where i.workshopID = w.workshopID and e.empID = w.empID and i.name = e.name
![Page 25: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/25.jpg)
16. List the name of the inventory where synthetic materials are stored.
select name from final_inventory_details where inventoryID in ( select inventoryID from final_rawmaterial where name = 'synthetic')
![Page 26: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/26.jpg)
17. List the name of the products whose inventory was are stored in north.
select name, [desc],productID from final_product where materialID in ( select materialID from final_rawmaterial where inventoryID in ( select inventoryID from final_inventory_details where name = 'north'))
![Page 27: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/27.jpg)
18. List the name of the supplierID who supplies leather.
select supplierid from final_supplier where requirementorderID in ( select requirementorderID from final_intventoryrequireorder where materialID in ( select materialID from final_rawmaterial where name = 'leather'))
![Page 28: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/28.jpg)
19. Write a query to display the customer id who bought leather bags.
select cusid from final_customer where cusID in ( select cusID from final_order where productID in ( select productID from final_product where productType = 'bag' and material = 'leather'))
![Page 29: OMIS-652 Database Development Project](https://reader034.vdocument.in/reader034/viewer/2022052302/58ef8c5d1a28ab8d208b45d3/html5/thumbnails/29.jpg)
20. Display the transaction id that dealt with customer first name sam.
select transactionid from final_payment where cusID in ( select cusID from final_customer where fname = 'sam')