Tutorial A (DB and SQL) Solutions
Tutorial A (DB and SQL) Solutions
E. I. Teodorescu 1
Dr E. I. Popa
UNIVERSITY of
EXERCISE 1
CREATE A simple Student System ERD (This is an individual task)
Case study – “A students(children)’ exam system “
This is a short description:
When creating a student we need to store information such as ID for unique
identification, the name, date of birth, gender, a username, password
Many exams is taken by many students. To clarify this, a student can have
many attempts for an exam and an exam can have many attempts by students.
The system should also store information about one parent of each student. A
parent can have many students and the system should store a username and
password for them so they can access the system and view their kids grades.
TO DO: design and implement a simple database for a students’ exam system which
will hold the grades for students’ attempts for particular exams
2E.DrI. E.
Teodorescu
I. 2
UNIVERSITY of
2E.DrI. E.
Teodorescu
I. 3
UNIVERSITY of
EXERCISE 2
You are required to write a set of the SQL
statements given in the following two slides.
2E.DrI. E.
Teodorescu
I. 4
UNIVERSITY of
5E.DrI. E.
Teodorescu
I. 5
UNIVERSITY of
6E.DrI. E.
Teodorescu
I. 6
UNIVERSITY of
6E.DrI. E.
Teodorescu
I. 7
UNIVERSITY of
The ParentId is an autonumber
6E.DrI. E.
Teodorescu
I. 8
UNIVERSITY of
SQL example
UPDATE Parent
SET Password='Nis67'
WHERE Username=‘paul1’;
6E.DrI. E.
Teodorescu
I. 9
UNIVERSITY of
WHERE Gender=‘Male’;
SELECT Student.FirstName
FROM Student, Parent
WHERE Parent.ParentID = Student. fkParentID
AND Parent.FirstName=‘Paul‘;
6E.DrI. E.
Teodorescu
I. 1
UNIVERSITY of
Or
6E.DrI. E.
Teodorescu
I. 1
UNIVERSITY of
Optional Challenge
Implement the ERD you created for last week’s
tutorial and write 10 useful SQL statements
6E.DrI. E.
Teodorescu
I. 1