Skip to main content

Activity 2.2C

1

Producing Reports

Using the solution to Activity 1.5, found in the previous section, develop a command file to create the student table and insert records into that table. Use SQL to display the entered rows.

Produce the following reports:

Report 1: details of courses given by all departments except department 'DEP02'. Sort the results by department number

Report 2: the course number and corresponding unit details offered to students following either course number 'C00111' or 'C00156' - sort the results by course number and unit number

Report 1

SELECT dept_number, course_number, course_name

FROM course

WHERE dept_number <> 'DEP02'

ORDER BY dept_number;

Output from the SELECT dept_number, course_number, course_name FROM course WHERE dept_number <> 'DEP02' ORDER BY dept_number; command

Report 2

SELECT unit_number, unit_name

FROM unit

WHERE course_number = 'C00111' OR course_number = 'C00156'

ORDER BY course number, unit number;

Output from the SELECT unit_number, unit_name FROM unit WHERE course_number = 'C00111' OR course_number = 'C00156' ORDER BY course number, unit number; command

Check your answer

Next: Activity 2.2D