Photo AI

4.1 In the tblEmployees table the ID field is intended to save the identity number of the employee, for example 012205510708 - 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-012205510708-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 012205510708. 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 012205510708 - NSC Information Technology - Question 4 - 2017 - Paper 2

Step 1

4.1.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 would mean that leading zeros in the identity number would be discarded. For example, an ID of '012345' would be saved as '12345', losing essential information.

Step 2

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

99%

104 rated

Answer

The other fields in the tblJobCards table, such as DateStarted, DateCompleted, and NumDaysTaken, can contain duplicate values. Only the JobCardNumber is unique and guarantees that each record can be uniquely identified.

Step 3

4.1.3 Motivate this suggestion.

96%

101 rated

Answer

Removing the NumDaysTaken field is valid since both DateStarted and DateCompleted fields are available. By calculating the difference between these two dates, the actual number of days taken can be derived, making the NumDaysTaken field redundant.

Step 4

4.1.4(a) The field that must be added.

98%

120 rated

Answer

EmployeeID

Step 5

4.1.4(b) The table this field must be added to.

97%

117 rated

Answer

tblJobCards

Step 6

4.2 What does verifying information entail?

97%

121 rated

Answer

Verifying information involves ensuring that the data corresponds to the original information known to the source. This could be done by cross-referencing with another trusted dataset or confirming correctness through data entry checks.

Step 7

4.3 Explain how the programmer can ensure that only valid data enters this field.

96%

114 rated

Answer

The programmer can restrict valid input for the gender field by implementing validation checks in the code. This includes using conditional statements to enforce that only 'M' or 'F' can be entered. Additionally, the program can convert input to uppercase to maintain consistency.

Step 8

4.4.1 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

4.4.2 All the brooms that were ordered have been delivered.

96%

101 rated

Answer

UPDATE tblEquipment SET Delivered = true WHERE Description = 'Broom';

Step 10

4.4.3 Display the names of the teachers who placed orders AND the total number of orders placed by each teacher.

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

;