CREATE TABLE LIKE A1 as A2
mysql
Solution
Your attempt wasn't that bad. You have to do it with `LIKE`, yes.
In the manual it says:
Use LIKE to create an empty table based on the definition of another table, including any column attributes and indexes defined in the original table.
So you do:
CREATE TABLE New_Users LIKE Old_Users;
Then you insert with
INSERT INTO New_Users SELECT * FROM Old_Users GROUP BY ID;
But you can not do it in one statement.
Problem
I want to create a new table with properties of an old table and without duplicates. I want to do something like this: ``` CREATE TABLE New_Users LIKE Old_Users, AS (SELECT * FROM Old_Users GROUP BY ID) ; ``` But the above is not working. Can anybody modify it to work?