Reputation: 21
I want to create a table named S1 with the same attribute of another table Bonus and also want some data of Bonus to be loaded into S1 The code I used is
CREATE TABLE S1 LIKE Bonus (SELECT E.* FROM Bonus as E )WITH DATA;
but I am getting an error which is given below:-
you have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT E.* FROM Bonus as E )WITH DATA' at line 1
I am not getting what is wrong with the query I used.
Upvotes: 0
Views: 85
Reputation: 308
CREATE TABLE S1 as SELECT * FROM Bonus
And in case if you do not need data then
CREATE TABLE S1 as SELECT * FROM Bonus where 1=2
Upvotes: 1