Do the following:
1 - NSC Information Technology - Question 2 - 2023 - Paper 1
Question 2
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To display the details of all courses in the tblCourses table accommodating 100 or more students, you can use the following SQL statement:
SELECT * FROM tblCourses
WHERE MaxStudents >= 100;
Step 2
Button [2.1.2 - Lecturer gender]
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
To display the LecturerName, LecturerSurname, and calculate the first letter of the gender, use the SQL statement:
SELECT LecturerName, LecturerSurname,
LEFT(Gender, 1) AS 'Gender (M/F)'
FROM tblLecturers;
Step 3
Button [2.1.3 - Multilingual lecturers]
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
To retrieve the CourseID and CourseName of all courses that have multilingual lecturers, sort the results alphabetically by course name using the SQL statement:
SELECT CourseID, CourseName
FROM tblCourses
WHERE tblLectures.LecturerID = tblCourses.LecturerID
AND Multilingual = TRUE
ORDER BY CourseName;
Step 4
Button [2.1.4 - Lecturer salaries]
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
To calculate and display the salary of lecturers based on the number of courses they facilitate, use:
SELECT LecturerID,
FORMAT(COUNT(*) * 100000, 'C', 'en-ZA') AS Salary
FROM tblCourses
GROUP BY LecturerID;
Step 5
Button [2.2.1 - Average duration of courses]
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 calculate the average duration of courses facilitated by each lecturer, use the following approach:
Loop through all records in tblLecturers.
For each lecturer, calculate the average duration and display as follows:
foreach Lecturer in tblLecturers do
begin
totalDuration := 0;
count := 0;
writeLn(Lecturer.LecturerID + ': ' + Lecturer.LecturerName + ' ' + Lecturer.LecturerSurname);
foreach Course in tblCourses do
begin
if Course.LecturerID = Lecturer.LecturerID then
begin
totalDuration += Course.Duration;
count += 1;
writeLn(count + '. ' + Course.CourseName);
end;
end;
averageDuration := totalDuration / count;
writeLn('Average duration of courses: ' + Format('%0.2f', [averageDuration]));
end;
Step 6
Button [2.2.2 - Register new lecturer]
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
To add a new lecturer record to the tblLecturers table, use: