Skip to main content

Activity 2.2B

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: full names and date of births of male students born before 5 June 1977

Report 2: the name and department details of all female students born in 1978 sorted by surname and forename

Report 1

SELECT forename, surname, date_of_birth

FROM student

WHERE gender = 'M' AND date_of_birth < '05-JUN-1977';

Output from the SELECT forename, surname, date_of_birth FROM student WHERE gender = 'M' AND date_of_birth < '05-JUN-1977'; command

Report 2

SELECT title, forename, surname, dept_number, date_of_birth

FROM student

WHERE gender = 'F' AND date_of_birth > = '01-JAN-1978' AND date_of_birth <= '31-DEC-1978' ORDER BY surname, forename;

Output from the SELECT title, forename, surname, dept_number, date_of_birth FROM student WHERE gender = 'F' AND date_of_birth > = '01-JAN-1978' AND date_of_birth <= '31-DEC-1978' ORDER BY surname, forename; command

Check your answer

Next: Activity 2.2C