Skip to main content

Activity 2.3A


Inserting Records

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: a list of students (i.e. student numbers and their full names) who have a student number in the range 'L0002000' and 'L0004000'

Report 2: a list of all students (i.e. student numbers and attendance dates) who attended college between 3 and 4 May 2004 - sort the results by student number within attendance date

Report 1

SELECT student_number, title, forename, surname

FROM student

WHERE student_number BETWEEN 'L0002000' AND 'L0004000';

Output from the SELECT student_number, title, forename, surname[D]

Report 2

SELECT student_number, attendance_date

FROM attendance

WHERE attended = 'P'

AND attendance_date BETWEEN '03-MAY-2004' AND '04-MAY-2004'

ORDER BY attendance_date, student_number;

Output from the SELECT student_number, attendance_date[D]

Check your answer

Next: Activity 2.3B