The document contains the SQL code to create multiple tables to store data for a sales and customer relationship management system. The tables created include Salespeople, Customers, Orders, Customer_table, Vendors_table, Employees_table, Sparepart_table, Purchase_table, and SET_DET_table. Data is then inserted into each of the tables.
The document contains the SQL code to create multiple tables to store data for a sales and customer relationship management system. The tables created include Salespeople, Customers, Orders, Customer_table, Vendors_table, Employees_table, Sparepart_table, Purchase_table, and SET_DET_table. Data is then inserted into each of the tables.
The document contains the SQL code to create multiple tables to store data for a sales and customer relationship management system. The tables created include Salespeople, Customers, Orders, Customer_table, Vendors_table, Employees_table, Sparepart_table, Purchase_table, and SET_DET_table. Data is then inserted into each of the tables.
The document contains the SQL code to create multiple tables to store data for a sales and customer relationship management system. The tables created include Salespeople, Customers, Orders, Customer_table, Vendors_table, Employees_table, Sparepart_table, Purchase_table, and SET_DET_table. Data is then inserted into each of the tables.
Download as TXT, PDF, TXT or read online from Scribd
Download as txt, pdf, or txt
You are on page 1of 5
CREATE TABLE Salespeople
( Snum int PRIMARY KEY, Sname varchar(100) NOT NULL, City varchar(100), Comm double(1,2) )
INSERT INTO Salespeople Values(1001,'Peel','London',0.12);
INSERT INTO Salespeople Values(1002,'Serres','San Jose',0.13); INSERT INTO Salespeople Values(1004,'Monika','London',0.11); INSERT INTO Salespeople Values(1007,'Rifkin','Barcelona',0.15); INSERT INTO Salespeople Values(1003,'Axelrod','New York',0.10); INSERT INTO Salespeople Values(1005,'Franc','London',0.26);
CREATE TABLE Customers 1
( Cnum int PRIMARY KEY, cname varchar(100) NOT NULL, City varchar(100), Rating int, Snum int FOREIGN KEY ) INSERT INTO Customers Values(2001,'Hoffman','London',100,1001); INSERT INTO Customers Values(2002,'Giovanni','Rome',200,1003); INSERT INTO Customers Values(2003,'Liu','San Jose',200,1002); INSERT INTO Customers Values(2004,'Grass','Berlin',300,1002); INSERT INTO Customers Values(2006,'Clemens','London',100,1001); INSERT INTO Customers Values(2008,'Cisneros','San Jose',300,1007); INSERT INTO Customers Values(2007,'Pereira','Rome',100,1004);
CREATE TABLE Orders
( Onum int PRIMARY KEY, Amt decimal(5,2), Odate VARCHAR(100), cname int FOREIGN KEY, Snum int FOREIGN KEY )
INSERT INTO Orders Values(3001,18.69,'1996-10-03 12:30:00',2008,1007)
INSERT INTO Orders Values(3003,767.19,'1996-10-03 13:45:00',2001,1001) INSERT INTO Orders Values(3002,1900.10,'1996-10-03 12:05:00',2007,1004) INSERT INTO Orders Values(3005,5160.45,'1996-10-03 14:00:00',2003,1002) INSERT INTO Orders Values(3006,1098.16,'1996-10-03 13:37:00',2008,1007) INSERT INTO Orders Values(3009,1713.23,'1996-10-04 15:21:00',2002,1003) INSERT INTO Orders Values(3007,75.75,'1996-10-04 16:02:00',2002,1003) INSERT INTO Orders Values(3008,4723.00,'1996-10-05 12:07:00',2006,1001) INSERT INTO Orders Values(3010,1309.95,'1996-10-06 13:12:00',2004,1002) INSERT INTO Orders Values(3011,9891.88,'1996-10-06 13:09:00',2006,1001) INSERT INTO Orders Values(3012,3455.78,'1996-10-04 15:21:00',2002,1003) INSERT INTO Orders Values(3013,1245.98,'1996-10-04 16:32:00',2002,1003) INSERT INTO Orders Values(3014,3721.53,'1996-10-05 12:45:00',2006,1001) INSERT INTO Orders Values(3015,734.50,'1996-10-06 13:16:00',2004,1002) INSERT INTO Orders Values(3016,1729.67,'1996-10-06 13:07:00',2006,1001) INSERT INTO Orders Values(3001,18.69,'03-OCT-96 12:30',2008,1007) INSERT INTO Orders Values(3003,767.19,'03-OCT-96 13:45',2001,1001) INSERT INTO Orders Values(3002,1900.10,'03-OCT-96 12:05',2007,1004) INSERT INTO Orders Values(3005,5160.45,'03-OCT-96 14:00',2003,1002) INSERT INTO Orders Values(3006,1098.16,'03-OCT-96 13:37',2008,1007) INSERT INTO Orders Values(3009,1713.23,'04-OCT-96 15:21',2002,1003) INSERT INTO Orders Values(3007,75.75,'04-OCT-96 16:02',2002,1003) INSERT INTO Orders Values(3008,4723.00,'05-OCT-96 12:07',2006,1001) INSERT INTO Orders Values(3010,1309.95,'06-OCT-96 13:12',2004,1002) INSERT INTO Orders Values(3011,9891.88,'06-OCT-96 13:09',2006,1001) INSERT INTO Orders Values(3012,3455.78,'04-OCT-96 15:21',2002,1003) INSERT INTO Orders Values(3013,1245.98,'04-OCT-96 16:32',2002,1003) INSERT INTO Orders Values(3014,3721.53,'05-OCT-96 12:45',2006,1001) INSERT INTO Orders Values(3015,734.50,'06-OCT-96 13:16',2004,1002) INSERT INTO Orders Values(3016,1729.67,'06-OCT-96 13:07',2006,1001)
CREATE TABLE Customer_table
( CID int PRIMARY KEY, CNAME varchar(100), CADD varchar(100), C_CONTACT int, C_CREDITDAYS int, CJ_DATE date, SEX varchar(100) )
INSERT INTO Customer_table Values(1001,'Cyona blake','NEW YORK',1235684,20,'20-JAN-
11','FEMALE'); INSERT INTO Customer_table Values(1002,'JOHN SMITH','NEW JERSI',1341684,20,'11-FRB- 11','MALE'); INSERT INTO Customer_table Values(1003,'JORDAN WOOD','PRAG',1805184,20,'22-MAR- 11','MALE'); INSERT INTO Customer_table Values(1004,'CHRISTNA','MANHATTON',1125684,31,'23-APR- 13','FEMALE'); INSERT INTO Customer_table Values(1005,'TOM HILL','LONDON;,1239284,10,'25-JUN- 15','MALE'); INSERT INTO Customer_table Values(1006,'KAMILA JOSEF','PARISE',124568,9,'28-JUL- 11','FEMALE'); INSERT INTO Customer_table Values(1007,'ANDRU SYMON','TAXES',125654,15,'01-APR- 16','MALE'); INSERT INTO Customer_table Values(1008,'SANJU SAMSUNG','NEW YORK',12346341,4,'20- JAN-16','MALE');
CREATE TABLE Vendors_table
( VID int PRIMARY KEY, VNAME varchar(100), VADD varchar(100), V_CONTACT int, V_CREDITDAYS int, VJ_DATE date )
INSERT INTO Vendors_table Values(2001,'KIRAN PATIL','PUNE',20535535,20,'20-JAN-
10'); INSERT INTO Vendors_table Values(2002,'PRAKASH JAIN','MUMBAI',2063564,10,'05-NOV- 11'); INSERT INTO Vendors_table Values(2003,'SWAPNIL THETE','NASHIK',25355352,15,'18-MAR- 10'); INSERT INTO Vendors_table Values(2004,'AMOL SHINDE','SATARA',23674776,18,'07-APR- 15'); INSERT INTO Vendors_table Values(2005,'KIRAN SINTRE','BULDHANA',256756,30,'22-ARP- 09'); INSERT INTO Vendors_table Values(2006,'RAM KULKARNI','OSMANABAD',20367454,21,'09- JUL-10');
CREATE TABLE Employees_table
( EID int PRIMARY KEY, ENAME varchar(100), EJOB varchar(100), EADD varchar(100), E_CONTACT int, ESAL int, EDOJ date, EDOL date );
INSERT INTO Employees_table Values(3001,'STEVEN KING','PAINTER','NEW
YOKE',10367454,1200,'09-JUL-10',) INSERT INTO Employees_table Values(3002,'DAVID AUSTIN','FITTER','MAN HATON',10367434,1100,'19-AUG-10',) INSERT INTO Employees_table Values(3003,'BRUCE ERNST', 'MECHANIC','NEW JERCY',10367264,2200,'08-SEP-10',) INSERT INTO Employees_table Values(3004,'LUIS POPP','MECHANIC','NEW JERCY',10367264,1700,'19-OCT-10','06-SEP-10') INSERT INTO Employees_table Values(3005,'SHERI GOMES','FITTER','PARIS',10327264,1000,'19-OCT-10','01-AUG-10') INSERT INTO Employees_table Values(3000,'JAMES PHILLIP','FITTER','PARIS',10322264, ,'01-JAN-08',)
INSERT INTO Sparepart_table Values(4001,'TWO WHEELER TUBE',250,'NOS');
INSERT INTO Sparepart_table Values(4002,'TWO WHEELER ENGINE OIL',400,'LTRS'); INSERT INTO Sparepart_table Values(4003,'FOUR WHEELER ENGINE OIL',5000,'LTRS'); INSERT INTO Sparepart_table Values(4004,'TWO WHEELER CARBORATOR',680,'NOS'); INSERT INTO Sparepart_table Values(4005,'TWO WHEELER CLUTCH WIRE',129,'MTRS'); INSERT INTO Sparepart_table Values(4006,'TWO WHEELER TAIL LIGHT',100,'NOS'); INSERT INTO Sparepart_table Values(4007,'TWO WHEELER INDICATOR',150,'NOS'); INSERT INTO Sparepart_table Values(4008,'FOUR WHEELER GASKIT',1340,'NOS'); INSERT INTO Sparepart_table Values(4009,'WHITE COLOUR',340,'LTRS'); INSERT INTO Sparepart_table Values(4010,'BLACK COLOUR',240,'LTRS'); INSERT INTO Sparepart_table Values(4011,'TWO WHEELER SIDE MIRROR',250,'NOS'); INSERT INTO Sparepart_table Values(4012,'FOUR WHEELER SIDE MIRRIOR',450,'NOS'); INSERT INTO Sparepart_table Values(4013,'TWO WHEELER SHOCKUP',1320,'PAIR'); INSERT INTO Sparepart_table Values(4014,'FOUR WHEELER BUMPER',6000,'NOS'); INSERT INTO Sparepart_table Values(4015,'FOUR WHEELER FRONT GLASS',7000,'PCS');
CREATE TABLE Purchase_table
( PID int PRIMARY KEY, VID int FOREEIGN KAY, SPID int FOREEIGN KAY, PQTY int, SPRATE int, SPGST decimal(,2), PADTE date, TRANSCOST int, TOTAL decimal(,2), RCV_EID int FOREEIGN KAY );
INSERT INTO Purchase_table Values(5001,2001,4001,10,250,350,'01-JAN-
11',1300,4150,3001); INSERT INTO Purchase_table Values(5002,2002,4002,4,400,288,'02-MAR- 11',100,1988,3001); INSERT INTO Purchase_table Values(5003,2003,4004,8,680,761.6,'12-JUN- 11',50,6251.6,3003); INSERT INTO Purchase_table Values(5004,2004,4005,10,129,154.8,'22-AUG- 11',125,1569.8,3004); INSERT INTO Purchase_table Values(5005,2005,4006,20,100,300,'07-SEP- 11',20,2320,3003); INSERT INTO Purchase_table Values(5006,2006,4007,30,150,630,'12-OCT- 10',60,5190,3000); INSERT INTO Purchase_table Values(5007,2001,4003,20,5000,14000,'07-SEP- 11',1000,115000,3000); INSERT INTO Purchase_table Values(5008,2006,4005,1,129,15.48,'12-OCT- 11',50,194.48,3005); INSERT INTO Purchase_table Values(5009,2006,4005,1,129,15.48,'15-OCT- 11',50,194.48,3005); INSERT INTO Purchase_table Values(5010,2006,4009,5,340,238,'20-OCT- 11',0,2938,3005);
CREATE TABLE SET_DET_table
( SID int PRIMARY KEY, CID int FOREEIGN KAY, EID int FOREEIGN KAY, SPID int FOREEIGN KAY, TYP_VEH varchar(100), VEH_NO varchar(100), TYP_SER varchar(100), SER_DATE date, QTY int, SP_RATE int, SP_AMT int, SP_G int, SER_AMT int, COMM int, TOTAL int );
INSERT INTO SET_DET_table Values(6001,1001,3001,4001,'TWO
WHEELER','MH15CA3228','TUBE DAMAGED','02-JAN-11',1,250,250,35,50,0,335); INSERT INTO SET_DET_table Values(6002,1002,3002,4002,'TWO WHEELER','MH- 16U5713','FULL SERVICING','04-MAR-11',1,400,400,52,300,50,752); INSERT INTO SET_DET_table Values(6003,1003,3004,4005,'TWO WHEELER','MH12PQ1313','CLUCH WIRE','22-SEP-11',1,129,129,0,10,0,139); INSERT INTO SET_DET_table Values(6004,1002,3002,4002,'TWO WHEELER','MH- 16U5713','FULL SERVICING','05-MAY-11',1,400,400,52,300,50,752); INSERT INTO SET_DET_table Values(6005,1004,3001,4009,'TWO WHEELER','MH- 14PA335','COLOR','21-OCT-11',2.5,340,850,119,500,150,1469); INSERT INTO SET_DET_table Values(6006,1006,3001,4009,'TWO WHEELER','MH- 12WE334','COLOR','01-NOV-11',2.5,340,850,119,500,150,1469); INSERT INTO SET_DET_table Values(6007,1007,3001,4001,'FOUR WHEELER','MH17BB1345','TUBE DAMAGED','01-JAN-11',1,250,250,35,150,0,435);