CAT 1 Database Design
CAT 1 Database Design
CAT 1
Question 1
Logical data model may be considered as a bridge between the conceptual data model (business
view) and the physical data model (developer’s view) and can be used to check whether the
actual implementation truly fulfils the requirements stated into the conceptual model.
Their differences may be, The logical data model is an abstract representation of a possible
implementation, without being bound to any specific implementation, while the conceptual data
model is a high level representation of the business requirements and the connected data sets and
relationships.
Question 2
a) Write a SQL statement to produce a list of all the records in the STUDENT table.
SQL
SELECT * FROM STUDENT;
This statement will select all the records in the STUDENT table and return them as a
result set.
b) Write a SQL statement to produce the SURNAME, FORENAME and MARK of all students
who took H2. (3marks)
SQL
SELECT SURNAME, FORENAME, MARK
FROM STUDENT
WHERE MODULE = 'H2';
This statement will select the SURNAME, FORENAME, and MARK columns for all
students who took H2.
c) Write a SQL statement to produce a list of SURNAMES of all students who scored less than
50% in any exam. (3 marks)
SQL
SELECT SURNAME
FROM STUDENT
WHERE MARKS < (50 / 100 * MAX(MARKS));
This statement will select the SURNAME column for all students who scored less than
50% in any exam. The MAX() function is used to find the maximum mark in the MARKS
column, and then 50% of that mark is subtracted to find the minimum mark that a student
could have scored and still passed.
d) Write a SQL statement produce a list of all the student SURNAMEs and the EXAM
NAME that each has taken. (3marks)
SQL
SELECT STUDENT.SURNAME, EXAM.EXAM_NAME
FROM STUDENT
INNER JOIN EXAM
ON STUDENT.MODULE = EXAM.MODULE;
This statement will join the STUDENT and EXAM tables on the MODULE column. This
will create a new table that contains the SURNAME and EXAM_NAME columns from
both tables. The result set will show all the students and the exams that they have taken.