Photo AI

Do the following: 1 - NSC Information Technology - Question 2 - 2023 - Paper 1

Question icon

Question 2

Do-the-following:--1-NSC Information Technology-Question 2-2023-Paper 1.png

Do the following: 1. Open the incomplete project file called Question2_P.dpr in the Question 2 folder. 2. Enter your examination number as a comment in the first li... show full transcript

Worked Solution & Example Answer:Do the following: 1 - NSC Information Technology - Question 2 - 2023 - Paper 1

Step 1

Button [2.1.1 - Large enrolments]

96%

114 rated

Answer

To display all courses in the tblCourses table that can accommodate 100 or more students, the SQL query can be written as:

SELECT * FROM tblCourses
WHERE MaxStudents >= 100;

Step 2

Button [2.1.2 - Lecturer gender]

99%

104 rated

Answer

To display the LecturerName, LecturerSurname, and abbreviated gender, the SQL query would be:

SELECT LecturerName, LecturerSurname, LEFT(Gender, 1) AS [Gender (M/F)]
FROM tblLecturers;

Step 3

Button [2.1.3 - Multilingual lecturers]

96%

101 rated

Answer

To display CourseID and CourseName for courses with multilingual lecturers:

SELECT CourseID, CourseName
FROM tblCourses
WHERE tblCourses.LecturerID IN (
    SELECT LecturerID
    FROM tblLecturers
    WHERE Multilingual = TRUE
)
ORDER BY CourseName;

Step 4

Button [2.1.4 - Lecturer salaries]

98%

120 rated

Answer

To calculate the total salary for each lecturer based on their courses:

SELECT LecturerID, FORMAT(COUNT(*) * 10000, 'C', 'en-ZA') AS Salary
FROM tblCourses
GROUP BY LecturerID;

Step 5

Button [2.2.1 - Average duration of courses]

97%

117 rated

Answer

For calculating and displaying the average course duration for each lecturer:

var
  Sum, Count: Integer;
begin
  Sum := 0;
  Count := 0;
  // Loop through each lecturer
  // For each lecturer, loop through their courses
  // Sum durations and count courses
  // Display the average as: Average Duration: Sum / Count:0.00;
end;

Step 6

Button [2.2.2 - Register new lecturer]

97%

121 rated

Answer

To add a new lecturer to the tblLecturers table:

tblLecturers.Insert;
tblLecturers['LecturerID'] := 'ZT032';
tblLecturers['LecturerName'] := 'Zander';
tblLecturers['LecturerSurname'] := 'Thomas';
tblLecturers['Gender'] := 'M';
tblLecturers['Multilingual'] := True;
tblLecturers.Post;

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

;