how sql table from existing table code example
Example 1: how to create table in sql
# Creates a Simple User table
# Uses an auto-incrementing primary key as userId
CREATE TABLE user (
userId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100),
password VARCHAR(100)
) ENGINE=InnoDB;
Example 2: sql create table with columns as another table
SELECT * INTO newtable FROM oldtable WHERE 1 = 0;