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

Concurrency control, Give the two reasons for allowing concurrency

Give the two reasons for allowing concurrency

What is use of generating such tables, What is use of generating such table...

What is use of generating such tables? How can you create temporary tables? When you require a table only for a short time after that you want it to disappear automatically you

Create role named roletable to allows a user to create table, Create role n...

Create role named role_table that allows a user to create tables. Using role_table allow users kripa and reena to create tables. CREATE ROLE role_table; GRANT CREATE ANY TABLE

Define identify relationship, Define identify relationship? Identifyin...

Define identify relationship? Identifying relationship: An identifying relationship means in which the child table cannot be uniquely recognize without the parent. For exampl

Explain the lock based protocol, Lock Based Protocol A lock is nothing ...

Lock Based Protocol A lock is nothing but a mechanism that tells the DBMS whether a particular data item is being used by any transaction for read/write purpose. As there are t

What are the various properties of relational tables, What are the various ...

What are the various properties of Relational tables? Relational tables have 6 properties: 1. Each row is unique. 2. Column values are of the same kind. 3. Values are

Introduction to Database Design and Development, Every School has many teac...

Every School has many teachers and many students. Each student is assigned to one school and each teacher works for one school only. Each teacher teaches more than one subject but

What is the use of integrity constraints, What is the use of integrity cons...

What is the use of integrity constraints? Integrity constraints make sure that changes made to the database by authorized users do not result in a loss of data consistency. The

What is alternate key, What is Alternate Key Alternate Key: This is t...

What is Alternate Key Alternate Key: This is the candidate key which is not taken as the primary key of the table. They are named so because although not the primary key, the

Explain the concept of qbe, Explain the concept of QBE? Query-by-exampl...

Explain the concept of QBE? Query-by-example represents a visual/graphical approach for accessing information in a database by the use of query templates called as skeleton tab

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