Assignment12 2
Assignment12 2
INSERT ALL
INTO DEPARTMENT VALUES (1, 'IT', '1111111111', TO_DATE('2022-01-01', 'YYYY-
MM-DD'))
INTO DEPARTMENT VALUES (2, 'HR', '2222222222', TO_DATE('2022-01-01',
'YYYY-MM-DD'))
INTO DEPARTMENT VALUES (3, 'Finance', '5555555555', TO_DATE('2022-01-01',
'YYYY-MM-DD'))
SELECT * FROM DUAL;
INSERT ALL
INTO DLOCATION VALUES (1, 'New York')
INTO DLOCATION VALUES (2, 'Los Angeles')
INTO DLOCATION VALUES (3, 'Chicago')
SELECT * FROM DUAL;
INSERT ALL
INTO PROJECT VALUES (101, 'Project X', 'New York', 1)
INTO PROJECT VALUES (102, 'Project Y', 'Los Angeles', 2)
INTO PROJECT VALUES (103, 'Project Z', 'Chicago', 3)
INTO PROJECT VALUES (104, 'Project A', 'New York', 1)
INTO PROJECT VALUES (105, 'Project B', 'Chicago', 3)
SELECT * FROM DUAL;
INSERT ALL
INTO WORKS_ON VALUES ('1111111111', 101, 40)
INTO WORKS_ON VALUES ('2222222222', 102, 35)
INTO WORKS_ON VALUES ('3333333333', 103, 30)
INTO WORKS_ON VALUES ('4444444444', 101, 45)
INTO WORKS_ON VALUES ('5555555555', 104, 50)
SELECT * FROM DUAL;
Write SQL queries to ............
1.Make a list of all project numbers for projects that involve an employee whose last name is
‘Scott’, either as a worker or as a manager of the department that controls the project.
2.Show the resulting salaries if every employee working on the ‘IoT’ project is given a 10
percent raise.
UPDATE EMPLOYEE
SET SALARY = SALARY * 1.10
WHERE SSN IN (
SELECT W.SSN
FROM WORKS_ON W
JOIN PROJECT P ON W.PNO = P.PNO
WHERE P.PNAME = 'IoT'
);
3.Find the sum of the salaries of all employees of the ‘Accounts’ department, as well as the
maximum salary, the minimum salary, and the average salary in this department
C.Write a program in PL/SQL to create a cursor displays the name and salary of each
employee in the EMPLOYEES table whose salary is less than that specified by a passed-in
parameter value.