COURSE: DATABASE Write the following inserts, deletes or updates in SQL, using t
ID: 3698801 • Letter: C
Question
COURSE: DATABASE
Write the following inserts, deletes or updates in SQL, using the university schema.
Increase the salary of each instructor in the Finance department by 10%.
Delete all courses that have never been offered (that is, do not occur in the section relation).
Insert every student whose tot_cred attribute is greater than 150 as an instructor in the same department, with a salary of $25,000.
NOTE: PLEASE Writing is not recommended by hand
ID name dept namesalary 10101 Srinivasan Comp. Sci 12121Wu 15151Mozart 22222Einstein 32343El Said 33456Gold 45565 Katz 58583Califieri 76543 Singh 76766 Crick 83821 Brandt 98345Kim .65000 90000 40000 95000 60000 87000 Comp. Sci.75000 62000 80000 72000 Finance Music Physics History Physics History Finance Biology Comp. Sci.92000 80000 C1. Elec. EngExplanation / Answer
a) To increase the salary by 10% we use multiplying factor as 1.10 and to increase we use update command as shown
UPDATE INSTRUCTOR
SET SALARY= SALARY *1.10
WHERE DEPT_NAME= 'FINANCE’ ;
b). To delete the course which is not in section table we use DELETE FROM COURSE
WHERE COURSE_ID NOT IN
(SELECT COURSE_ID FROM SECTION);
c). To insert all those who have salary 25000 from student who have creditable greater than 150
INSERT INTO INSTRUCTOR
SELECT ID,NAME,DEPT_NAME,25000
FROM STUDENT
WHERE TOT_CRED > 150;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.