info mysql
info mysql
create table Club(GCode int(4), GName char(11), Number int(1), Fees int(7),
StartingDate date);
i. To display the name of all games with their GCode
Ans: select GCode,GName from Club;
Output:
ii. To display details of those games which have fees more than 7000
Ans: select * from Club where Fees>7000;
Output:
iii. To display content of the club table in descending order of the start date
Ans: select * from club order by StartingDate desc:
Output:
v. List the minimum and maximum fees from the club table
Ans: select min(Fees),max(Fees) from club;
Output:
Table Flight:
Table Fares:
i. Display flight number and number of flights from mumbai from the table
flights
Ans: select FNO,No_of_flights from Flights where Source='Mumbai';
Output:
ii. Arrange the context of the table flights in descending order of destination
Ans: select * from Flights order by Dest desc;
Output:
iv. Display the flight number and fare to be paid for the flight from mumbai
to kochi using the table flights and fares where the fare to be
paid=fare+fare*tax/100
Ans: select Flights.FNO,Fares+Fares*Tax_perc/100 as 'Fares to be paid'
from Flights,Fares where Source='Mumbai' and Dest='Kochi' and
Fares.FNO=Flights.Fno;
Output:
vi. Display the fare for the flight from Mumbai to banglore
Ans: select Fares from Fares,Flights where Source='Mumbai' and
Dest='Banglore' and Fares.FNO=Flights.FNO;
Output:
viii. Display the flight number for which fare to be paid less than 3000
Ans: select FNO from Fares where Fares<3000;
Output:
ix. Display the total number of flights available for each airline
Ans: select count(No_of_flights),Airlines from Flights,Fares where
Flights.FNO=Fares.FNO group by Airlines;
Output:
x. Delete the record of flight number IC301 from the table fare
Ans: delete from Fares where FNO='IC301';
Output:
xi. Increase the size of the column ‘Source’ to 30 in the table flight
Ans:alter table Flights modify Source varchar(30);
Output:
Table Employee:
Table Salary:
ii. To list the name of those employees only whose names start with ‘H’
Ans: select Name from Employee where Name like 'H%';
Output:
Table: Hospital
iii. To list the names of all female patients who are in the ENT department.
Ans: Select Name from Hospital where Department ='ENT' and Gender='F';
Output:
iv. To display name and gender of all the patients whose age is in the range
40 to 50 in ascending order of their name.
Ans: Select Name,Gender from Hospital where Age between 40 and 50 order
by Name;
Output:
Table: School
Table: Admin
ii. To display TeacherName, Code and Designation from Table School and
Admin whose Gender is male.
Ans: Select School.code,Teachername,Designation from School Admin
where gender="Male" and School.Code=Admin.Code;
Output:
Table: Package
i. Display the name of all the tourists, their travel dates, name of the place
they are travelling to and the total amount to be paid by each tourist.
Ans: Select TouristName, sum(Per_Person_Amt * No_Of_Persons) as
Total_Amount from Bookings, Package where Bookings.PCode =
Package.PCode Group By TouristName;
Output:
ii. Display the name of all the agencies from the bookings table.
Ans: Select distinct (Agency) from Bookings;
Output:
iii. Arrange the content of the table bookings in ascending order of travel
date.
Ans: Select* from Bookings Order By Tdate;
Output:
iv. Display the maximum number of persons travelling from each travel
agency.
Ans: Select Max(No_Of_Persons),Agency from Bookings Group By
Agency;
Output: