You are on page 1of 1

create table student (sid int primary key, name varchar(30), cgpa numeric(3,2), address varchar(40), splId int

references SPL) create table SPL (splid int primary key, splname varchar(25)) insert into student values (1, 'Ali', 3.2, 'muscat', 1000) insert into student values (2, 'Fatma', 3.9, 'Ruwi', 1001) insert into student values (3, 'Ahmed', 2.9, 'Nizwa', 1000) insert insert insert insert into into into into SPL SPL SPL SPL values values values values (1000, (1001, (1002, (1003, 'HR') 'IT') 'MRK') 'Law')

update SPL set splname = 'Finance' where splid =1002 select splname from SPL where splname LIKE 'H%' select name from student where splid in (1000, 1002) select * from student where cgpa between 3 and 4 select * from student where cgpa between 3 and 4 order by cgpa ASC select avg(cgpa) from student select avg(cgpa) from student group by splid select avg(cgpa) as average from student group by splid select avg(cgpa) as average from student group by splid having avg(cgpa) > 1 delete from SPL where splid = 1003 Alter table SPL add splrating varchar(50) Alter table SPL alter column splrating int Alter table SPL drop column splrating

You might also like