1.

Consider the following tables ACTIVITY and COACH and answer (a) and (b) parts of this question :(a) Write SQL commands for the following statements:1. To display the names of all activities with their A codes in descending order.2. To display the sum of PrizeMoney for the Activities played in each of the Stadium separately.3. To display the coach’s name and acodes in ascending order of Acode from the table Coach.4. To display the content of the Activity table whose schedule date earlier than 01-01-2004 in ascending order of Participants Num.(b) Give the output of the following SQL queries:1. SELECT COUNT (DISTINCT Participants Num) FROM ACTIVITY;2. SELECT MAX (Schedule Date), Min (Schedule Date) FROM ACTIVITY;3. SELECT Name, Activity Name FROM ACTIVITY A, COACH CWHERE A.Acode=C.Acode AND A.Parti- cipants Num=10;4. SELECT DISTINCT Acode FROM COACH;

Answer»

(a)

1. SELECT Acodes, ActivityName FROM ACTIVITY ORDER BY ACode DESC;

2. SELECT SUM(PrizeMoney) FROM ACTIVITY GROUP BY Stadium;

3. SELECT Name, Acode FROM COACH ORDER BY Acode;

4. SELECT * FROM ACTIVITY WHERE SchduleDate < ’01-Jan-2004′ ORDER BY ParticipantsNum;

(b)

1. 3

2. 12-Dec-2003 19-Mar-2004

3. Ravinder Discuss Throw

4. 1001

1008

1003



Discussion

No Comment Found