SQL Create table Statement
Create Table
The CREATE TABLE statement creates a new table within a database. Each optional field is
provided with a name and data type for creation within that table.
syntax:
CREATE TABLE table_name
( field1 datatype [ NOT NULL ],
field2 datatype [ NOT NULL ],
field3 datatype [ NOT NULL ]...)
( field1 datatype [ NOT NULL ],
field2 datatype [ NOT NULL ],
field3 datatype [ NOT NULL ]...)
Example:
CREATE TABLE article
(
article_id numeric(4),
title varchar(255) not null,
description varchar(255) ,
full_article varchar(255) not null,
category varchar(25)
)
(
article_id numeric(4),
title varchar(255) not null,
description varchar(255) ,
full_article varchar(255) not null,
category varchar(25)
)
Note: we have mentioned not null because this field cant empty during insert records. if you want to see data type, visit data types reference