0% found this document useful (0 votes)
22 views6 pages

Mysql 001

1. The Library relation contains information about books in a library, including the book ID, title, author, type, publisher, quantity available, and price. 2. The data includes 8 books with details like the book ID, title, author, type of book, publisher, quantity available in the library, and price of the book. 3. The book types include programming books, database books, networking books, and operating systems books.

Uploaded by

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

Mysql 001

1. The Library relation contains information about books in a library, including the book ID, title, author, type, publisher, quantity available, and price. 2. The data includes 8 books with details like the book ID, title, author, type of book, publisher, quantity available in the library, and price of the book. 3. The book types include programming books, database books, networking books, and operating systems books.

Uploaded by

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

SET: 1

Give the following TEACHER relation:


SNo Name Age Department Dateofjoin Salary Sex
1 Jugat 34 Computer 10/01/97 12000 M
2 Sharmila 31 History 24/03/98 20000 F
3 Sandeep 32 Maths 12/12/96 30000 M
4 Sangeeta 35 History 01/07/99 40000 F
5 Rakesh 42 Maths 05/09/97 25000 M
6 Shyam 50 History 27/06/98 30000 M
7 Shiv Om 44 Computer 25/02/98 21000 M
8 Shalakha 33 Maths 31/07/97 20000 F
a. Write Query to create the table TEACHER

b. Show all the information about teachers from history department.

c. List the names of female teachers who are in history department.

d. List the name of all the teachers in the order of their joining date.

e. Display the name and age of male teachers.

f. Count the number of teachers who are older than 23 years of age.

g. Display name, age and Salary for all teacher whose salary between 10000 and 20000.

h. Display all male teachers whose age is from 30 to 40.

i. Display Name, Age and Salary of Male Teachers in the ascending order of age.

j. Change the name of teacher ‘Jugat’ to ‘Jagat’

k. Increase the salary of all teacher by Rs. 1000

l. Increase the age by Adding 1 in the age of male teachers.

Give the output of the following


a. Select name, salary , department from teacher where department = ‘History’;
b. Select name, age from teacher where name like “%a’
[1] Manish Kumar Gupta, PGT Computer Science
SET : 2
Give the following CLUB relation:
Coach_Id Coachname Age Sports Dateofapp Pay Sex
1 Kukreja 35 Karate 27/03/1996 1000 M
2 Ravina 34 Karate 20/01/1998 1200 F
3 Karan 34 Squash 19/02/1998 2000 M
4 Tarun 33 Basketball 01/01/1998 1500 M
5 Zubin 36 Swimming 12/01/1998 750 M
6 Ketaki 36 Swimming 24/02/1998 800 F
7 Ankita 39 Squash 20/02/1998 2200 F
8 Zareen 37 Karate 22/02/1998 1100 F
9 Kush 41 Swimming 13/01/1998 900 M
10 Shailya 37 Basketball 19/02/1998 1700 M
a. Write Query to make new database name Society

b. Write Query to access database society

c. Write MYSQL Query to create above table CLUB inside database society

d. Show the information about the swimming coaches in the table club.

e. List the names of all coaches in the descending order of their date of appointment.

f. Display a report showing coachname , age , and pay for all the coaches.

g. List the different types of sports are there.

h. List the total number of records are available in the table CLUB.

i. List the name of male teachers who gives karate coaching.

j. Insert a new row with the values: 11, prakash, 37, squash, 25/02/98.

k. Change the age of Kush from 41 to 39.

l. Increase the pay of Basketball player by 10%.

m. Increase the pay of Karate Player by Rs. 10

[2] Manish Kumar Gupta, PGT Computer Science


SET : 3
Give the following HOSPITAL relation:
No Name Age Department Date_adm Charges Sex
1 Zubaida 65 Surgery 21/01/99 1000 F
2 Zareena 22 ENT 12/12/98 400 F
3 Arun 34 Orthopedic 19/08/99 500 M
4 Zubin 45 Surgery 15/01/99 1550 M
5 Ketaki 12 ENT 22/02/99 400 F
6 Ankita 56 ENT 13/11/98 350 F
7 Kishore 69 Cardiology 22/09/99 2000 M
8 Shilpa 30 Surgery 21/01/99 2000 F
a. Find the Degree and Cardinality of this table Hospital.

