Photo AI

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 icon

Question 4

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.png

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

Answer

Using an integer data type for the ID field may exclude leading zeroes from being stored, which are crucial for properly identifying the employee. For example, the ID 012345 could be stored as 12345, losing important information.

Step 2

Explain why none of the other fields in this table would be a suitable primary key.

99%

104 rated

Answer

None of the other fields can serve as primary keys because they may contain duplicate values. For instance, fields such as DateStarted or DateCompleted can have the same dates for multiple job cards, thus failing to meet the requirement of having unique values.

Step 3

Motivate this suggestion.

96%

101 rated

Answer

The NumDaysTaken field can be calculated using the DateStarted and DateCompleted fields, making it redundant. Therefore, removing it will simplify the database structure without losing important information.

Step 4

Indicate the name of: (a) The field that must be added

98%

120 rated

Answer

EmployeeID

Step 5

(b) The table this field must be added to

97%

117 rated

Answer

tblJobCards

Step 6

What does verifying information entail?

97%

121 rated

Answer

Verifying information entails ensuring that the data corresponds to the original source material and confirms correctness. This can be done through cross-checking, validation routines, and user confirmation at the point of data entry.

Step 7

Explain how the programmer can ensure, by using code, that only valid data items (M or F) will be available for use in the rest of the program.

96%

114 rated

Answer

The programmer can implement a validation function that checks the value of the gender input against predefined valid options (M or F). A common approach is to use an if-statement that verifies the input value before it is accepted into the program. For example:

if gender_input in ['M', 'F']:
    proceed_with_processing(gender_input)
else:
    prompt_for_valid_input()

Step 8

Display the OrderNum, Description and OrderDate of all orders that were placed in 2016 and not delivered yet.

99%

104 rated

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

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 field called numOrders.

98%

120 rated

Answer

SELECT Teacher, COUNT(*) AS numOrders
FROM tblClassroom
INNER JOIN tblEquipment ON tblClassroom.RoomNumber = tblEquipment.RoomNumber
GROUP BY Teacher;

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

;