You are on page 1of 2

DATA DEFINITION LANGUAGE (DDL)::

CREATE , ALTER , DROP

DATA MANIPULATION LANGUAGE (DML)::


INSERT , UPDATE , SELECT , DELETE

TRANSACTION CONTROL LANGUAGE (TCL)::


COMMIT , ROLLBACK , SAVEPOINT

DATA CONTROL LANGUAGE (DCL)::


GRANT , REVOKE

we can update our table as per our wish using some sql queries..

if you have already a table and you want to add a new column into your that table
then you can update your table through queries

SUPPOSE YOU HAVE A TABLE NAMED 'EMPLOYEE'


then you have to simply write a query. the syntax is as below..

:: alter table employee Add name (i.e. column_name) varchar2(20) (i.e. data_type
with Max length);

'alter' is a keyword to perform the updation on table or on other updatable


things..
'Add' is also a keyword to add the columns in the specified table..

if you want to check the columns and it's information of perticular table then
write a query

:: desc table_name;

'desc' is stands for 'describe'

if you want to change the size of any existing column then you use the query like
below

:: alter table employee modify emp_id number(4);

here 'modify' keyword is used for modify the size of existing column
this is the altering task so we must have to specify the 'alter table table_name'
syntax first

if you want to add more than 1 columns in your existing table then you have first
write the
updatation syntax and then use the 'add' keyword and write the new columns in the
paranthesis
using commas,

:: alter table employee add (name varchar2(20) , address varchar2(50) , mobile_no


number(10));

now we will learn how to delete a column

:: alter table employee drop column column_name;

here the 'drop' and 'column' both are the keywords where the 'drop' is used to
delete and 'column'
is used after 'drop' to specify the operation of dropping column and after all we
have to specify
the column name

now we have to rename the column

:: alter table employe rename column old_name to new_name;

here there are 3 keywords 'rename', 'column' , 'to'


'rename' is used to specify the operation
'column' is used to specify the operation will be performed on column
'to' is used for specifying that we have to rename 'old_name' to 'new_name'

if you want to rename the table then,

:: alter table employee rename to emp1;

You might also like