The CREATE TABLE Statement
The CREATE TABLE account is acclimated to actualize 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,
....
)
The abstracts blazon specifies what blazon of abstracts the cavalcade can hold. For a complete advertence of all the abstracts types accessible in /MS Access, MySQL, and SQL Server, go to our complete Abstracts Types reference.
CREATE TABLE Example
Now we wish to actualize a table alleged "Persons" that contains 5 columns: P_Id, LastName, FirstName, Address, and City.
We use the afterward CREATE TABLE statement:
CREATE TABLE Persons
(
P_Id int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
The P_Id cavalcade is of blazon int and will authority a number. The LastName, FirstName, Address, and City columns are of blazon varchar with a best breadth of 255 characters.
The CREATE TABLE account is acclimated to actualize 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,
....
)
The abstracts blazon specifies what blazon of abstracts the cavalcade can hold. For a complete advertence of all the abstracts types accessible in /MS Access, MySQL, and SQL Server, go to our complete Abstracts Types reference.
CREATE TABLE Example
Now we wish to actualize a table alleged "Persons" that contains 5 columns: P_Id, LastName, FirstName, Address, and City.
We use the afterward CREATE TABLE statement:
CREATE TABLE Persons
(
P_Id int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
The P_Id cavalcade is of blazon int and will authority a number. The LastName, FirstName, Address, and City columns are of blazon varchar with a best breadth of 255 characters.
Comments
Post a Comment