Introduction to Databases Assignment -
Learning Outcome(s):
- Define the relational model.
- Identify the appropriate primary key and foreign key in a given relation.
- Describe different types of relational model keys and their use in databases.
- Define the operations of the relational algebra.
Question One - Consider the following three relations:
For each of the following relational expressions, compute the result on the above relations and submit only the final answer. For example, for query: πB,D(S), the result should be entered as: {(a, x), (b, y), (b, x), (c, y)}.
a. πA,D(R×S)
b. πA,D(R∞S)
c. πE(T)-πE(S∞T)
a. πA,D(R×S)=?**(1, x), (1, y), (2, x), (2, y), (3, x), (3, y)**
b. πA,D(R∞S)=?**(1, x), (1, y), (2, x), (2, y), (3, y)**
c. πE(T)-πE(S∞T) =** (3) **
Question Two - Consider the Bank database:
a. What are the appropriate primary keys in each relation?
b. Given your choice of primary keys, identify appropriate foreign keys.
Question Three - Consider the relational database of instructor:
ID
|
Name
|
DOB
|
Gender
|
Dept_No
|
E101
|
Ahmed
|
15-JUL-1986
|
M
|
2
|
E103
|
Ali
|
04-MAY-1989
|
M
|
2
|
E104
|
Sara
|
29-OCT-1987
|
F
|
1
|
E102
|
Omar
|
20-MAY-1988
|
M
|
3
|
E105
|
Hind
|
23-JAN-1980
|
F
|
4
|
a. Identify at least four possible super keys?
b. Identify at least three possible candidate keys?
Question Four - Employee (Id, emp_name, age, occupation_Id, city_Id)
Occupation (occupation_id, occup_name)
City (city_id, city_name)
Consider the above relational database. Give an expression in the relational algebra to express each of the following queries:
a. Find the names and ages of all employees who work in "New York".
b. Find the names and cities of all employees who work as "Software Engineer".