java2db

How to create a table using SQL



To create a table using SQL  , use the  DDL (Data Definition Language)  command  called  ‘ CREATE TABLE ‘  and follow the rules that are given below .

Rules to create a table using SQL :

User must have the permission and storage area.
The name of the table should be start with a letter and the size 1-30 characters long.
The table name can contain [A-Z] , [a-z] , [0-9] ,_, $ , #.
Table names should not contain duplicates in the same ORACLE Server.
create a table using SQL Table names are not case sensitive.
create a table using SQL Table name cannot be oracle server reserved word.
Syntax:

CREATE TABLE Table_name  (Col_name_1 type (size) , Col_name_2 type (size) ,…, Col_name_n  type (size));

Example code to create a table using SQL :

 

CREATE TABLE statement execution :

create a table using SQL

For table description , type the below SQL command.


The description  contains column name , key constraint  and its type with the given size.

 

Give a meaningful name as a table name (not mandatory).
We can declare  the Key constraints  at column or table level .
The size represents  the maximum length of the column.

 




Related Posts :
Sql FOREIGN KEY constraint on table column
Sql CHECK constraint on table column
Sql NOT NULL constraint on table column
Sql UNIQUE constraint on table column
Sql PRIMARY KEY constraint on table column
Sql full outer join on tables with an example
Sql right outer join on tables with an example
Sql left outer join on tables with an example
   [will not be published]



^ <