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 |
How do you update a table in sql?
wirte a query to remove null? following table are col1 col2 col3 dinesh null null null suresh null null null prakesh i want the output like col1 col2 col3 dinesh suresh prkaesh
Types of indexes. What is the default key created when a primary key is created in a table ?
What are sql triggers used for?
what is denormalization. : Sql dba
what are myisam tables? : Sql dba
What is TABLE SPACE?
What are inbuilt functions in sql?
How does an execution block start and end in pl sql?
Explain the order of sql statement execution?
What are expressions?
What is dialect in sql?
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)