Mysql Practice
Mysql Practice
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
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
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
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.