Add more columns : Add Column « Table « Oracle PL / SQL






Add more columns

  
SQL>
SQL>
SQL> CREATE TABLE myTable (
  2     Name    VARCHAR(50) PRIMARY KEY NOT NULL,
  3     PhoneNo VARCHAR(15) DEFAULT 'Unknown Phone',
  4     SSN     VARCHAR(15) NOT NULL,
  5     CHECK (SSN LIKE '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'));

Table created.

SQL>
SQL>
SQL>
SQL> ALTER TABLE myTable ADD (EMail VARCHAR(25), ICQ VARCHAR(15));

Table altered.

SQL>
SQL> drop table myTable;

Table dropped.

SQL>

   
    
  








Related examples in the same category

1.Add a char type column to a table
2.Add a date type column to a table
3.Alter table: add a column to an existing table
4.Add two columns to a table
5.Alter a table to add two columns and use select to check
6.Alter table to add two columns and then drop them
7.Alter table to add a column and then add constraint to it
8.Alter table to add a column and then add 'check' constraint to it
9.Alter table to add a primary key
10.Alter table to add varray type column
11.Alter table to add date type column
12.Add new column with default value and not null