DDL commands: Create, Add, Drop

The Structure of Create Table Command

Table name is Student

Column name Data type  Size
 Reg_no  varchar2  10
 Name  char  30
 DOB      date  
 Address  varchar2  50

Insert

The ALTER Table Command

By The use of ALTER TABLE Command we can modify our exiting table.

Adding New Columns

Syntax:

ALTER TABLE <table_name>

         ADD (<NewColumnName> <Data_Type>(<size>),……n)

Example:

ALTER TABLE Student ADD (Age number(2), Marks number(3));

The Student table is already exist and then we added two more columns Age and Marks respectively, by the use of above command.

Delete

Syntax:

DROP TABLE <table_name>

Example:

DROP TABLE Student;

It will destroy the table and all data which will be recorded in it.

Update

UPDATE Syntax

UPDATE table_name

SET column1 = value1, column2 = value2, …

WHERE condition;

Leave a Reply

error: Content is protected !!