Example:-2
1.Create table student (Roll_No, SName, Date_Of_Birth). Add new column into
student relation named Address as a text data type and a column phone of data
type integer.
Create table student (Roll_Noint primary key, SNamevarchar(10),
Date_Of_Birthvarchar(10));
Alter table student add(Address varchar(20), Phone_Noint);
Select * from student;
2.Create table driver (Licence_No, Name, Address) and perform following
queries:
I.Add new column Age of data type integer.
II.Alter table by modifying Driver_Name to varchar(20).
III.Alter table driver drop the column Age.
IV.Remove the driver table from the database.
Create table driver (Licence_No int primary key, Name varchar(10), Address
varchar(20));
I.Alter table driver add Age int;
Select * from driver;
II.Alter table driver modify Name varchar(50);
Describe driver;
III.Alter table driver drop column Age;
IV.Drop table driver;
3.Create table Game (Name, No_of_Players,Captain_Name) and perform the
following queries:
I.Add new column Game_No of data type integer.
II.Alter table by adding constraint uppercase to Captain_Name.
III.Modify table by adding the column Game_Duration.
IV.Add column Game_Type with values Cricket, Hockey, Tennis.
V.Remove game table from the database.
Create table game (Name varchar(10), No_Of_Players int, Captain_Name
varchar(10));
I.Alter table game add Game_No int;
II.Alter table game add constraint Captain_Name check(Captain_Name=
upper(Captain_Name));
III.Alter table game add Game_Duration int;
IV.Alter table game add (Game_Type varchar(255) default ‘Cricket, Hockey,
Tennis’);
Select * from game;
V.Drop table game;