Friday, September 20, 2013

IMPORTANT SQL QUERY

TO DELETE DUPLICATE RECORD FROM TABLE
IF TABLE TEST CONTAIN DUPLICATE RECORD


DELETE FROM TEST WHERE ROWID NOT IN 
(SELECT MIN(ROWID) FROM TEST GROUP BY ID)

##################################################


CREATE DUPLICATE TABLE WITH DATA USING ANOTHER TABLE


CREATE TABLE TEST AS SELECT * FROM TEST1;

########################################################


CREATE DUPLICATE TABLE SAME SCHEMA AS USING ANOTHER 

TABLE


CREATE TABLE TEST AS SELECT * FROM TEST1 WHERE 1=2;




No comments:

Post a Comment