Experiment-02
Object:
To alter table of a simple database using
CREATE,ADD,MODIFY,UPDATE and DROP command.
Requirement:
Windows XP, Oracle 9i.
Program
Code:
SQL>Create table avneesh
2
(name char(20),
3 id number(10),
4 email varchar2(20),
5 address varchar2(30));
Table created
SQL>Insert
into avneesh values(‘Avneesh’,’1031030015’,’avneeshsrm@hotmail.com’,’varanasi’);
1.row created.
SQL>Insert
into avneesh values(‘Abhishek’,’1031030009’,’abhishek@
reddifmail.com’,’lucknow’);
1.row created.
SQL>Insert
into avneesh
values(‘Ashish’,’1031030041’,’heptashish@gmail.com’,’meerut’);
1.row created.
SQL>alter table avneesh
2 add contact number(10);
Table altered.
SQL>alter table avneesh
2 modify address varchar2(40);
Table altered.
SQL>alter table avneesh
2 drop column address;
Table altered.
Output:
SQL>desc avneesh;
Name Null? Type
---------
-------------------- --------------------
name
char(20)
id
number(10)
email
varchar2(20)
contact
number(10)
SQL>select * from avneesh;
Name id email contact
---------
-------------------- --------------------
Abhishek 1031030009 abhishek@ reddifmail.com
Ashish
1031030041 heptashish@gmail.com
Result:The above command ADD,MODIFY,UPDATE and DROP on a database table has
been executed successfully.
0 comments:
Post a Comment