1. Query to display Employee Name, Job, Hire Date, Employee Number; for each employee with the Employee Number appearing first.
2. Query to display unique Jobs from the Employee Table.
3. Query to display the Employee Name concatenated by a Job separated by a comma.
CREATE TABLE
Create Statements department
( Dno int NOT NULL,
Dname varchar2(50) DEFAULT NULL,
Location varchar2(50) DEFAULT NULL,
PRIMARY KEY (Dno));
CREATE TABLE EMPLOYEE
( Eno CHAR(3) NOT NULL,
Ename varchar2(50) NOT NULL,
JOB_TYPE varchar2(50) NOT NULL,
MANAGER CHAR(3) DEFAULT NULL,
HIRE_DATE DATE NOT NULL,
DNO INT DEFAULT NULL,
COMMISION decimal(10,2) DEFAULT NULL,
SALARY decimal(10,2) NOT NULL,
PRIMARY KEY(ENO),
CONSTRAINT FK_DNO FOREIGN KEY(DNO) REFERENCES DEPARTMENT(DNO),
CONSTRAINT FK_MANAGER FOREIGN KEY(MANAGER) REFERENCES EMPLOYEE(ENO));
Insert Statements
INSERT INTO department VALUES (101,'Accounting','New York');
INSERT INTO department VALUES (201,'Research','Paris');
INSERT INTO department VALUES (301,'Sales','Tokyo');
INSERT INTO department VALUES (401,'Operation','Beijing');
INSERT INTO department VALUES (501,'Marketing','New Delhi');
INSERT INTO employee VALUES ('E33', 'Amit', 'Salesman', '', '02-FEB-1990', 301, 3000.00, 32000.00);
INSERT INTO employee VALUES ('E58', 'Arjun', 'Salesman', '', '21-MAR-1991', 301, 5000.00, 30000.00);
INSERT INTO employee VALUES ('E56', 'Devendra', 'Manager', '', '02-JAN-1990', 201, '', 230000.00);
INSERT INTO employee VALUES ('E65', 'Umesh', 'Salesman', '', '04-JUN-1980', 301, 14000.00, 52500.00);
INSERT INTO employee VALUES ('E69', 'Rupesh', 'Manager', '', '05-NOV-1981', 301, '', 287000.00);
INSERT INTO employee VALUES ('E76', 'Manish', 'Manager', '', '09-MAY-1981', 101, '', 290000.00);
INSERT INTO employee VALUES ('E83', 'Kunal', 'President', NULL, '11-OCT-1985', 101, '', 395000.00);
INSERT INTO employee VALUES ('E84', 'Tushar', 'Salesman', '', '09-JAN-2014', 301, '', 14500.00);
INSERT INTO employee VALUES ('E87', 'Arpit',' Clerk', '', '01-JAN-2015', 201, '', 11500.00);
INSERT INTO employee VALUES ('E88', 'Sameer', 'Analyst', '', '12-JULY-2005', 201, '', 28500.00);
INSERT INTO employee VALUES ('E90', 'Jatin', 'Clerk', '', '12-DEC-2010', 301, '', 19550.00);
INSERT INTO employee VALUES ('E92', 'Farhan', 'Analyst', '', '12-APR-1981', 201, '', 260000.00);
INSERT INTO employee VALUES ('E93', 'Milind', 'Clerk', '', '25-JAN-1982', 401, '', 43000.00);
INSERT INTO employee VALUES ('E78', 'Karanveer', 'Salesman', '', '25-JAN-1999', 301, '', 15000.00);
UPDATE employee SET Manager= 'E69' where eno = 'E33';
UPDATE employee SET Manager= 'E69' where eno = 'E58';
UPDATE employee SET Manager= 'E83' where eno = 'E56';
UPDATE employee SET Manager= 'E84' where eno = 'E65';
UPDATE employee SET Manager= 'E83' where eno = 'E69';
UPDATE employee SET Manager= 'E83' where eno = 'E76';
UPDATE employee SET Manager= 'E69' where eno = 'E84';
UPDATE employee SET Manager= 'E76' where eno = 'E87';
UPDATE employee SET Manager= 'E56' where eno = 'E88';
UPDATE employee SET Manager= 'E69' where eno = 'E90';
UPDATE employee SET Manager= 'E56' where eno = 'E92';
UPDATE employee SET Manager= 'E88' where eno = 'E93';
UPDATE employee SET Manager= 'E83’ where eno = ‘E78’;