You are on page 1of 9

Slip 1

1) Find the minimum exprinced teacher.


select t_name from teacher where experience in(select
min(experience)from teacher);

2) Add column city in student table.


alter table student add column city char(20);

OR
1) Find the subject taught by each teacher.
select distinct t_name,subject from teacher t,student_teacher x
where t.tno=x.tno ;

2) Rename table.
alter table teacher rename to teacherpvg;

Slip 2

1) Find the number of teachers having qualification “ ph.D ” .


select count (t_name) from teacher where qualification='PHD';

2) Add new column to table teacher .

OR
1) List the names of the teachers who are teaching to a student
“ Ram”.
select t_name from teacher t,student s,student_teacher x where
s.sno=x.sno and t.tno=x.tno and s_name='Ram';

2) Remove any column from table student.


Alter table table name drop column column name;

Slip 3

1) Find the names of the employee starting with ’A’ .


select e_name from employee where e_name like 'A%';
2) Remove any column from table project.
Alter table table name drop column column name;
OR
1) Find the name of employees whose duration is more than
three years.
select e_name from employee e,project p,project_employee x
where e.eno=x.eno and p.pno=x.pno and duration>='3';
2) Rename any column from employee table
alter table table name rename column name to new column
name;
Slip 4

1) Find the details of employees working on the project


“system”.
select e.eno , e.e_name , e.qualification , e.join_date from
project_employee x,employee e,project p where e.eno=x.eno
and p.pno=x.pno and p_name='System';

2) Rename table employee to employeepvg


alter table employee rename to employeepvg ;
OR
1) List the names of the first three employee in alphabetical
order.
select e_name from employee order by e_name limit 3;

2) Add new column age to table employee


alter table employee add column age int;

slip 5 and 6
1) Incease the expenses of all the trips by Rs 5000 .
update expenses set amount=amount+'5000';

2) Find the total expenses incurred by the salesman “Rahul”.


select sum(amount) from expenses e,trip t,salesman s where
s.sno=t.sno and t.tno=e.tno and s_name='Rahul';

3) Give the details for trips that exceed Rs 10,000 in expenses


select t.tno , from_city , to_city , departure_date , return_date
from trip t,expenses e where t.tno=e.tno and amount>='10000';

4) List the names of salesmaen who made trips to Mumbai.


5) select s.sno,s_name from salesman s,trip t where
s.sno=t.sno and to_city='Mumbai';

slip 7 and 8

1) Find the name of the customers in “Aundh” branch .


select cname from customer c ,branch b , BCL t where
c.cno=t.cno and b.bid=t.bid and brname='Aundh';

2) Find the maximam loan amount approved.


select max(lamtapproved) from loan_application ;

3) List the names of the customers who have received loan


less than their requiement.
select cname from customer c,loan_application l,BCL t where
c.cno=t.cno and l.lno=t.lno and lamtapproved<lamtrequired;

4) Count the number of loan applications received by “M.G


ROAD” branch.
select count(l.lno) from loan_application l , branch b , BCL
t where l.lno=t.lno and b.bid=t.bid and brname='M.G.Road';

slip 9 and 10

1) Find the item that has minmum weight.


select min(weight) from item;
2) Find the different warehouses in “PUNE

select wname from warehouse where city='Pune';

3) Find the details orders given by each customer.

select distinct cname , ono , odate from customer_w c,


orderr o where c.cno=o.cno;

4) Find the details of items ordered by a customer “soham”.

select distinct i.ino , i.description , i.weight , i.cost from item i ,


customer_w c ,orderr o, item_order io where i.ino=io.ino and
o.ono=io.ono and c.cno=o.cno and cname='Soham';

.slip 11 and 12

1) Give a 10 % raise in salary to all the employees.


UPDATE employee SET salary =salary +(salary*10/100);

2) Display average salary of an employee


3) List the details of all the departments located at city
4) Display the details of employees whose names ends with an
alphabet .

slip 13 and 14

1) Find person names income between 1000 and 30000.


select pname from person where income between '10000' and
'30000';

2) Find person numbers their income less than 30000.


select count (pno) from person where income<'30000';
Slip 15
create table trip(tno ,from_city ,to_city ,departure_date ,return_date)

create table expense(eid ,amount ,tno )

1)Increses the expenses of all trips by 5000.


2)Give the details of trips that exceed Rs.10000.
3)Drop any table .

update expense set amount=amount+'5000';

select t.tno , from_city , to_city , departure_date , return_date from


trippv t,expensespv e where t.tno=e.tno and amount>='5000';

drop table expense;

slip 16

create table salesman(sno, s_name, start_year );

create table trip(tno ,from_city , to_city , departure_date ,


return_date ,sno)

1)List the salesman numbers and names of the salesman who made
trips to "Mumbai"
2)Find the names of the salesman starting with "A"
3)Rename table salesman.

select s.sno,s_name from salesman s,trip t where s.sno=t.sno and


to_city='Mumbai';

select s_name from salesman where s_name like 'A%';

alter table salesman rename to salesmanpvg ;


slip 17

Movie ( mname , release_year , budget )

Actor ( aname ,role , charges , a_address text );

create table act_mov(aname char(30) references actor(aname) on


delete cascade, mname varchar(30) references movie mname) on
delete cascade);

1)Find the names of the actors strating with 'S'.


2)Find the details of the movies whose budget exceed 100000.
3)Rename table movie.
4)Delete any column from table actor.

select aname from actor where aname like 'P%';

select mname,release_year from movie where budget>100000;

Slip 18

1) Display the count of employees department wise.

select count(emp.eno),dname from emp,dept

where emp.eno=dept.eno

group by dname;

2) Delete the details of Employee whose designation is ‘Manager’.


Delete from emp where designation='manager';

1) Display the names of employees whose salary is greater than 50000


and department is “computer”.

select ename from emp,dept

where emp.eno=dept.eno and salary>50000 and dname='computer';

2 Add column phone_No into Emp table with data type int.

alter table emp

add phone_no int;

slip 19

2. Add column amount into Sales_order table with data type int.

alter table sales_order

add amount int;

2 Delete the details of the clients whose names start with ‘A’
character.

delete from client

where cname like'A%';

1 Display date wise sales_order given by clients.

select ordDate,ordno,amount,cno from sales_order

order by ordDate;

2 Update the address of client to “Pimpri” whose name is ‘Mr. Roy’


update client

set addr='pimpri'

where cname='Mr.Roy';

slip 20

1 Display doctor name, Hospital name and specialty of doctors from


“Pune City”

select dname,hname,speciality from doctor,hospital

where doctor.hno=hospital.hno and city='pune';

2 Delete address column from Hospital table.

Alter table hospital

Drop column addr1;

1 Display the names of the hospitals which are located at


“Pimpri” city.

select hname from hospital,doctor

where doctor.hno=hospital.hno

and city='pimpri';

2 Rename table ‘Hospital’ to ‘Birla Hospital’.

Alter table hospital rename to Birla Hospital;

You might also like