0% found this document useful (0 votes)
64 views17 pages

Nformatics Practices - Mysql Practicals

Uploaded by

15099
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views17 pages

Nformatics Practices - Mysql Practicals

Uploaded by

15099
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

INFORMATICS PRACTICES – MYSQL

PRACTICALS
Qn1. Consider tables FLIGHTS & FARES. Write SQL commands for
the following queries
FLIGHTS:-
TABLE FARES:-

1. Display flight number and number if flights from Mumbai from the table
flights

(ii) Arrange the contents of the table flights in the descending order of destination
(iii) Increase the tax by 2% for the flights starting from Delhi

(iv) Display the flight number and fare to be paid for the flights from Mumbai to
Kochi using the table Flights &Fares, where the fare to be paid = fare+
fare*tax/100

(v) display the total no of source stations (eliminate duplicate) present in the table
(vi) display the fare for the flight from Mumbai to Bangalore

CONSIDER THE FOLLOWING TABLE SCHOOL AND ADMIN


SCHOOL:-
ADMIN:-

To display TEACHERNAME, PERIODS of all teachers whose periods less than 25.

(ii)To display TEACHERNAME, code and DESIGNATION from table


SCHOOL and ADMIN whose gender is male
(iii)To display the number of teacher in each subject

iv)To display CODE, TEACHERNAME and SUBJECT of all teachers who


have joined the school after 01/01/1999

Q. Consider table EMPLOYEE and SALARY. Write SQL commands for the
following questions
TABLE:- SALARY
(i)Display the frequency of employees
department wise.

(ii)To list the names of those employees only


whose name starts with H.

(iii)to add a new column in the salary table. The


column name is Total_sal.
(iv)To store the corresponding value in the
total_sal column
Qn. Observe the following tables and write the
queries on the basis the given table:-
TABLE :- HOSPITAL
Dno Name Age Department Charges Gender
1 Arprit 62 Surgery 300 M
2 Zarina 22 ENT 250 F
3 Kareem 32 Orthopedic 200 M
4 Arun 12 Surgery 300 M
5 Zubin 30 ENT 250 M
6 Kettaki 16 ENT 250 F
7 Ankita 29 Cardiology 800 F
8 Zareen 45 Gynecology 300 F
9 Kush 19 Cardiology 800 M
10 Shilpa 23 Nuclear Medicine 400 F
(I)To display Total number of employees present in the hospital

(ii)to display all information about the patients


of cardiology department

(iii)To list the name of female patients who are


in ENT Department
(iv)to display name and gender of all the
patients whose age is in the range of 40 to 50 in
ascending order of their name.

CLUBS
Hospital
create table Hospital(Dno int(2) Primary key, Name varchar(20), Age
int(2), Department varchar(20), Charges int(4), Gender char(1));
insert into Hospital values(1, 'Arprit', 62,'Surgery',300, 'M');
insert into Hospital values(2,'Zarina ', 22,'ENT',250, 'F');
insert into Hospital values (3, 'Kareem',32, 'Orthopaedic', 200,'M');
insert into values(4,'Arun',12,'Surgery',300,'M');
insert into Hospital values(5,'Zubin',30,'ENT',250,'M');
insert into Hospital values(6,'Kettaki',16,'ENT',250,'F');

insert into Hospital values(7,'Ankita',29,'Cardiology',800,'F');


insert into Hospital values(8,'Zareen',45,'Gynecology',300,'F');
insert into Hospital values(9,'Kush',19,'Cardiology',800,'M');
insert into Hospital values(10,'Shilpa',23,'Nuclear Medicine',400,'F');
EMPLOYEE TABLE
create table Employee (Eid int(2) primary key, Name varchar(25),
Deptid int(3), Qualification varchar(20), Sex char(1));
insert into Employee values(1, 'Deepali Gupta', 101, 'MCA', 'F');
insert into Employee values(2, 'Rajat Tyagi', 101, 'BCA', 'M');
insert into Employee values(3, 'Hari Mohan', 102, 'B.A', 'M');
insert into Employee values(4, 'Harry', 102, 'M.A', 'M');
insert into Employee values(5, 'Summit Nittal', 103, 'B.Tech', 'M');
insert into Employee values(6, 'Jyoti', 101, 'M.Tech', 'F');

SALARY TABLE:
create table Salary (Eid int(2) Primary Key, Basic int(6), DA int(4), HRA
int(4), Bonus int(4), Foreign Key(Eid) references Employee (Eid));
insert into Salary values(1, 6000, 2000,2300,200);
insert into Salary values(2, 2000,300,300,30);
insert into salary values(3, 1000,300,300,40);
insert into salary values(4, 1500,390,490,30);
insert into salary values(5, 8000,900,900,80);
insert into salary values(6, 10000,300,490,89);
FLIGHTS
create table Flights ( FNO varchar(7) Primary key, SOURCE varchar(25), DEST varchar(25),
NO_OF_F int(2), NO_OF_ST int(2), DEP_TIME int(2), dep varchar(25));
insert into FLIGHTS values( 'AM812', 'Lucknow','Delhi', 4,0,4, NULL);
insert into FLIGHTS values ('IC301',' Mumbai','Bangalore', 3,2,5, NULL);
insert into FLIGHTS values ('IC302','Mumbai','Kochi',1,4,5, NULL);
insert into FLIGHTS values ('IC799','Bangalore','Kolkata',8,3,11, NULL);
insert into FLIGHTS values ('MC101','Delhi','Varanasi',6,0,6, NULL);
insert into FLIGHTS values ('MU499','Delhi','Chennai',3,3,6, NULL );

FARES:
create table FARES ( FNO varchar(7) Primary key, Airlines varchar(25), Fares int(6),
Tax_percentage int(2));
insert into FARES values('IC799','Spice Jet', 8846, 10);
insert into FARES values('MC101','Decan Airlines', 4210,7);
insert into FARES values( 'AM812', 'Indian Airlines', 4500, 6);
insert into FARES values ('MU499','Sahara',12000,4 );
insert into FARES values ('IC302',’Jet Airways’,13894,5);
insert into FARES values ('IC301','Indian Airlines’, 9425,5);
SCHOOL:
create table School (Code int(4) Primary key, Teachername varchar(25), Subject varchar(25),
Doj date, Periods int(3), Experience int(3));
insert into school values(1009, 'Priya Rai','Physics', '1998-09-03', 26, 12);
insert into school values(1045, 'Yashraj','Maths', '2000-08-24', 24, 15);
insert into school values(1123, 'Ganan','Physics', '1999-07-16', 28, 3);
Insert into school values(1167, 'Harish B','Chemistry', '1999-10-19', 27, 5);
insert into school values(1203, 'Lisa Anand','English', '2000-04-09', 27, 5);
insert into school values(1215, 'Umesh','Physics', '1998-05-11', 22, 16);

You might also like