Planet For Application Life Development Presents
MY IT World

Explore and uptodate your technology skills...

SQL CREATE TABLE Statement

The CREATE TABLE Statement is used to create tables to store data. Integrity Constraints like primary key, unique key, foreign key can be defined for the columns while creating the table. The integrity constraints can be defined at column level or table level. The implementation and the syntax of the CREATE Statements differs for different RDBMS.

Syntax

CREATE TABLE table_name
(column_name1 datatype,
column_name2 datatype,
... column_nameN datatype
);

  • table_name - is the name of the table.
  • column_name1, column_name2.... - is the name of the columns
  • datatype - is the datatype for the column like char, date, number etc.

For Example: If you want to create the employee table, the statement would be like,

CREATE TABLE employee
( id number(5),
name char(20),
dept char(10),
age number(2),
salary number(10),
location char(10)
);