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
4.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 'Foreign Key'. This is because it references the GameID from the tblGames table, establishing a relationship between the two tables.
Step 2
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.
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 correct answer is C: Any number of games per day. This is allowed because there is no restriction in the database schema that limits the number of games a player can participate in within a single day.
Step 3
4.1.3(a) 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 indicates that PlayerID F566 cannot be deleted from the tblPlayers table because it has related entries in the tblGamesPlayed table. This implies a Foreign Key constraint that prevents deletion to maintain referential integrity.
Step 4
4.1.3(b) 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
A possible solution is to first delete any entries corresponding to PlayerID F566 from the tblGamesPlayed table. Once those entries have been removed, PlayerID F566 can then be deleted from the tblPlayers table.
Step 5
4.2.1 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
To display all details of the games played in the specified time range, the SQL statement would be:
SELECT * FROM tblGamesPlayed WHERE TimePlayed >= '12:00:00' AND TimePlayed <= '15:00:00';
Step 6
4.2.2 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
The SQL statement to update the scores would be:
UPDATE tblGamesPlayed SET Score = Score * 1.15 WHERE GameID = 'G103';
Step 7
4.3.1 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
The output of the SQL statement will return the maximum score achieved for each game in the tblGamesPlayed table, and the results will be sorted in descending order based on the maximum score.
Step 8
4.3.2 Write down the output of the SQL statement given 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 output of the SQL statement will produce a list of game numbers along with the initial letters of the player's first and surname, concatenated with a space in between. The output will specifically correspond to the first record in the tblGamesPlayed table.
Step 9
4.4 Explain why adding 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 a date of birth field to the tblPlayers table will likely result in data redundancy if such information is already being stored in another table or if it can be derived from existing data. This duplication of data can lead to inconsistencies and increased storage costs.
Step 10
4.5 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
Use Prepared Statements: This involves using SQL statements that are precompiled and parameters are passed through, which can help prevent malicious SQL code from manipulating the database.
Validate Input: Ensuring that all user-supplied input is validated and sanitized before being processed can minimize the risk of SQL injections.