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 is transaction? Collections of operations that form a single logical unit of work are known as transactions.

(a) Differentiate between information and data . (b) List and briefly explain five potential benefits of the database approach compared to conventional file systems. (c) Diff

Explain the two constraints, check and foreign key in SQL along with an example for each. Give the syntax. CHECK constraint - CHECK constraint specifies an expression which

Update or Modify operation alters the existing values. If these operations alter the value that is the foreign key also, the only check need is the similar as that of the Insert op

anyone have a textbook solutions case fair, 8 edition of vol 1 ?, please give me

What is a block and a block number? A block is a contiguous sequence of sectors from a single track of one platter. Every request specifies the address on the disk to be refere

let us consider a table having 2200 records and the fixed size of the table to be considered as 25.then how many numbers of table is requredto perform horizontal fragmentation

For each 1: n relationship type R involving two entities E1 and E2, we recognize the entity type (say E1) at the n-side of the relationship type R and contain primary key of the en

I need web security expert , website management Project Description: i want professional for the below . website management server management database management