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

Mapping, How external/conceptual mapping and conceptual /internal mapping i...

How external/conceptual mapping and conceptual /internal mapping is performed

Describe the primary key functions, Describe the primary key functions? ...

Describe the primary key functions? Primary Key : The primary key is an attribute or a set of attributes in which uniquely identify a specific example of an entity. Every entit

Write short notes on relational model, Write short notes on relational mode...

Write short notes on relational model   The  relational  model  uses a  collection of  tables  to show  both data  and the relationships between those  data.  The relational mo

Define access time, Define access time. Access time is the time from wh...

Define access time. Access time is the time from when a read or write request is issued to when data transfer starts.

What are the comparison operator in sql, What are the comparison operator i...

What are the comparison operator in SQL?  Comparison operator in SQL are =, LIKE and BETWEEN

What is null, What is NULL? Simply NULL means not in value.

What is NULL? Simply NULL means not in value.

What is relational model feature, What is relational model feature? A r...

What is relational model feature? A relational model feature is much more data independence than some other database models.

Which language has recently become the defacto standard, Which language has...

Which language has presently become the defacto standard for interfacing application programs along with relational database system? The language which has recently become the

Data flow diagram of structured analysis and design, From SAD to OOAD (Stru...

From SAD to OOAD (Structured Analysis and Design (SAD) to Object Oriented Analysis and Design (OOAD). We will find here how we can map various models in SAD to different model

Database recovery and security, Database Recovery And Security Introdu...

Database Recovery And Security Introduction In this part we will introduce two main issues relating to database management systems. A computer system suffers from dissi

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