Friday, June 7, 2013

DROP multiple tables using single DROP statement

We know that how to drop a table. But we can also drop multiple tables using only single drop statement. How? Let see using the below example:

Just create multiple tables like:

CREATE TABLE t1(ID1 INT)
CREATE TABLE t2(ID2 INT)
CREATE TABLE t3(ID3 INT)

Try to select the table data to confirm that tables are created successfully by:

SELECT * FROM t1
SELECT * FROM t2
SELECT * FROM t3

Tables are created, Now we are going to drop those tables using single drop statement as below:

DROP TABLE t1,t2,t3

That’s work perfectly..





3 comments:

Jayesh L said...
This comment has been removed by the author.
Jayesh L said...

i am really looking for this kind of solutions where it will same time to write more drop query

Nitesh Porwal said...

This is very helpful to me in making script for live server.when we are changing on large scale.