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 |
define sql insert statement ? : Sql dba
What is dba in sql? : SQL DBA
What are all the common sql functions?
Can you alter start with clause?
What is %type in pl sql?
How to export the table data (this table having 18 million records) to .csv file. Please tell me is there any faster way to export the data.
when a procedure /package is getting invalidated?
write an sql query to find names of employee start with 'a'? : Sql dba
How do you assign Construct the where clause without concatenating Field,value pairs?
What are the two types of periodical indexes?
how to use case expression? : Sql dba
What is sql basics?
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)