Midterm
Midterm
Answer: A
2. Choose the option that correctly explains in words, the function of the
following relational algebra expression: σyear≥2009 (book ⋈ borrow)
A. Selects all tuples from the Cartesian product of book and borrow
B. Selects all the tuples from the join of book and borrow wherever the year is
lesser than 2009
C. Selects all the tuples from the join of book and student wherever the year is
greater than or equal to 2009
D. Selects all tuples from the Cartesian product of book and borrow wherever
the year is greater than or equal to 2009
Answer: C
Answer: C
4. Choose the correct query to find the sum of the salaries of all employees of the
‘Research’ department, as well as the maximum salary in this department.
Select sum(salary), max (salary)
from employee join department
………………….
5. Choose the correct query to list the number of different project locations.
…………………..
From Project
A. There is no other query required
B. Select Plocation
C. Select distinct (Plocation)
D. Select count(distinct (Plocation))
Answer: D
6. Choose the correct query to retrieve the number of employees for each
department where the number of employees is greater than 10 order from the
greatest to the lowest.
Select count (Ssn)
From Project join department
Group by Dname
……………
A. None of them
B. Having count (Ssn)>10
C. Where count (Ssn)>10
D. Where Ssn >10
Answer: A
7. List the names of all employees who have a dependent with the same first
name as themselves.
Select fname
…………..
Where fname =Dname
A. None of them
B. From employee
C. From employee join dependent on Ssn=Essn
D. From dependent
Answer: C
8. A minimum number of tables are required to represent this relational model
is/are……….
A. 1
B. 2
C. 3
D. 5
Answer: B
9. Which of the following possible relations will not hold if the above ERD is mapped
into a relation model?
A. Person (NID, Name)
10.Choose the option that correctly explains in words, the function of the
following relational algebra expression: π pname (passenger ⨝ booking)
A. Select the passenger names for passengers who have bookings on.
B. Select the passenger names.
C. Select the passenger records who have bookings on flight.
Answer: A
11.Which statement explains in words, the function of the following relational
algebra expression: ρ(Ssn, Net_salary, Bonus, Tax)(π Ssn, Salary,
2000*Years_service, 0.25 * Salary (EMPLOYEE)).
A. Select the Ssn, Salary, 2000 *Years_service, 0.25 * Salary from employees.
B. Select the Ssn, Salary, 2000 *Years_service, 0.25 * Salary from employees
then rename the attributes.
C. Select the employees whose salary more than 2000.
Answer: B
12.In the relation Employee, which attribute represents the recursive relation
A. BDATE
B. SSN
C. SUPERSSN
D. DNO
E. None of the above
Answer: C
Answer C