You are on page 1of 2

Subject no.

75

1. Indicate the correct answers:


1.) A foreign key is: (a.) an alternative to a unique identifier; (b.) a field that helps connecting
two tables; (c.) a clustered index; (d.) a candidate key; (e.) a field that uniquely identifies the
records of a table;
2.) The arity of a relation refers to: (a.) the number of clusteres indexes per table; (b.) the total
number of records; (c.) the total number of fields; (d.) the number of fields which form the
foreign key; (e.) the number of tables to which the current table is connected.
3.) The normalization process implies: (a.) the creation of some new tables within the database;
(b.) the alteration of the referential integrity rules; (c.) altering the database consistency over
time; (d.) the elimination of the redundancies and anomalies; (e.)the decrease of the width for
each table;

2. Translate the following E-R diagram into relational model, by indicating the schemes of
the resulting tables (table names and field names between round parentheses) and the
type of the relations between the resulting tables (e.g. Student-Groups 1-n; Student-
Teachers m-n):

Type
Name Since P_id Name
E_id Date_of_Birth End_Date

Employees Work Projects

3. Given the relation schemes:


Students (Stud_Id, Name, Surname, Date_of_birth)
Disciplines (Disc_Id, Name, Type)
Marks(Stud_Id, Disc_Id, Mark, Date_of_exam)
Solve the following queries in Relational Algebra:
a. Name and surname of the students who promoted the Databases exam, but didn’t
promote the Computer Programming exams.
b. Name, surname of the teachers who teach Mathematics.
c. Name and surname of the students that don't belong to the group 30222.

4. 1.) Indicate the correct answers:


If a relation is in the Boyce-Codd-Normal-Form (BCNF), then: (a.) every field is a
key; (b.) there exist partial dependencies between the non-key attributes and part of the
primary key; (c.) every determinant is a key; (d.) there are only atomic attributes in the
table; (e.) for every functional dependency X->A from R, where A is an attribute that
doesn’t belong to X, then X is a key, or includes a key from R.
2.) Consider the relation schema R(A, B, C, D, E) with functional dependencies AB → C,
C → D, C → E, D → A, E → B. State the normal form for R and describe functional
dependencies that violate higher NF. Decompose R into two (or more) relations who are
in highest possible normal form (if such thing is possible) and give for each relation of
your decomposition a minimal basis for the functional dependencies that hold in these
relations (eventually upload the file with the solution to Assignments).

5. Consider the following relation schemes:


Employees(e_id: integer, PK, name: string, age: integer, income: real)
Work(e_id: integer FK, d_id: integer FK)
Dept(d_id: integer PK, name_d: string, buget: real, manager_id: integer FK)
The primary keys (PK) and foreign keys (FK) are indicated above.
Solve the following queries in SQL:
a. Names of the employees who don’t work in any department.
b. Name of the departments and the number of employees for each department. For the
departments with no employees, the 0 value should appear.
c. Name of the department(s) having hired employees whose names begin with the ‘A’
letter.
d. Name of the employees who work in the Software department.

You might also like