b. Query to show the structure of above table hospital.

c. Write the query to create table Hospital in MYSQL.

d. List all the patients of the cardiology department.

e. Select all the female patients of the ENT department.

f. List all the patients in the order of their date of admission.

g. Display only the name , age ,and charges of all the female patients.

h. Count the number of patients with age<30.

i. Display the different types of department.

j. Display sum of charges for Department ENT

k. Display all patient who belong to either Surgery or ENT Department.

l. Display Name, Age & Sex of all female patients whose age is between 30 to 60 years.

m. Change the charges of Ankita from 350 to 550.

n. Show the details of all patients whose charges are 350,400,500 and 1000

Give the output of the following


a. Select name, department from hospital where charges between 350 and 400;
b. Select name, charges from hospital where sex = “M” and charges > 1000;

[3] Manish Kumar Gupta, PGT Computer Science


SET: 4
Give the following Student relation:
Sno Name Stipend Stream Avg_marks Grade Class
1 Arjun 400 Medical 78.5 B 12
2 Divya 450 Commerce 89.2 A 11
3 Dona 300 Commerce 6806 C 12
4 Varun 350 Humanities 73.1 B 12
5 Aaina 500 Nonmedical 90.6 A 11
6 John 400 Medical 75.4 B 12
7 Robert 250 Humanities 64.4 C 11
8 Bina 450 Nonmedical 88.5 A 12
9 Sameer 500 Nonmedical 92.0 A 12
10 Mohan 300 Commerce 67.5 C 12
a. List all the 12 class students .

b. List all the students sorted by average marks in the descending order.

c. Display a report listing name, stipend , stream and class of class 11 students.

d. Count the number of students with grade A.

e. Display Student Name and Class for all students who secured Grade A.

f. Display the sum of stipend of all students who have taken Medical Stream.

g. Remove all class 11 students whose grade is C.

h. Change the marks of Student Bina from 88.5 to 89.5

i. Add a new student in the table with values


(11, ‘shristi’ , 500, ‘medical’ , 91.4 , ‘A’ 12).

SET : 5
Give the following EMPLOYEE relation:
No Name Age Branch Dateofrtd Salary Sex
1 Pankaj 54 Engg. 10/01/97 1200 M
2 Shalini 41 Estbl. 24/03/98 2000 F
3 Sanjay 32 Engg. 12/12/96 3500 M
4 Sudha 25 Science 01/07/99 4700 F
5 Rakesh 32 Engg. 05/09/97 2500 M
6 Shakeel 40 Language 27/06/98 3000 M
7 Surya 44 Estbl. 25/02/97 2100 M
8 Shikha 33 Science 31/07/97 2600 F
a. Show information about the employees of the engg. Branch.

b. List the names of the female employee who are in the science branch.

c. List the names of all the employees in the order of their date of retirement.

d. Display the name , salary , age of all the male candidates.

e. Count the number of employee with age>33.

f. Change all Sex from M to Male


[4] Manish Kumar Gupta, PGT Computer Science
SET : 6
Give the following Library relation:
Bookid Title Authore Type Pub Qty Price
1001 Data Structure Lipshutz DS Mcgrow 4 217
2001 Computer Studies French FUNDA Galgotia 2 75
3001 Advanced Pascal Schildt PROG Mcgrow 4 350
4001 Dbase Dummies Palmer DBMS Pustakm 5 130
5001 Mastering C++ Gurewich PROG Bpb 3 295
6001 Guide Network Freed NET Zpress 3 200
7001 Mastering Foxpro Seigal DBMS Bpb 2 135
8001 DOS Guide Norton OS Phi 3 175
9001 Basic for Beginners Norton PROG Bpb 3 40
1010 Mastering Windows Cowart OS Bpb 1 225
a. Suggest the Primary Key for the above table Library.

