Date Tags MySQL

MYSQL: create table from another clever way

If you need create table on basis of another you do not need to search types and so on.

CREATE TABLE name_birthday_backup (KEY(name))
    SELECT name, birthday
    FROM users
    WHERE name is not null and birthday is null;

Request above creates table with names and birthdays for users who specified their names and not specified their birthday with index on name. Types of columns will be the same.


Comments

comments powered by Disqus