Directions (Q96–100): A university database has the tables EMPLOYEE (EID, NAME, SALARY, DEPTNO, HODEID …; PRIMARY KEY EID; HODEID references EMPLOYEE(EID); DEPTNO references DEPARTMENT(DID)), DEPARTMENT (DID, DNAME, HODID; PRIMARY KEY DID; UNIQUE DNAME; HODID references EMPLOYEE(EID)) and PROJECTWORK (EMPID, PROJNO; PRIMARY KEY (EMPID, PROJNO); EMPID references EMPLOYEE(EID)).
Refer table, structures given above. The university decided to give all employees in the 'SCIENCE' department a 20% rise in salary. Which of the following query/queries will compute the above results?
(A) UPDATE EMPLOYEE SET SALARY = SALARY * 1.20 WHERE DEPT NO. IN (SELECT DID FROM DEPARTMENT WHERE DNAME='SCIENCE');
(B) UPDATE TABLE EMPLOYEE SET SALARY = SALARY * 1.20 WHERE DNAME='SCIENCE';
(C) ALTER TABLE EMPLOYEE SET SALARY=SALARY * 1.20 WHERE DEPTNO. IN (SELECT DNAME FROM DEPARTMENT WHERE DNAME = 'SCIENCE')
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. (A) only
Explanation
Only A is valid: update EMPLOYEE where DEPTNO is in the SCIENCE department's DID. B uses invalid syntax (UPDATE TABLE) and a column EMPLOYEE lacks; C uses ALTER instead of UPDATE.
More Database Management Systems questions
- Which of the component module of DBMS does rearrangement and possible ordering of operations, eliminate redundancy in query and use efficie…
- Given two tables R1(x,y) and R2(y,z) with 50 and 30 numbers of tuples respectively. Find the maximum number of tuples in the output of natu…
- Given two tables EMPLOYEE (EID, ENAME, DEPTNO) DEPARTMENT (DEPTNO, DEPTNAME) Find the most appropriate statement of the given query : Selec…
- Find the minimum number of tables required for converting the following entity relationship diagram into a relational database.
- Two concurrent executing transactions 1 and T 2 are allowed to update same stock item say ' A ' in an uncontrolled manner. In such scenario…
- Minimal cover of functional F dependency set is