b. Write MYSQL query to create above table Libarry.

c. Select all the books of type Prog published by Bpb from the table library.

d. Display a list of all the books with price more than 130 .

e. Display all the books sorted by price in the ascending order.

f. Count the number of books published by Prog.

g. Display all books published by bpb publisher arranged in the order of their price.

h. Display the details of all books published by Zpress in the descending order by price.

i. Add a new book in the table library. Fill in any values.

SET : 7
Give the following SPORTS relation:
StudentNo Class Name Game1 Grade1 Game2 Grade2
10 7 Sameer Cricket B Swimming A
11 8 Sujit Tennis A Skating C
12 7 Kamal Swimming B Football B
13 7 Veena Tennis C Tennis A
14 9 Archana Basketball A Cricket A
15 10 Arpit Cricket A Athletics C
a. Display the names of the students who have grade ‘C’ in either Game1 or Game2 or both.
b. Display the number of students getting grade ‘ A’ in cricket.
c. Display the names of the students who have same game for both Game1 and Game2.
d. Display the games taken up by the students, whose name starts with A’.
e. Arrange the whole table in the alphabetical order of name.
f. Update the grade of Sameer to ‘A’.
g. Delete the student who got grade C in grade2
h. Display name and class of all students whose name is ending with letter ‘a’.
i. Display the details of student who are tennis player and belong to class 7.

[5] Manish Kumar Gupta, PGT Computer Science


SET: 8
Give the following SCHOOL relation:
Code Tname Subject DOJ Periods Experience
1001 Ravi Shankar English 12/03/2000 24 10
1009 Priya Rai Physics 03/09/1998 26 12
1203 Lisa Anand English 09/04/2000 27 5
1045 Yasraj Maths 24/08/1997 24 15
1123 Gagan Physics 16/07/1999 28 3
1167 Harish Bhatia Chemistry 19/10/1999 27 5
1215 Umesh Physics 11/05/1998 22 16
a. To display the teacher name , periods of all teachers whose periods are more than 25.
b. To display code , teacher name and subject of all the teachers who have joined the school
after 01/01/1999.
c. To display the code,teacher name and joining date of all the teachers who are teaching Physics
d. To insert a new teacher in the table. Fill in any values.
e. To count teachers teaching subject english.
SET: 9
Give the following LIST relation:
Roll Name Eng Chem Maths Phy Comp
10 Mahesh 67 55 46 60 70
2 Sonu 68 66 57 70 64
6 Piyushi 51 56 45 54 46
5 Shreya 45 42 35 37 40
4 Mannat 62 56 46 60 42
16 John 50 48 32 46 38
12 Raj 40 38 28 33 33
17 Prateek 65 54 75 46 64
3 Vipul 75 70 86 63 80
7 Samiksha 62 63 63 64 56
a. Select students from List with marks<40 in chemistry.
b. List roll & name with marks in maths are more than 75 .
c. To count the number of students with marks less than 40 in computer.
d. Display a report listing roll , name , mark in maths & english and total of maths & english
e. Insert a new student in the list table. Fill all the columns with some values.

SET: 10
Give the following Lists relation:
Name Roll Sec Age Marks
Sagun 2 A 15 247
Gagan 4 B 14 367
Rhythm 6 C 15 293
Rohit 10 C 13 387
Sonia 26 B 12 485
Mohit 7 A 13 476
Nisha 25 B 11 466
Bobby 20 A 16 370
Pooja 15 C 15 183
Rahul 12 B 15 464
a. Select students from Class whose marks lie in the range of 200 to 300.
b. Display name , roll no. of the students with marks more than 400 and sorted by marks.
c. Display all sorted by section.
d. List all student of section A.
e. Display a report listing a name , section , marks and percentage of each student.
Calculate percentage for all the students marks/500*100.
f. Count the number of students of section C.
[6] Manish Kumar Gupta, PGT Computer Science

You might also like