Is there a way to copy a column's structure from an already populated table to a new table which is empty? I'm only asking about copying the structure without the data
Example: We have a table
CREATE TABLE `animals` ( `animal` varchar(11) NOT NULL, `food` varchar(11) NOT NULL, PRIMARY KEY (`animal`) ) ENGINE=InnoDB INSERT INTO `animals` (`animal`, `food`) VALUES ('cat', 'chips'), ('dog', 'bones'), ('shark', 'ppl');
And a new table called predators
for which I want to make just one column but with the same data type as the animals' column type.
Is there a way to combine the SHOW COLUMNS/FIELDS with the CREATE TABLE or create the table with a column that has some kind of type like VARCHAR(17) and then ALTER CHANGE it to the same type as the animal
column?
I know this is a simple question but i haven't had any luck finding the answer to it