Photo AI

4.1 What is the term given to the GameID field in the tblGamesPlayed table? 4.1.2 How many games will each player be able to play per day based on the construction of the database? Choose the answer from the options (A–C) provided below - NSC Information Technology - Question 4 - 2017 - Paper 2

Question icon

Question 4

4.1-What-is-the-term-given-to-the-GameID-field-in-the-tblGamesPlayed-table?--4.1.2-How-many-games-will-each-player-be-able-to-play-per-day-based-on-the-construction-of-the-database?-Choose-the-answer-from-the-options-(A–C)-provided-below-NSC Information Technology-Question 4-2017-Paper 2.png

4.1 What is the term given to the GameID field in the tblGamesPlayed table? 4.1.2 How many games will each player be able to play per day based on the construction ... show full transcript

Worked Solution & Example Answer:4.1 What is the term given to the GameID field in the tblGamesPlayed table? 4.1.2 How many games will each player be able to play per day based on the construction of the database? Choose the answer from the options (A–C) provided below - NSC Information Technology - Question 4 - 2017 - Paper 2

Step 1

What is the term given to the GameID field in the tblGamesPlayed table?

96%

114 rated

Answer

The term given to the GameID field in the tblGamesPlayed table is 'Foreign key'. This key establishes a relationship between the tblGamesPlayed and tblGames tables.

Step 2

How many games will each player be able to play per day based on the construction of the database? Choose the answer from the options (A–C) provided below.

99%

104 rated

Answer

The correct answer is C: Any number of games per day. The design of the database allows players to participate in multiple games within a single day.

Step 3

Explain why this message is displayed.

96%

101 rated

Answer

The message indicates that PlayerID F566 cannot be deleted because it is related to entries in the tblGamesPlayed table. Since the PlayerID serves as a primary key in tblPlayers, it cannot be removed while records still reference it in tblGamesPlayed.

Step 4

State a possible solution to delete a record from the tblPlayers table successfully.

98%

120 rated

Answer

To delete PlayerID F566 from the tblPlayers table successfully, all related records containing PlayerID F566 in the tblGamesPlayed table must first be deleted. Once those records are removed, the player can be safely deleted from tblPlayers.

Step 5

Display all details of the games played from 12:00 to 15:00.

97%

117 rated

Answer

The SQL statement to display all details of the games played between 12:00 and 15:00 would be:

SELECT * FROM tblGamesPlayed WHERE TimePlayed >= '12:00:00' AND TimePlayed <= '15:00:00';

Step 6

The scores for games with GameID G103 were processed incorrectly. All scores for records with this GameID must be increased by 15%.

97%

121 rated

Answer

The SQL statement to update the scores would be:

UPDATE tblGamesPlayed SET Score = Score * 1.15 WHERE GameID = 'G103';

Step 7

Explain what will be the output of the following SQL statement:

96%

114 rated

Answer

The SQL statement:

SELECT GameID, MAX(Score) as Maximum
FROM tblGamesPlayed
GROUP BY GameID
ORDER BY Max(Score) DESC;

will output the GameID along with the highest score achieved for each game in descending order. This allows for quick identification of the best-performing game.

Step 8

Write down the output of the SQL statement given below.

99%

104 rated

Answer

The SQL statement:

SELECT GameNumber, Left(PName,1) & Left(PSurname,1) & "-" AS Reference
FROM tblPlayers, tblGamesPlayed
WHERE tblPlayers.PlayerID = tblGamesPlayed.PlayerID;

will produce a result that combines the initials of the Player's name and surname followed by a hyphen, along with the GameNumber corresponding to their played game.

Step 9

Write down any two advantages of including the suggested fields in the tblPlayers table that will result in data redundancy.

96%

101 rated

Answer

  1. Including an ID number ensures that each player has a unique identifier, which prevents confusion in record-keeping.
  2. A date of birth field can help in determining player eligibility for certain age-specific competitions and may also serve as a secondary identifier.

Step 10

State TWO ways of preventing an SQL injection attack on the database by hackers.

98%

120 rated

Answer

  1. Use prepared statements or parameterized queries to ensure that all user inputs are treated safely, avoiding the execution of unauthorized SQL commands.
  2. Validate and sanitize all input data before it is processed by the database to prevent malicious entries.

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

;