How can you copy the structure of a table into another table without copying the data?

It is a trick question. But it has practical use in day to day work.

Query for this is as follows:
CREATE TABLE table_name AS SELECT * FROM USER WHERE 1 > 2;

In this example condition in WHERE clause will be always false. Due to this no data is retrieved by SELECT query.

Read the full book at www.amazon.com
Posted in MySQL, MySQL Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*