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

Mysql Practice

The document provides instructions for creating and manipulating several database tables, including Sales, GARMENTS, ITEM, ACTIVITY, CLUB, and PATIENT. Each section outlines specific queries to execute, such as displaying records, filtering data based on conditions, and performing calculations like sums and averages. The document serves as a practical exercise for database management and SQL commands.

Uploaded by

geartech453
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)
7 views4 pages

Mysql Practice

The document provides instructions for creating and manipulating several database tables, including Sales, GARMENTS, ITEM, ACTIVITY, CLUB, and PATIENT. Each section outlines specific queries to execute, such as displaying records, filtering data based on conditions, and performing calculations like sums and averages. The document serves as a practical exercise for database management and SQL commands.

Uploaded by

geartech453
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/ 4

PRACTICE TIME

Create a table Sales in adatabase with your frst name and enter the records given in the table below. Ihen
write commands to do the following:
SalesmanNo SalesmanName SalesZone SalesAmount
SO01 Vinit Sarma North 150000

SO02 Aryan Barooa South 200000


SO03 Virhann Kalita North 300000
SO04 Parul Dutta East 250000

SO05 Jatin Gossain West 287000

SO06 Soumya Nath West 350000

a. Display SalesmanNo and SalesmanName of each record.


b. Display SalesmanNo and SalesAmount of North zone.
C. Display records in ascending order of SalesAmount.
d. Display records having SalesAmount in the range 200000 to 300000.
e. Display the records of salesmen whose names start with 'S.
f. Display the records of North and South zones.
g. Ihe salesmen are given commission as 1% of the SalesAmount. Display the SalesmanNo and Commission.
h. Display the number of salesmen in each zone.
Display the maximum and minimum SalesAmount.
Change the SalesAmount of SalesmanNo S001' to 450000.
IN THE LAB
1. Create a table GARMENTS with PrCode as the
primary key. Decide your own data types. Insert records as
shown in the table below and write the queries for the
following:
Table: GARMENTS
PrCode
Category Brand Price YearOfManufacture
TRO1 Trouser Richlook 4000 2016
SHO1 Shirt Peter England 900 2017
TEO1 Tie Richlook 1500 2017
TSO1 T-Shirt Puma 800 2015
TRO2 Trouser Levis 4500 2015
TEO2 Tie Peter England 1500 2016
a. Display the details of all garments in ascending order of
Priçe.
b. Display the Brand and Price of the Category
Trouser'.
c. Display the Category and Price of all the products manufactured
before 2Q16.
-d. Increase the Price of all the items by 5%.
e. Remove the details of all the garments under Levis
brand.
2. Create a table ITEM with Code as the primary key.
Decide your own data types. Insert records as shown in the
table below and write the queries to perform the following functions on
the table:
Table: ITEM
Code ItemName Company Qty Price ExpiryDate
1002 Cake Britannia 45 200 2018-01-12
1005 Biscuit Britannia 90 100 2017-12-12
1006 Jam Kissan 34 160 2018-01-23
1001 Jelly Nestle 23 150 2016-11-21
1007 Sauce Kissan 120 260 2016-02-15
1003
Maggi Nestle 80 100 2017-02-10
1004 Chocolate Cadbury 100 200 2016-12-27

232
a. Display the details of the
b. DIsplay Code and
items in: ascending order of Code.
ItemName of items that bave pricein the 170 to 20 Tais
c. Display the
d. Increase the
ltemName and Oty of allthe products expiredin 2016.
price of all the items by Rs. 5
e. Display the various
2 Create a table companies listed in the table.
ACTIVITY with own data types. Insert records as shown
in the table below and write ACode as the primary key. Decide your
the queries for the following:
Table: ACTIVITY
ACode ScheduleDate
1001
ActivityName Stadium Participants PrizeMoney
2017-09-21
Relay 100Ox4 Star Annex 16 10000
1002 2017-09-22
High jump Star Annex 10 12000
1003 Shot Put 8000 2017-09-22
Super Power 12
1005 2017-09-21
Long Jump Star Annex 12 9000
1008 Discuss Throw 15000 2017-09-20
Super Power 10
1011 Cricket 25000 2017-09-22
Kotla 14
1012 Football Dhyanchand 18 10000 2017-09-23

20000 2017-09-21
1014 Hockey Kotla 16
1017 Lawn Tennis Dhyanchand 4 17000 2017-09-22

a. Display the details of activities in descending order of PrizeMoney.


b. Display the details of ACode 1001, 1005, and 1014.
c. Display the ActivityName that has participants in the range 10 to 15.
d. Display the sum of PrizeMoney.
e. Display the various stadiums given in the table.
records as shown
4. Create a table CLUB with CoachlD as the primary key. Decide your own data types. Insert
in the table below and write the queries for the following:
Table: CLUB

CoachlD CoachName Sports DateOfApp Salary Gender


Ravinder Karate 2001-03-27 56000 M
1001
Ambika Karate 1998-01-20 30000
1002
Nitin Squash 1998-02-19 35000 M
1003
Rohit BasketbalI 1999-04-23 40000
1004
1005 Mohan Swimming 1998-02-24 30000 M

Saumya Swimming 2001-01-22 45000 F


1006
Garima Karate 2010-02-27 56000
1007
1008 Shailja Basketball 2010-05-29 35000 F

233
a. Display the sum of salaries of the female and the male coaches.
b. Display the maximum and minimum salaries of the Karate coaches.
C. Display the numbers of male and female coaches.
d. Display the details of all coaches whose name ends with a'.
e. Display the details of allthe coaches associated with sports starting with'S.
3. Create a table PATIENT with Pcode (patient code) as the primary key. Decide your own data types. Insert
records as shown in the table below and write the commands for the following:
Table: PATIENT
Pcode DOA Charge Gender
Name Age Dept
P1 Karan 24 2017-04-15 5000 M
Surgery
2017-04-16 8000 M
P2 Varun 45 Orthopaedic
P3 Ravina 12 Orthopaedic 2017-04-15 8000 F

P4 Ankita 36 2017-06-19 12000 F


Surgery
P5 Ketan 16 ENT 2017-06-18 25000 M

P6 Arvind 29 ENT 2017-07-01 15000 M


P7 Zugal 45 Cardiology 2017-08-13 14000 M

a. Display the details of all the patients under the age of 25.
Display the details of all the patients in the ENT department.
C. Display the sum of the Charge field.
d. Display the number of male and female patients.
e. Display the number of different departments given in the table.

You might also like