Sub query in the update command, Database Management System

Sub query in the UPDATE command:

Example:  //Double  the  commission  for  employees,  who  have  got  at  least  2 increments.

UPDATE EMP

SET COMM = COMM * 2

WHERE 2 <= (   SELECT COUNT (*) FROM INCR WHERE INCR.EMPNO = EMP.EMPNO

GROUP BY EMPNO);

Be advised that the use of subquery that counts the number of increments given to every employee stored in the INCR table. Please note the comparison, instead of ......>=2, we have written reverse of it as 2 <= .....

DELETE Command

In the following example, the deletion will be performed in EMP table.No deletion will be performed in the INCR table.

Example: Delete the records of employees who have got no increment.

DELETE FROM EMP

WHERE EMPNO NOT IN (SELECT EMPNO FROM INCR);

Posted Date: 3/11/2013 1:11:58 AM | Location : United States







Related Discussions:- Sub query in the update command, Assignment Help, Ask Question on Sub query in the update command, Get Answer, Expert's Help, Sub query in the update command Discussions

Write discussion on Sub query in the update command
Your posts are moderated
Related Questions
What are the reasons of bucket overflow? Explain any two methods for solving this problem. Ans:  It is general for file structures to be divided into equal-length partitions, k

What is the difference between link and reference? The fundamental difference between links and references is that links are symmetrical on the other hand references refer only

Explain the Role of a database administrator a. Defining the Schema   The DBA describes the schema which consists of the structure of the data in the application. The DBA

UNION If R1 and R2 are two union compatible relations then R3 = R1 ∪ R2 is the relation having tuples that are either in R1 or in R2 or in both. In case, R3 will have tuples

what are information system hirarchy?

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4



What is a view? How it is related to data independence? A view might be thought of as a virtual table, that is, a table that does not really exist in its own right but is inste

In the first unit of this block, you have been given with the details of the Database Management System, its structure, advantages etc. This unit is an attempt to give you informat