//first there is creation of database then we will execute queries by using mysql
//This is department Relation
CREATE TABLE department(Dno int(11) NOT NULL, Dname varchar(50) DEFAULT NULL, Location varchar(50) DEFAULT NULL, PRIMARY KEY (Dno))
INSERT INTO department VALUES(10,'Accounting','New York'),(20,'Research','Dallas'),(30,'Sales','Chicago'),(40,'Operation','Boston'),(50,'Marketing','New Delhi');
//This is Employee Relation
CREATE TABLE employee ( Eno char(3) NOT NULL, Ename varchar(50) NOT NULL, Job_type varchar(50) NOT NULL, Manager char(3) DEFAULT NULL, Hire_date date NOT NULL, Dno int(11) DEFAULT NULL, Salary decimal(7,2) NOT NULL, PRIMARY KEY (Eno), CONSTRAINT Dno FOREIGN KEY (Dno) REFERENCES department (Dno), CONSTRAINT Manager FOREIGN KEY (Manager) REFERENCES employee (Eno))
INSERT INTO employee VALUES ('736','Smith','Clerk','790','1981-12-17',20,0.00,1000.00),('749','Allan','Sales_man','769',','981-02-20',30,300.00,2000.00),('752','Ward','Sales_man','769','1981-02-22',30,500.00,1300.00),('756','Jones','Manager','783','1981-04-02',20,0.00,2300.00),('765','Martin','Sales_man','784','1981-04-22',30,1400.00,1250.00),('769','Blake','Manager','783','1981-05-01',30,0.00,2870.00),('778','Clark','Manager','783','1981-06-09',10,0.00,2900.00),('783','King','President',NULL,'1981-11-17',10,0.00,2950.00),('784','Turner','Sales_man','769','1981-09-08',30,0.00,1450.00),('787','Adams','Clerk','778','1983-01-12',20,0.00,1150.00),('788','Scott','Analyst','756','1982-12-09',20,0.00,2850.00)('790','James','Clerk','769','1981-12-03',30,0.00,950.00),
('792','Ford','Analyst','756','1981-12-03',20,0.00,2600.00),('793','Miller','Clerk','788','1982-01-23',40,0.00,1300.00);
Commission decimal(10,2) DEFAULT NULL,
No comments:
Post a Comment