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

Define the terms entity type and entity set, Define the terms i) Entity typ...

Define the terms i) Entity type ii) Entity set Entity type: An entity type describes a collection of entities that have the similar attributes. Entity set: The set of all en

Data base model, why are older data base model are being replaced by new da...

why are older data base model are being replaced by new data model

Explain briefly concurrent task by taking an example, Explain briefly concu...

Explain briefly concurrent task by taking an example. Concurrent Task- The concurrent occurrence of more than one event is called concurrent task. Operating systems can handl

What are the key features of oracle, What are the key features of Oracle? ...

What are the key features of Oracle? Key features of Oracle are as follows: • Read Consistency • Concurrency • Locking Mechanisms • Quiesce Database • RAC • Portability

What is a view, What is a view? A view is a logical view on one or more...

What is a view? A view is a logical view on one or more tables.  A view on one or more tables i.e., the data from a view is not actually physically kept instead being derived f

Determine the concept of process, Determine the concept of Process Pro...

Determine the concept of Process Process: A process transforms the data values. It is represented as ellipse containing a description of transformation. Each procedure has a

Provide examples of different types of time and date formats, Provide Examp...

Provide Examples of different types of Time and Date formats.  It's most common store dates using a dash (-) as a colon (:)and the delimiter as the time delimiter. The given fo

Column constraints-on delete cascade, CREATE TABLE prodtrans ( pno ...

CREATE TABLE prodtrans ( pno number (4) ptype char (1) CHECK (ptype in ('I','R','S')), qty number (5) FOREIGN KEY pno REFERENCES product (pno) ON DELETE CASCADE);

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