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 Tables:Create Table
- Oracle Tables: CREATE TABLE statement: create a table with primary key.
- Oracle Tables: Foreign Keys with ON DELETE CASCADE option
- Oracle: ORA-02449: unique/primary keys in table referenced by foreign keys
- Oracle: ORA-02292: integrity constraint violated – child record found
- ORA-02291: integrity constraint violated – parent key not found
- Oracle Tables: Foreign Keys | Oracle Referential Integrity
- Composite Primary Key in Oracle
- Oracle: Primary Key and Composite Primary Key
- Oracle: SQL MIN Function | MIN() function in SQL
Technorati Tags:
CREATE TABLE statement, CREATE TABLE, create table oracle