Photo AI

The hockey organiser at your school requires your assistance with the administration of the players, teams and coaches - NSC Information Technology - Question 2 - 2019 - Paper 1

Question icon

Question 2

The-hockey-organiser-at-your-school-requires-your-assistance-with-the-administration-of-the-players,-teams-and-coaches-NSC Information Technology-Question 2-2019-Paper 1.png

The hockey organiser at your school requires your assistance with the administration of the players, teams and coaches. The database HockeyDB contains two tables ca... show full transcript

Worked Solution & Example Answer:The hockey organiser at your school requires your assistance with the administration of the players, teams and coaches - NSC Information Technology - Question 2 - 2019 - Paper 1

Step 1

2.1.1 - Best players

96%

114 rated

Answer

To find the best players, execute the following SQL query:

SELECT PlayerSurname, PlayerName FROM tblPlayers WHERE SkillsLevel = 10;

Step 2

2.1.2 - B-team coaches

99%

104 rated

Answer

To retrieve B-team coaches, use this SQL query:

SELECT Coach, TeamName FROM tblTeams WHERE TeamName LIKE "%B%";

Step 3

2.1.3 - Percentage games won

96%

101 rated

Answer

To calculate the percentage of games won, apply this query:

SELECT TeamName, Coach, (NumberOfGamesWon / NumberOfGamesPlayed * 100) AS PercentageGamesWon
FROM tblTeams WHERE TeamName = "" + TeamName;

Step 4

2.1.4 - Team average more than 6

98%

120 rated

Answer

To find teams with an average skills level greater than 6, execute this query:

SELECT TeamName, ROUND(AVG(SkillsLevel), 1) AS AverageSkillsLevel
FROM tblPlayers
GROUP BY TeamName
HAVING AVG(SkillsLevel) > 6;

Step 5

2.1.5 - Update games won

97%

117 rated

Answer

To update the number of games won for a particular team, run this SQL command:

UPDATE tblTeams
SET NumberOfGamesWon = NumberOfGamesWon + 1
WHERE TeamName <> "u/14 B";

Step 6

2.2.1 - Junior players in u/18 A team

97%

121 rated

Answer

To count the number of junior players in the u/18 A team using Delphi:

  1. Assign the tbl and Rewrite.
  2. Set tblPlayers to start reading first record.
  3. Loop while NOT tblPlayers.EOF:
    • Check if PlayerName is in "u/18 A" and if they are junior.
  4. Display the count on the label.
  5. Close the file.

Step 7

2.2.2 - Coach and goalkeeper information

96%

114 rated

Answer

To display a list of coaches and goalkeepers:

  1. Loop through tblTeams and tblPlayers respectively until EOF is reached.
  2. Check if the TeamName matches and if a goalkeeper is present.
  3. Output the relevant information in a formatted string.
  4. Next record to continue the process.

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;