1 |P a g e TABLE OF CONTENT Page 1.Identification of Entities and Primary and Foreign Keys2 2.Entity Relationship Diagrams3 3.Codes4 •Products •Sets •Customer •Orders •Payment •Salesman •order_sets •salesman_sets •products_sets 4.Queries13
2 |P a g e Identification of Entities and Primary Keys and Foreign Keys EntityAttributesPrimary KeyForeign KeyRationale for PK ProductsproductName productId productDescription productDescription productIdproductId can be used to identify the product SetssetName setId setNoOfProducts setType setIdsetId is a unique identifier for products. CustomercustomerName customerId customerAddress customerTelephone customerIdcustomerId can be used to identify the customer ordersorderDate orderId orderDescription customerId orderIdcustomerIdorderId is used to identify orders. paymentpaymentId paymentMethod paymentDate paymentAmount paymentIdPaymentId is used to identify payments of different customers uniquely salesmansalesmanName salesmanId salesmanTelephone salesmanCommision salesmanSalary salesmanIdsalesmanId can be used to identify each salesman. order_setsidOrdering idSet (idOrdering,idSet)orderId setId idOrdering is used to identify the order. setId is used to identify the products. salesman_setsidsalesman idSet (idsalesman,idSet)salesmanId setId idSalesman is used to identify the salesman. idSet isuse to identify the the
3 |P a g e products. products_setsidProducts(idProducts ,idSet)productsIdidProduct is idSetsetIdused to identify the product. setId is used to identify the products. Entity Relationship Diagrams Logical ER Diagram
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
4 |P a g e Codes Products CREATE TABLE Products( productName varchar(10), productId int(5) PRIMARY KEY, productDescription varchar(20), productDescription double ); INSERTINTOproductsVALUES('Skincaresets',4508,'SkinUseOnly',1200); INSERTINTOproductsVALUES('Make-upsets',4506,'MakeUpSet',1600); INSERTINTOproductsVALUES('Fragrancesets',4510,'BodyUseOnly',800); INSERTINTOproductsVALUES('Haircaresetss',4500,'HairUseOnly',1000);
5 |P a g e Sets CREATE TABLESets( setNamevarchar(10), setIdint(5)PRIMARYKEY, setNoOfProductsint(5), setTypevarchar(18) ); INSERT INTOsetsVALUES('CH911',911,215,'Health Care'); INSERT INTOsetsVALUES('FS930',930,715,'fragrance sets'); INSERT INTOsetsVALUES('SS211',211,120,'Skin care sets'); INSERT INTOsetsVALUES('MU101',101,350,'make-up sets');
6 |P a g e Customer CREATE TABLECustomer( customerNamevarchar(10), customerIdint(5)PRIMARY KEY, customerAddressvarchar(25), customerTelephoneint(10) ); INSERT INTO customer VALUES('John',001,'Lancaster',0773142598); INSERT INTO customer VALUES('Ann',002,'cantwebury',0773114354); INSERT INTO customer VALUES('Steeve',003,'scotland',0773142597); INSERT INTO customer VALUES('Richard',004,'lord provosts',0774142598); INSERT INTO customer VALUES('John',005,'lord mayors',0773152598);
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
7 |P a g e Orders CREATE TABLEorders( orderDatevarchar(10), orderIdint(5), orderDescriptionvarchar(25), customerIdint(5), CONSTRAINTpk_orderPRIMARY KEY(orderId), CONSTRAINTfk_orderFOREIGN KEY(customerName) REFERENCES customer(customerId) ); INSERT INTO ordering VALUES(21062018,100801,'Delivered',004); INSERT INTO ordering VALUES(18072017,100832,'Not-Delivered',002); INSERT INTO ordering VALUES(12092018,100861,'Delivered',003); INSERT INTO ordering VALUES(09052018,100893,'Not-Delivered',005); INSERT INTO ordering VALUES(01062018,100850,'Delivered',001);
8 |P a g e CREATE TABLEpayment( Payment paymentIdint(5)PRIMARY KEY, paymentMethodvarchar(10), paymentDatedate, paymentAmountdouble ); INSERT INTOpaymentVALUES(100801,'Paypal',21062018,4800); INSERT INTOpaymentVALUES(100832,'Paypal',18072017,5200); INSERT INTOpaymentVALUES(100861,'Paypal',12092018,4200); INSERT INTOpaymentVALUES(100893,'Paypal',09052018,1800); INSERT INTOpaymentVALUES(100850,'Paypal',01062018,2500);
9 |P a g e CREATE TABLEsalesman( Salesman salesmanNamevarchar(10), salesmanIdint(5)PRIMARY KEY, salesmanTelephoneint(10), salesmanCommisionint(6), salesmanSalaryint(6) ); INSERT INTO salesman VALUES('Christopher',101,0766844584,12000,48000); INSERT INTOsalesmanVALUES('Jack',102,0772552988,16000,56000); INSERT INTOsalesmanVALUES('Drew',103,0721731998,17500,42000); INSERT INTOsalesmanVALUES('Mike',104,0774180598,11500,45000); INSERT INTOsalesmanVALUES('Shana',105,0773155098,10000,50000);
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
13 |P a g e Queries SELECT SUM(paymentAmount)*2/100 FROM payment SELECT DISTINCTorderid,orderDate FROM ordering; SELECT MAX(salesmanSalary) FROM salesman
14 |P a g e SELECT MIN(salesmanSalary) FROM salesman