tags:

views:

67

answers:

1
CREATE TABLE foo SELECT * FROM bar

copies the table foo and duplicates it as a new table called bar

How can I copy the schema of foo to a new table called bar without copying over the data as well?

+4  A: 

Try:

CREATE TABLE foo SELECT * FROM bar LIMIT 0

Or:

CREATE TABLE foo SELECT * FROM bar WHERE 1=0
Andomar
I think the second example is the universal way :-)
Khb