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 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

You are managing the following database system: • DBMS: Oracle 11g • OS: Sun Solaris • System architecture: Web-based application using ASP.Net • Purpose of Server: HR managem

wrie a report on whether a BSc n information systems develops the skills required by employers in Database administration


What are the Issues when Selecting a Database Issues when Selecting a Database Storage space requirement: A database requires about triple storage space of the actua

Define multivalued dependency and 4NF.  Ans:  Multivalued Dependency - Assume R be a relation schema and let α ⊆ R and β ⊆ R. The multivalued dependency  α →→β   holds o

Why do you go for sorting your query results? SQL SELECT command to fetch data from MySQL table. Whenever you select rows, the MySQL server is free to return them in any order

What are the two distinct aspects to the implementation of associations? i) It is required to define data declarations which will enable details of actual links to be stored. I

The need for three level architecture The aim of the three level architecture is to divide each user's view of the database from the way the database is physically shown.

The dataset " CFOLYMPICS.XLS " contains the observations used in the above article.  The definitions of the variables are also included in this spreadsheet.  However, for the purpo