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 |
Why we use sql profiler?
There is a sequence with min value 100. I want to alter this sequence to min value as 101. If the table has already data in the sequence column as 100,101,102... Is it possible to do so ?
How to remove duplicate rows from a table?.
what is the difference between truncate and drop statements? : Sql dba
Is primary key is clustered index?
What are the advantages of pl sql over sql?
How would you convert date into julian date format?
What is data control language (dcl)?
How do I run a script in sql developer?
what is the difference between delete and truncate commands? : Sql dba
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?
How much does sql certification cost?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)