In MySQL, can I copy the structure? of a table using this command:
CREATE TABLE foo SELECT * FROM bar LIMIT 0;
By doing this I will have a table foo
with the same columns of the table bar
, but in the table foo
there will be no data.
But what about indexes, constraints, foreign keys? Are they copied too?
If they are not copied, how could I make an exact copy of my table bar
without data, but have the same configuration as foo
in terms of indexes, restrictions, etc?