SQL CREATE TABLE Keyword
The CREATE TABLE command is used to create a new table in the database. You define the table name and specify each column’s name and data type.
SQL CREATE TABLE Syntax
SQL
x
1
CREATE TABLE table_name (
2
column1 datatype,
3
column2 datatype,
4
...
5
)
SQL CREATE TABLE Example
This creates a new table named Mechanics with five columns.
SQL
1
1
CREATE TABLE Mechanics (
2
MechanicID INT,
3
LastName VARCHAR(255),
4
FirstName VARCHAR(255),
5
Specialty VARCHAR(255),
6
ShopLocation VARCHAR(255)
7
)

SQL CREATE TABLE Using Another Table Syntax
You can also create a new table by copying selected columns and data from an existing table.
SQL
1
1
CREATE TABLE new_table AS
2
SELECT column1 column2
3
FROM existing_table
SQL CREATE TABLE Using Another Table Example
This creates a new table named PatientNames with only the first_name and last_name columns from the Patients table.
SQL
1
1
CREATE TABLE PatientNames AS
2
SELECT first_name last_name
3
FROM Patients
