Oracle ‘ALTER TABLE’ to ADD columns

      2 Comments on Oracle ‘ALTER TABLE’ to ADD columns
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

We can use the ‘ALTER TABLE‘ statement in oracle to add columns to a table using ADD keyword.
It is fairly straight forward.
We can specify column details and constraints if any,
See the below example.

SQL> create table MYTABLE(name varchar2(100),age number);

Table created

Now let us use the ‘<span style=”font-weight: bold;”>ALTER TABLE</span>’ statement to add new columns to the table <span style=”font-weight: bold;”>MYTABLE</span>.

SQL> ALTER TABLE MYTABLE add(id number NOT NULL,address varchar2(100));

Table altered

SQL>

Related Articles,ALTER TABLE to ADD PRIMARY KEY in Oracle.

Also Read:

CREATE INDEX as part of CREATE TABLE statement.
Oracle Tables: Create Table as Select
Oracle/PLSQL: Create table with foreign key constraint
CREATE TABLE statement: create a table with composite primary key
Oracle PL/SQL:CREATE TABLE statement: create a table with primary key.
Oracle PL/SQL:Create Table
Oracle/PLSQL: Foreign Keys with ON DELETE CASCADE option

Technorati Tags:
, ,

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

2 thoughts on “Oracle ‘ALTER TABLE’ to ADD columns

  1. Pingback: Oracle Cursors | OPEN ,FETCH and CLOSE Cursor statements. | SQL and PLSQL

  2. Pingback: Cursor | Oracle PL/SQL Cursors and example. | SQL and PLSQL

Leave a Reply

Your email address will not be published. Required fields are marked *

Paged comment generated by AJAX Comment Page