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 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 ... 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The term given to the GameID field in the tblGamesPlayed table is a foreign key. This key references the primary key, GameID, in the tblGames table, establishing a relationship between the two 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The answer is C: Any number of games per day. The design of the database allows players to participate in multiple games without restrictions on the number of games played in a day.
Step 3
Explain why this message is displayed.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The message is displayed because PlayerID F566 exists in the tblGamesPlayed table, indicating that there are associated records. In a relational database, you cannot delete a primary key that is still being referenced by a foreign key in another table, to maintain data integrity.
Step 4
State a possible solution to delete a record from the tblPlayers table successfully.
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To delete the player with PlayerID F566, you first need to delete all related entries in the tblGamesPlayed table that reference this PlayerID. Once those records are removed, you can then delete the player from the tblPlayers table.
Step 5
Display all details of the games played from 12:00 to 15:00.
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The SQL statement for this query 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To update the scores, the SQL statement 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
This SQL statement will return the GameID and the highest score achieved for each game sorted from highest to lowest. The output will display GameIDs along with their maximum scores from the tblGamesPlayed table.
Step 8
Write down the output of the SQL statement given below, using the tblPlayers table and the first record from tblGamesPlayed table:
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
This SQL statement will return the GameNumber along with a concatenated reference name made up of the first letters of the player's PName and PSurname. The output will look something like:
GameNumber: 1, Reference: Y & X
Step 9
Write down the suggested fields to the tblPlayers table will result in data redundancy.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Adding an ID number and date of birth field could lead to data redundancy if these fields are already represented elsewhere in the system, like in a user account database or student database that maintains unique ID numbers and birth dates.
Step 10
State TWO ways of preventing an SQL injection attack on the database by hackers.
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Parameterized Queries: Use prepared statements with parameterized queries to avoid passing raw user input directly into SQL commands, thus preventing malicious injections.
Input Validation: Implement robust input validation to sanitize user inputs, ensuring that only valid data types are accepted and that dangerous characters are filtered out.