The CREATE TABLE Statement
The CREATE TABLE statement is used to create a table in a database.SQL CREATE TABLE Syntax
CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... ) |
CREATE TABLE Example
Now we want to create a table called "Persons" that contains five columns: P_Id, LastName, FirstName, Address, and City.We use the following CREATE TABLE statement:
CREATE TABLE Persons ( P_Id int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ) |
The empty "Persons" table will now look like this:
P_Id | LastName | FirstName | Address | City |
---|---|---|---|---|