MySQL Assignment Question
MySQL Assignment Question
1. Q1. Consider the following tables ACTIVITY and COACH. Write SQL commands for
the following statements.
Table: ACTIVITY
Acode ActivityName Stadium ParticipantsNum PrizeMoney ScheduleDate
1001 Relay 100 X 4 Star Annex 16 10000 23-Jan-04
1002 High Jump Star Annex 10 12000 12-Dec-03
1003 Shot Put Super 12 8000 14-Feb-04
Power
1005 Long Jump Star Annex 12 9000 01-Jan-04
1008 Discuss Throw Super 10 15000 19-Mar-04
Power
Table: COACH
PCODE NAME ACODE
1 Ahmed Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003
(i) To display the names of all activities with their Acode in descending
order.
(ii) To display sum of prizemoney for the activities played in each of the
stadium separately.
(iii) To display the coach’s names and acodes in ascending order of Acode
from the table COACH.
(iv) To display the content of all activities for which ScheduleDate is earlier
than 01-01-2004 in ascending order of ParticipentsNum.
(v) Insert a row in table coach (5,’Shyam’,1003)
2. Consider the following table GAMES. Write SQL commands for the following
statements
Table: GAMES
GCODE GAMENAME TYPE NUMBER PRIZEMONEY SCHEDULEDATE
101 CAROM INDOOR 2 5000 23-Jan-2004
BOARD
102 BADMINTON OUTDOOR 2 12000 12-Dec-2003
103 TABLE TENNIS INDOOR 4 8000 14-Feb-2004
105 CHESS INDOOR 2 9000 01-Jan-2004
108 LAWN TENNIS OUTDOOR 4 25000 19-Mar-2004
3. Consider the following table WORKER. Write SQL commands for the following
statements:
Table: WORKER
ECODE NAME DESIG PLEVEL DOJ DOB
11 Radhe shyam Supervisor P001 13-Sep-2004 23-Aug-1981
12 Chander Nath Operator P003 22-Feb-2010 12-Jul-1987
13 Fizza Operator P003 14-Jun-2009 14-Oct-1983
15 Ameen Ahmed Mechanic P002 21-Aug-2006 13-Mar-1984
18 Sanya Clerk P002 19-Dec-2005 09-Jun-1983