Subiect Examen Baze de Date
Subiect Examen Baze de Date
72
1. Indicate the correct answers;
1.) the term domain constraint refers to: (a.) a field that has unique values at database level; (b.) a field
that has unique values at table level; (c.) an index in the database; (d.) the permitted values for a field; (e.)
the datatype associated to a field.
2.) the term entity set refers to: (a.) a set of entities having the same attributes; (b.) the whole database;
(c.) the relational model; (d.) a table in the database; (e.) the set of attributes having the same data type
within a table
3.) the term view refers to: (a.) a table within the database; (b.) a query; (c.) a virtual table defined
through a query; (d.) a part of the conceptual level of the database; (e.) the external level of the database.
Teacher
Faculty_grad_mark
Salary
ISA
4. 1.) A database in the 3rd Normal Form (3NF) if: (a.) all the attributes are atomic; (b.) there don’t exist
functional dependencies between the attributes; (c.) the database is in the Boyce-Codd-Normal-Form
(BCNF); (d.) the database is in 1NF and there don’t exsit partial dependencied between the non-key
attributes and the primary key; (e.) the database is in 2NF and there don’t exist functional dependencied
between non-key attributes;
2.) Consider the table with the following structure: Disciplines(Discipline_Id, Name, Type,
Teacher_name, Teacher_DateOfBirth). Is the database in 3NF (motivate your answer)? If the answer is no,
provide the appropriate structure modifications in order to get the 3NF.
5. Consider the following relational schema:
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer)
Dept(did: integer, dname: string, budget: real, managerid: integer)
The key fields are underlined, and the domain of each field is listed after the field name. The meaning of
these relations is straightforward; for example, an employee can work in more than one department. Write
the following queries in SQL:
a. Print that department that have the maximum number of employees.
b. Print the name and age of each employee who works in both ‘Hardware’ and ‘Software’ departments.
c. Print the name of each department and the number of the employees for each department.
d. Print the name of each employee and his average salary over the departments he works in, assuming
that employees usually work in more than 1 department.