Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle Create Table

The CREATE TABLE statement is used to create a database table. A table creation statement requires three parameters. The name of table specify table name in database. The column parameters specify the names of the columns of the table. The datatype parameter specifies the type of data to be store (e.g. varchar, integer, date, etc.).

Tip: In order to get compelet details of the available data types, go to our Oracle Data Types section.

Oracle Create Table Syntax

Syntax

Oracle CREATE TABLE Example

The following Oracle statement creates a table called "tblCustomerLoan":

Example

Note:

In the above example, The pk column is of type int NOT NULL and will hold an integer. The NOT NULL is a field attribute and it is used to make sure field should not be NULL.

The firstName, lastName and address fields are of type varchar and will hold characters with specified length. The NULL is a field attribute and it is used to allow NULL value to be stored.

Oracle CREATE TABLE Example with Primary Key

The following Oracle statement creates a table called "tblCustomerLoan":

Example

Primary Key:

A primary key is a single field or combination of fields that contains a unique record. The primary key can not be null value. A table can have only one primary key.