0% found this document useful (0 votes)
43 views2 pages

Mysql Pract List XII

The document provides sample SQL queries and questions to practice SQL skills. It includes queries to select, insert, update, delete data from sample tables like SUPPLIERS, TRAINER, COURSE, CLUB, BOOK, and MEMBER. Questions ask to write SQL commands for various operations like selecting specific columns, filtering by conditions, sorting, aggregation, joins etc.

Uploaded by

narangdiya602
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)
43 views2 pages

Mysql Pract List XII

The document provides sample SQL queries and questions to practice SQL skills. It includes queries to select, insert, update, delete data from sample tables like SUPPLIERS, TRAINER, COURSE, CLUB, BOOK, and MEMBER. Questions ask to write SQL commands for various operations like selecting specific columns, filtering by conditions, sorting, aggregation, joins etc.

Uploaded by

narangdiya602
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/ 2

Practical List for XII (Cs_IP)

Q1-Write SQL commands for statements (i) to (viii) on the basis of the table shop SUPPLIERS.

SCODE SNAME CITY STATE AMOUNT


1001 RAJESH BHIKIWIND PUNJAB 5000
1002 RAJAT AMRITSAR PUNJAB 5400
1003 PUNEET SONIPAT HARYANA 6200
1004 RACHNA FARIDABAD HARYANA 8400
1005 RAMAN JAMUNANAGAR HARYANA 8900
1006 PRAGATI BISHRAMUR CHATTISGARH 4800
1007 PRAHALAD BABRALA UTTAR PRADESH 3000
1008 KOCHER LAKHERI RAJASTHAN 2500
(i) Show sname of suppliers whose name is starting with letter ‘P’.
(ii) Show sname, city of suppliers who belong to ‘PUNJAB’.
(iii) Show sname of suppliers in descending order.
(iv) Show sname, city, of suppliers who belong to either ‘HARYANA’ or ‘PUNJAB’.
(v) Delete the suppliers from suppliers table who belong to state ‘UTTAR PRADESH’.
(vi) Insert a new record in suppliers table with following description.
1009, ‘NEETA ARORA’, ‘DELHI’, ‘DELHI’, 7500
(vii) Insert a new column pincode to the table.
(viii) Rename the column SNAME as SUPLLIER.

Q2- Write the output of the following queries-TRAINER

Tid Tname City HireDate Salary


101 Sunaina Mumbai 1998-10-15 90000
102 Anamika Delhi 1994-12-24 80000
103 Deepti Chandigarh 2001-12-21 82000
104 Meenakshi Delhi 2002-12-25 78000
105 Richa Mumbai 1996-01-12 95000
106 Maniprabha Chennai 2001-12-12 69000
COURSE

Cid Cname Fees StartDate Tid


C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105
(i)- Display the Trainer name , city and salary in descending order of their HireDate.
(ii)- To display the Tname and city of Trainer who joined the institute in the month of December 2001.
(iii)- To display Tname, HireDate, Cname, StartDate from the tables Trainer and Course of all those courses
whose fees is less than or equal to 10000.
(iv)-To display number of Trainers from each city.
(v)- select Tid, Tname, from Trainer where city not in(‘Delhi,’Mumbai’);
(vi)- Select Distinct Tid from Course;
(vii)- Select Tid, count(*) , MIN(fees) from Course group by Tid having Count(*)>1;
(viii)- Select Count(*), Sum(fees) from Course where StartDate<’2018-09-15’;
Q3- Write SQL commands to create the table CLUB(primary key –Coach_id) and also write queries for (i) to x)
on the basis of the tables CLUB.
Coach_Id CoachName Age Sports DateofApp Pay
1 Mr. KUKREJA 35 KARATE 27/03/1996 10000
2 Ms.RAVINA 34 KARATE 20/01/1998 15000
3 Mr. KARAN 34 SWIMMING 19/02/1998 12000
4 Mr. TARUN 33 TENNIES 01/01/1999 16000
5 Mr.ZUBIN 36 SWIMMING 24/02/1999 17000
6 Ms. RUBINA 36 TENNIES 20/02/1999 18000
7 Ms. MAMTA 39 CRICKET 01/01/2001 16000
8 Ms. ZEBA 37 CRICKET 10/10/2001 12000
9 Mr. KUSH 41 KARATE 10/10/2002 15000
10 Ms. HUMA 33 SWIMMING 11/10/2003 17000
1) To show all information about the swimming coaches.
2) To show all information about female coaches in Swimming sport.
3) To display all a report showing coachname, pay age,and bonus(10% OF Pay) for all coaches.
4) To display the coach name those are joined in the year 1999
5) To display the seniority wise list in each sports
6) To reduce the pay by 500 for cricket coaches
7) To display all details having last 4 character in their name
8) To Display the total pay of all coaches sports wise
9) To Display the youngest coach.
10) To display all elder coach in each sports

Q4- Write the Sql quries for (i) to (v) and find outputs for (vi) to(viii) which are bases on the table BOOK.(write
command to create table book and Member with primary key and foreign key)

Table : BOOK
Bno Bname Type
F101 The priest Fiction
L102 German Easy Literature
C101 Tarsan in the lost world Comic
F102 Untold Story Fiction
C102 War heroes Comic

Table : Member
Mno Mname Code Issuedate
M101 Raghav L102 13-10-2016
M103 Sarthak F102 23-02-2017
M102 Anisha Khan C101 12-06-2016

i) To display all details from the Member in descending order of Issuedate.


ii) To display the Bno and Bname of all Fiction type books.
iii) To display the Type and number of book in each Type
iv) To display all the Mname and Issuedate of those members who have books issued in
year 2017
v) To display all Bname and mname of those issued a book.
vi) Select Max(Issudate) from Member;
vii) Select Bname from Book where Type not in(“Fiction”,”Comic”);
viii) Select Type , count(*) from BOOK group by Type not having count(*)>1

You might also like