Oracle Tables:Create Table

      9 Comments on Oracle Tables:Create Table
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

CREATE TABLE statement is used to create table objects in database.You can create tables with different column data types.It is possible to add CONSTRAINTS like primary key ,foreign key etc while creating the table or can be added after the table creation.
Let us see the examples one by one.

Create table with data types

SQL> create table MYTABLE(name VARCHAR2(50),id NUMBER,salary NUMBER(8,2));

Table created

Now let us INSERT few records into MYTABLE.

SQL> insert into MYTABLE values ('CCC',1,2548.21);
SQL> insert into MYTABLE values ('ADS',2,3548.21);
SQL> insert into MYTABLE values ('GDS',2,1548.21);

SQL> select * from MYTABLE ORDER BY SALARY;
NAME   ID  SALARY
GDS   2    1548.21
CCC   1    2548.21
ADS   2    3548.21

Related Articles,Oracle/PLSQL: Foreign Keys with ON DELETE CASCADE optionORA-02449: unique/primary keys in table referenced by foreign
ORA-02292: integrity constraint violated – child record found
ORA-02291: integrity constraint violated – parent key not Found
Oracle/PLSQL: Foreign Keys | Oracle Referential Integrity
Oracle/PLSQL: Composite Primary Key
Oracle/PLSQL: Primary Key and Composite Primary Key

Technorati Tags:
, ,

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×