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
Create centralized relational database using bottom up method.   (a) Recognize a single un-normalized relation for the above scenario.          (b) Recognize the primary key for

What is called block-level striping? Block level striping stripes blocks across many disks. It treats the array of disks as a large disk, and provides blocks logical numbers

What is the aim of logical schema ? The main motive of the logical schema is to ensure the portability of procedures and models on various physical schemas at runtime.

The advantages of a database management system (DBMS) include :- Data integrity and elimination of duplication.

Define Network DBMS The NDBMS is built primarily on a one-to-many relationship, but where a parent-child representation between the data items cannot be ensured. This may occur

Explain the ACID properties of a transaction Ans: ACID properties are a significant concept for databases. The ACID stands for Atomicity, Consistency, Isolation, and Durability

Describe entity referential integrity and integrity. Give an example of each. Entity Integrity Rule - If there is a attribute A of relation R is a prime attribute of R then A

Horizontal Fragmentation- Horizontal fragmentation groups together the tuples in a relation that are collectively used by the main transactions. A horizontal fragment is produced b

Explain about primary key Primary Key: It is one of the candidate keys that are taken to be the recognizing key for the entire table. E.g. although there are two candidate ke

The External or View Level The external or view level is the highest level of abstraction of database. It gives a window on the conceptual view, which permits the user to see