Sub query in the update command, Database Management System

Assignment Help:

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


Related Discussions:- Sub query in the update command

What is the meaning of recovery, What is the meaning of Recovery? In d...

What is the meaning of Recovery? In deferred update methods, if a transaction fails before arriving its commit point, it will not have altered the database in any way, so UNDO

File organisation and its types, File Organisation And Its Types  Just ...

File Organisation And Its Types  Just as arrays, trees, lists and other data structures are used to execute data Organisation in main memory, a number of planning's are used to

Describe the types of attributes, Describe the types of attributes? Ty...

Describe the types of attributes? Types of attributes: An attribute's category determines the type of values that are permitted in the attribute. For instance, the value vers

Relationship, what is the relationship between receipt and owner entities i...

what is the relationship between receipt and owner entities in computer sales and service company

Selective replication-data replication, Selective replication: This is a c...

Selective replication: This is a combination of generating small fragments of relation and replicating them rather than a entire relation. The data should be fragmented on require

What are aggregate functions, What are aggregate functions? And list the ag...

What are aggregate functions? And list the aggregate functions supported by SQL? Aggregate functions are functions that take a collection of values as input and return a one va

Economics, Economics: It is now usually accepted that it costs less to make...

Economics: It is now usually accepted that it costs less to make a system of smaller computers with the equivalent power of a one large computer. It is more cost-effective to get s

Database administrator, The Database administrator (DBA) uses the data dict...

The Database administrator (DBA) uses the data dictionary in each phase of a database life cycle, beginning from the data gathering phase to the design, execution and maintenance p

Explain about data independence, Data Independence This brings us to ou...

Data Independence This brings us to our next topic: data independence. It is the property of the database which tries to make sure that if we make any change in any level of sc

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd