CREATE Command in SQL – DDL Statements

In previous SQL post we had discussed about SQL Database and SQL Table, Data Definition Language and Data Manipulation Language Statements.

Now, In this SQL article we will learn DDL CREATE command in detail, how to use CREATE Command for creating new database and table.

CREATE Command – Data Definition Language Statements

The CREATE command is used to create new database in DBMS, and create new table in database. In other word we can say CREATE command used to create new database and table.

After installing Database management system like sql server, oracle on computer, we need to manage database and for create a new database we use CREATE command.

We can create both Database and Table using CREATE command.

CREATE Syntax for Database:

CREATE DatabaseName

database name = School

When execute above statement it create an empty database named “School” on database server.

After creating the database, the next step to create tables that contains the records or data.
let’s learn how to create new table in database.

When we create new table, the table must contains some columns to store the data. so at the time of creating a new table we must specify the columns with proper datatype and size.

CREATE Syntax for Table:

Columns1 datatype,
Column2 datatype,
Column3 datatype

In above statement:
Tablename – is the name of Table
Column1, Column2 – is the name of columns
datatype – is the datatype of columns like int, char, varchar etc.

Create new Table Student with Columns ID, Name, City and Email


Name  varchar(50)  NOTNULL,
City  varchar(50)   NULL,
Email  varchar(100)  NULL


The above statement create a new table named “Student” with four columns student Id, Name, City and Email address.
In above example we can see that, we specify the data type for each columns the ID column data should be integer type and Name, City and Email are varchar data type with specific size.

The Student Table :

ID Name City Email
1 Meera Bombay
2 Ram Bombay
3 Jay Bombay

Let’s another example for creating new Table.

Create new table for Branch with columns BranchID, BranchName and Seat.



BranchID int NOTNULL,
BranchName varchar(50) NOTNULL,
BranchSeat int NOTNULL


Create new table from an existing table with records.

The other way to create table in oracle, Create new table from an existing table with all records.

CREATE TABLE temp_Student AS

Above statement create new table temp_Student with same columns with records of Student table.
If we want to create table with some of columns from existing table then statement should be like:

CREATE TABLE temp_Student AS
SELECT ID, Name FROM Student

Above statement create new table temp_Student with columns ID and Name with all records from existing table Student

Note : In oracle the datatype integer is represented as “number” and in Sybase it is represented as “int”.

Leave a Reply

Your email address will not be published. Required fields are marked *