write a query to delete similar records in different tables
with same structure

Answers were Sorted based on User's Feedback



write a query to delete similar records in different tables with same structure..

Answer / vinoth kumar

DELETE FROM table1 WHERE
(col1,col2,..) IN (SELECT col1,col2,.. FROM table2 where
condition)

Is This Answer Correct ?    6 Yes 0 No

write a query to delete similar records in different tables with same structure..

Answer / radha sri seshu.kolla

while creating table and giving foreign key constraint give
the key word 'on delete cascade'.automatically when the
record in the master table is delated the relaeted record
in the detail table will also be deleted.

Is This Answer Correct ?    3 Yes 3 No

write a query to delete similar records in different tables with same structure..

Answer / umadevi

example

delete from emp where deptno in (select deptno from dept
where emp.deptno=dept.deptno);

Is This Answer Correct ?    3 Yes 5 No

write a query to delete similar records in different tables with same structure..

Answer / senthil

This done by Co-related sub-query:- based upon ROWID
uniqness this deletes the duplicate rows.

Delete from emp x where ROWID != (Select MIN(ROWID) from
emp y where y.empno = x.empno);

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

Which data dictionary views have the information on the triggers that are available in the database?

0 Answers  


Determine if oracle date is on a weekend?

0 Answers  


Can we call stored procedure in function?

0 Answers  


What is a database event trigger?

0 Answers  


what is the order of pre-defined exceptions.

6 Answers   TCS,






what are pl/sql collections?

4 Answers   JPMorgan Chase, Oracle,


I Defined SP1, Sp2 (sp=StoreProcedures)In Package Specification but I Implemented Sp1, sp2, sp3, sp4, sp5 then What type of Error You will find????

3 Answers   Infosys,


I have the table like this S.No Name ID 01 Xyz 123 I want the result as 01Xyz123 How to write the query to retrieve the entire row data in a single column?

1 Answers  


What is nvarchar max in sql?

0 Answers  


What is dense_rank in sql?

0 Answers  


what is meant by tuning and tk proof?

2 Answers  


How do you truncate?

0 Answers  


Categories