SQL
CREATE TABLE
The CREATE TABLE statement is used to create a
table in a database to stored data.
Tables are organized into rows and columns; and
each table must have a name.
SQL
CREATE TABLE Syntax
CREATE TABLE tablename
(
columnname1 datatype(size) [null | Not Null],
columnname2 datatype(size) [null | Not Null],
columnname3 datatype(size) [null | Not Null],
....
);
(
columnname1 datatype(size) [null | Not Null],
columnname2 datatype(size) [null | Not Null],
columnname3 datatype(size) [null | Not Null],
....
);
tablename
The
name of the table that you wish to create.
columnname1, columnname2
The
columns that you wish to create in the table. Each column must have a datatype.
The column should either be defined as NULL or NOT NULL and if this value is
left blank, the database assumes NULL as the default.
CREATE TABLE employees
( employeeid INT NOT NULL,
lastname VARCHAR(50) NOT NULL,
firstname VARCHAR(50),
Address varchar(200)
areaPin bigint
);
- Column name employeeid is numeric column and can’t be null
- Lastname, firstName,Address is varchar column.
- AreaPin is numeric column.
No comments:
Post a Comment