You are on page 1of 8

MY

SQL
Q1.
RELATION: HOTELS
Questions:-
(a) List the records of hotels in ascending order of their rating which are
situated in Mumbai.
(b) Delete all those records where hotel name contains F.
(c) Display all those records where the no of rooms are 809 or 1000 but sno
should be less than 5.
(d) Arrange the rows according to no of rooms in descending order.
(e) Change the situated place to Bikaner where rating =7 stars.
Answers:-
(a) Select * from hotels where situated=’Mumbai’ order by rating;
(b) Delete from hotels where hotels name like ‘%F%’;
(c) Select * from hotels where no of rooms between 809 and 1000 and s no
<5;
(d) Select * from hotels order by no_of_rooms desc;
(e) Update hotels set situated=’BIKANER’ where rating=’7 star’;
Q2.
RELATION: MONSTER

Questions:-
(a) To show all the information about the monsters in the above tables.
(b) To list names of all monsters with their constfee in descending order.
(c) To display a report showing monsters names, department, gender and
bonous (15% of constfee) for all monsters.
(d) To add a new column mobile number.
(e) To list the name of all the monsters where the second letter of their name
is an B.
Answers:-
(a) Select * from monster;
(b) Select name from monster order by constfee desc;
(c) Select name,dept,gender,constfee *15/100 as ’bonus’ from monster;
(d) Alter table monster add(MOBILE_NO int(10));
(e) Select name from monster where name like ‘_b%’;
Q3.
RELATION: PERSONS

Questions:-
(a) To display first name,last name of the persons whose city name contain
A or E.
(b) To display the first name of those who have minimum and maximum
person id number.
(c) To count number of persons in city pokran.
(d) Insert new row by inserting null in house no column.
(e) To list all the column in the descending order of Id and house no.
Answers:-
(a) Select first _name,last_name from persons where city like ‘%a% ‘ or
‘%e %’;
(b) Select first_name, min(person_Id),max(person_Id) from persons group
by first_name;
(c) Select count(*) from persons where city=’pokran’;
(d) Insert into persons (person_id,last_name,first_name,city)
values(55,’CHALANI’,’RASHI’,’KOLKATA’);
(e) Select * from persons order by persom_id,house_no desc;
Q4.
RELATION: CARS

Questions:-
(a) Display data for all cars where employees are between 20000 and
40000.
(b) Display foundation date of all the cars sorted by revenue.
(c) List the minimum and maximum amount of revenue.
(d) To list sno, name, revenue, foundation date in descending order of
number of employees.
(e) To count the number of cars with revenue less than 20.0920 million
euro.
Answers:-
(a) Select * from cars where no of employees between 20000 and 40000;
(b) Select founded from cars order by revenue;
(c) Select min(revenue) and max(revenue) from cars;
(d) Select sno, name, revenue, founded from cars order by no of
employees;
(e) Select count(*) from cars where revenue >=”20.0920 million euro”;
Q5.
RELATION: GRADUATE

RELATION: GUIDE

Questions:-
(a) To display the name, advisor which have guide.
(b) To display the name,average,mainarea for all the graduates whose
division>1.
(c) To display advisor for all the graduates where average=55.
(d) To display the stiphend of all the graduates whose subject is physics.
(e) To display sno,name,subject,advisor for all the graduates whose stiphend
is less than 500.
Answers:-
(a) Select
graduate.name,guide.advisor from graduate ,guide where
graduate.subject=guide.mainarea;
(b) Select graduate.name, graduate.average,guide.mainarea from graduate
,guide where graduate.division>1 and graduate. subject=guide.mainarea;
(c) Select guide.advisor from graduate,guide where graduate.average=55
and graduate.subject=guide.mainarea;
(d) Select graduate.stiphend from graduate,guide where graduate.
subject=’physics’ and graduate. subject=guide. mainarea;
(e) Select graduate.sno, graduate.subject ,guide.advisor from
graduate,guide where graduate. stiphend<500 and graduate.
subject=guide. mainarea;

You might also like