0% found this document useful (0 votes)
317 views4 pages

SQL Queries for K D Ambani School

This document provides examples of SQL queries to practice on various tables. It includes queries to create 6 tables with sample data, and SQL queries to retrieve data from the tables based on conditions. The tables created are Sports_club, Teacher, MusicStore, Zoo, Sale, and icecreamparlor. For each table, insert queries and 8-10 retrieval queries are provided with different conditions on columns.

Uploaded by

Harsh Shah
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)
317 views4 pages

SQL Queries for K D Ambani School

This document provides examples of SQL queries to practice on various tables. It includes queries to create 6 tables with sample data, and SQL queries to retrieve data from the tables based on conditions. The tables created are Sports_club, Teacher, MusicStore, Zoo, Sale, and icecreamparlor. For each table, insert queries and 8-10 retrieval queries are provided with different conditions on columns.

Uploaded by

Harsh Shah
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

K D Ambani Reliance Foundation School

Session 2020-2021
Informatics Practices /Computer Science
Revision-MYSQL

1. Create the following table Sports club and insert the given rows. Write SQL queries for the following.
TABLE : Sports_club
playerid pname game price rating
1001 TOM Soccer 5000 A
1002 BOB Volleyball 5600 B
1003 JIM Basketball 6000 A
1004 SID Soccer 7000 C
1005 JOY Cricket 4500 A
1006 SAM Judo 8000 B

(i) Write the query to Create the Table Sports_club as given above
(ii) Write one insert query
(iii) Write a query to display pname, game and price whose price in range 6000 to 8000
(iv) Write a query to display details of A rated players
(v) Write a query to display the pname and game for those players who either play Soccer or Cricket or
Judo.
(vi) Write SQL to display name of the player, game and price whose name ends with M
(vii) Write the SQL query to display a report which has the details of A and B rated players
(viii)Write SQL query to display the name and game for those players whose price is greater than 6000.

2. Create the following table Teacher and insert the given rows. Write SQL queries for the following.
TABLE : Teacher
Empno Ename Dept Salary Bonus

A1101 RAM PHY 8000 500

A1102 TONY CHEM 5600

B1231 ALI PHY 6000 500

B1211 SUMA BIO 6000

C1101 RAMA CHEM 5600 300

A1345 JENNY MATH 8500


(i) Write the query to Create the Table Teacher as given above
(ii) Write one insert query
(iii) Write a query to display Ename and Dept for all Teachers who are either in PHY or in MATH
department.
(iv) Write the SQL query to list all the Teachers with their salary range 6000 to 8000
(v) Write the SQL query to display Ename, salary and bonus for teachers who are not getting any bonus.

(vi) Write a query to display Ename and Dept for all Teachers who’s Ename has M at second last
place.
(vii) Write the SQL query to list all the Teachers with their salary is greater than 6000
(viii) Write the SQL query to display Ename, salary and bonus for teachers who are getting bonus.

3. Create the following table MusicStore and insert the given rows. Write SQL queries for the following.
Table:MusicStore
Albumid Aname Singer Cost Discount

1001 Shayer Kishore 500

1002 Savera Lata 400 100

1005 Fame Lata 500

1004 Almighty Shanu 300 50

1006 Dusk Kishore 200

1008 Dawn Shanu 100 50


(i) Write the query to Create the Table Musicstore as given above
(ii) Write one insert query
(iii) Write a query to display details of all albums who are getting Discount.
(iv) Write the SQL command to list all the details of Albums with cost in the range 300 and 500.
(v) Write SQL query to display album names and Singer whose name begins with the alphabet ‘A’. (vi)
Write a query to display details of all albums who are not getting Discount.
(vii) Write the SQL command to list all the Albums with Singer either Kishore or Lata
(viii) Write SQL query to display album names and Singer whose name ends with the alphabet ‘e’.

4. Create the following table Zoo and insert the given rows. Write SQL queries for the following.
Table:Zoo
Animalid Aname Species Origin price

1 Tiger Mammal India 10000

2 Peacock Bird India 5000

3 Zebra Mammal Africa 8000

4 Kangaroo Mammal Australia 6000

5 Mamba Snake Africa 4000

6 Kiwi Bird NewZeland 4000


(i) Write the query to Create the Table Zoo as given above
(ii) Write one insert query
(iii) Write SQL query to display the Animal names who’s Species is either ‘Mammal’ or ‘Bird’.
(iv) Write the SQL query to display the Animal name , Species and Origin whose origin is India
(v) Write a query to display the Animal name, Species and price of animals whose name starts
with K.
(vi) Write SQL query to display the name of the animal, Species and price whose price is in
range 8000 to 10000.

(vii) Write the SQL query to display the name of the animal, Species and Origin whose origin is
Africa
(viii) Write a query to display the name of the animal, Species and price of animals whose
name ends with ‘a’.

5. Create the following table Sale and insert the given rows. Write SQL queries for the following.
Table:Sale
Billno Pname Quantity Rate Discount

1001 PEN 100 50 NULL

1002 PENCIL 150 10 NULL

1005 PEN 100 100 50

1004 INK 80 20 10

1006 PENCIL 70 80 NULL

1008 ERASER 40 10 NULL


(i) Write the query to Create the Table Sale as given above
(ii) Write one insert query
(iii) Write SQL query to display the products whose name ends with ‘N’.
(iv) Write the SQL query to display the sale details whose total cost (Quantity * rate) is less than
500.
(v) Write the SQL query to display the name, cost and quantity for all products that are getting
some discount.
(vi) Write SQL query to display the products whose Product name ends with ‘N’.
(vii) Write the SQL query to display the sale details whose total cost (Quantity * rate) is less than
500.
(viii) Write the SQL query to display the product , cost and quantity for all products that are getting
some discount.
(ix) Write SQL query to display the products whose name starts with ‘P’.
(x) Write the SQL query to display name of the product and rate whose quantity is in range 80 to
100.
(xi) Write the SQL query to display the name, cost and quantity for all products that are getting
some discount.

6. Create the following table icecreamparlor and insert the given rows. Write SQL queries for the
following.
TABLE : icecreamparlor
Falvourid Flavour Type Price Rating

A1 Mango Stick 20 A

A2 Straw Berry Cup 40 NULL

A3 Cassata Slice 50 B

A4 Sunde Cup 80 NULL

A5 Gudbud Cup 100 A

A6 Leechi Stick 50 NULL


(i) Write the query to Create the Table icecreamparlor as given above (ii)
Write one insert query
(iii) Write SQL query to display the flavor and price of all icecreams which have no Rating.
(iv) Write the SQL Query to display flavour and price of Stick and Slice icrecream
(v) Write SQL query to display Flavour and rating whose price is in the range 50 to 100.

You might also like