4.1 In the tblEmployees table the ID field is intended to save the identity number of the employee, for example 012205701708 - NSC Information Technology - Question 4 - 2017 - Paper 2
Question 4
4.1 In the tblEmployees table the ID field is intended to save the identity number of the employee, for example 012205701708.
Give ONE reason why it would be incorr... show full transcript
Worked Solution & Example Answer:4.1 In the tblEmployees table the ID field is intended to save the identity number of the employee, for example 012205701708 - NSC Information Technology - Question 4 - 2017 - Paper 2
Step 1
Give ONE reason why it would be incorrect for this field to be an integer data type.
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 ID field is intended to store identity numbers that may include leading zeros. Storing this as an integer would result in the loss of leading zeros, which could lead to incorrect identity representation.
Step 2
Explain why none of the other fields in this table would be a suitable primary key.
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
Other fields may contain duplicate values (e.g., DateStarted, DateCompleted), or they may not uniquely identify records, whereas only JobCardNumber ensures unique entries for each job card.
Step 3
Motivate this suggestion.
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
Since both DateStarted and DateCompleted fields are available, the number of days taken for each job can be calculated by subtracting DateStarted from DateCompleted. Therefore, storing NumDaysTaken in the database may be redundant.
Step 4
The field that must be added.
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
EmployeeID
Step 5
The table this field must be added to.
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
tblJobCards
Step 6
What does verifying information entail?
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
Verifying information entails ensuring that the entered data corresponds correctly to the original source data. It also involves checking that the data is accurate and free from errors.
Step 7
Explain how the programmer can ensure, by using code, that only valid data enters (M or F) will be available for use in the rest of the program.
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 programmer can implement input validation by restricting the input options to 'M' or 'F'. This can be achieved by using a dropdown or radio button, or by applying validation rules in the code to check and accept only these values.
Step 8
Display the OrderNum, Description and OrderDate of all orders that were placed in 2016 and not delivered yet.
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
SELECT OrderNum, Description, OrderDate
FROM tblEquipment
WHERE Delivered = false
AND Year(OrderDate) = 2016;
Step 9
All the brooms that were ordered have been delivered.
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
UPDATE tblEquipment
SET Delivered = true
WHERE Description = 'Broom';
Step 10
Display the names of the teachers who placed orders AND the total number of orders placed by each teacher. Store the calculated value in a new field called numOrders.
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
SELECT Teacher, count(*) AS numOrders
FROM tblClassroom
INNER JOIN tblEquipment ON tblClassroom.RoomNumber = tblEquipment.RoomNumber
GROUP BY Teacher;