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
Give an example of operations from the State Actions and Activities. For instance, in bank the activity verify account code and verify password

sir, could anybody help me in getting complete information about the mentioned topic

You are to write a property management database program that allows a real estate agent to view, add, search, and save property listings. The program is to do the following: 1.

Normalization :It is a process of examine the given relation schemas based on their primary key and Functional Dependencies (FDs) to achieve the properties Minimizing redun

A relation instance indicates as r is a collection of tuples for a given relational schema at a exact point of time. A relation state r of the relation schema R (A 1 ,A 2 ,.....

What is a guard condition? Explain it with a suitable example. The guard-condition is a Boolean expression written with respect to parameters of triggering event and attributes

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

DISADVANTAGES OF RDBMS

What are the objectives of query processing?       Ans: The objectives of query processing is to transform a query written in a high level language into a accurate and efficien

Synonyms and Indexes Some of the essential properties of indexes are: An Index is a schema Object Indexes can be formed explicitly or automatically Indexes are m