You are on page 1of 2

DML Commands

1. List the names of all the packages and the amount per person in alphabetical order of package
name.
2. List the details of tours booked in the year 2010.
3. List the name(s) of tourist booked through the agency voyager in the year 2010.
4. Display the name of all the tourists, their travel dates and names of the places they are
travelling to.
5. Display the name of the agencies from the booking table.
6. Arrange the contents of the table booking in the ascending order of the travel date.
7. Display the maximum no_of_persons traveling of each travel agency.
8. Display the name of the tourist who has booked for more than 10 persons.
9. Display the name of the tourist and the total amount to be paid by him (display meaningful
column heading.
10. Display the number of booking done for each of the packages.
11. Display the name of the tourist booked for the Singapore package.
12. List the names of all tourists who have booked for the same package booked by raghavendar.
13. Display the agency name, total booking amount collected through the agency.
14. List all the package code, package name and the tourist name.
15. Display the tourist name, no of passengers, total amount to be paid and discount as 2% total
amount.
16. Display the name of the tourist who booked Simla trip on 25 th December 2010.
17. Display the total no of passengers booked through the agency ‘Voyager’.
18. Display the names of the packages booked by the tourists whose name starts with the letter ‘R’.
19. List the package details of Veena Sethi.
20. Display the total amount collected for the Singapore and Malaysia package.

TCL
1. Start Transaction,
2. Increase the package amount Goa, Manali and Simla by 2%.
3. Create a break point named A.
4. Change the name of the tourist, Lizza to Lizza Mthew.
5. Create a break point named B.
6. Advance the travel dates of the package simla by 5 days.
7. Create a break point named C.
8. Remove the booking done in the year 2010.
9. Undo all the operation till breakpoint B.
10. Complete and save the transaction.

ANSWERS
1. Select pname from package order by pname;
2. Select * from booking where year(tourdate)=2010;
3. Select pname from booking where agency=’Voyager’ and year(tourdate)=2010;
4. Select name,tdate,pname from package, booking where booking.pcode=package.pcode;
5. Select distinct agency from booking.
6. Select * from booking order by tourdate;
7. Select max(Nopersons),Agnecy from booking group by agency;
8. Select name from booking where noofpersons>10;
9. Select name, amt*noofpersons as total from booking, package where
booking.pcode=package.pcode;
10. Select count(*), name from package , booking where booking.pcode=package.pcode and group
by pname;
11. Select name, pname from booking, package where booking.pcode=package.pcode and
pname=’Singapoe’;
12. Select name,pname from booking, package where pname=(select pname from package, booking
where package.pcode=booking.pcode and name=’raghavendar’) and booking.pcode=
package.pcode;
13. Select distinct agency, sum(per_person_amt*no_of_persons) from package, bookings where
package.pcode=bookings.pcode goup by agency;
14. Select package.pname, booking.pname,booking.pcode from booking, package where
booking.pocde=package.pcode;
15. Select package.pcode, pname, touristname from booking, package where
package.pcode=bookings.pcode;
16. Select touristname from bookings, package where package.pcode=bookings.pcode and
tourdata=20101225 and pname=’simla’;
17. Select sum(no. of persons) from bookings where agency=’voyager’;
18. Select pame from package, bookings where package.pcode=bookings.pcode and tourist name
like ‘r%’;
19. Select * from booking where pname=’Veena sethi’;
20. Select (no_of_perosns*per_person_amt) from booking, package where
package.pcode=bookings.pocde and pname=’Singapore’ or pname=’Malalysia’;

TCL

1. Start transaction;
2. Update package set per_person amt=per_persom_amt*0.02;
3. Savepoint a;
4. Update booking set pname=”Lizza Mthew” where pname=”Lizza”;
5. Savepoint b;
6. Update booking set tourdate=20101220 where pcode=(select pcode from pacage where
pname=’simla’);
7. Savepoint c;
8. Delete from booking where year(tourdate=2010;
9. Roolback to b;
10. Commit;

You might also like