write a query to delete similar records in different tables
with same structure
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
cursor types? explain with example programs?
What is foreign key and example?
How to find last day of the month in sql query
Why we use sql profiler?
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????
What is the use of a view in sql?
How to run pl sql program in mysql?
what is a foreign key ? : Sql dba
How many types of normalization are there?
What is diff between bulk collect and forall
in table there r so many rows write a query which two rows r updated last two day befor?
What is the need of a partition key?