Oracle Create Table - oracle tutorial - sql tutorial



How to create table statement in oracle ?

  • In Oracle, CREATE TABLE statement is used to create a new table in the database.
  • To create a table, you have to name that table and define its columns and datatype for each column.

Syntax:

CREATE TABLE table_name
( 
  			column1 datatype [ NULL | NOT NULL ],
 			 column2 datatype [ NULL | NOT NULL ],
  ...
  column_n datatype [ NULL | NOT NULL ]
); 
click below button to copy the code. By - oracle tutorial - team

Parameters used in syntax

  • table_name: It specifies the name of the table which you want to create.
  • column1, column2, ... column n: It specifies the columns which you want to add in the table. Every column must have a datatype. Every column should either be defined as "NULL" or "NOT NULL". In the case, the value is left blank; it is treated as "NULL" as default.
Oracle create table

SQL Create Table

oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , plsql

Oracle CREATE TABLE Example

  • Here we are creating a table named customers. This table doesn't have any primary key.
Oracle create table no null

Learn oracle - oracle tutorial - Oracle create table no null - oracle examples - oracle programs

CREATE TABLE customers
( customer_id number(10) NOT NULL,
  			customer_name varchar2(50) NOT NULL,
  city varchar2(50)
); 
click below button to copy the code. By - oracle tutorial - team
  • This table contains three columns
    • customer_id: It is the first column created as a number datatype (maximum 10 digits in length) and cannot contain null values.
    • customer_name: it is the second column created as a varchar2 datatype (50 maximum characters in length) and cannot contain null values.
    • city: This is the third column created as a varchar2 datatype. It can contain null values.
Oracle create table with primary key

Learn oracle - oracle tutorial - Oracle create table with primary key - oracle examples - oracle programs

Oracle CREATE TABLE Example with primary key

CREATE TABLE customers
( customer_id number(10) NOT NULL,
  customer_name varchar2(50) NOT NULL,
  city varchar2(50),
 			 CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
click below button to copy the code. By - oracle tutorial - team

What is Primary key

  • A primary key is a single field or combination of fields that contains a unique record. It must be filled.
  • None of the field of primary key can contain a null value. A table can have only one primary key.
    • In Oracle, total number of columns cannot be more than 32.

This tutorial provides an indepth knowledge on the following items such as oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , mysql tutorial , sql tutorial for beginners , learn sql , oracle database tutorial , sql query tutorial , oracle dba tutorial , plsql tutorial , oracle tutorial pdf , oracle pl sql tutorial , oracle sql tutorial , sql tutorial point , oracle tutorial for beginners , learn oracle online free , learn oracle online , learning pl sql programming , learn sql online for free , sql learning online , dba oracle tutorial , oracle sql tutorial advanced , oracle 11g dba tutorial with examples , oracle online learning , oracle learning online , how to learn pl sql , sql coding tutorial , sql learning websites , sql basic learning

Related Searches to Oracle Create Table