Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId) Note that the deptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus. (I) { t |∃u ∈ EMP(tEmpName] = u[EmpName] ∧ ∀ v∈ DEPT(t[DeptId] ≠ v[DeptId]))} (II) {t |∃ u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] ≠ v[DeptId]))} (III) {t | ∃ u∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] = v[DeptId]))} Which of the above queries are safe?

Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId) Note that the deptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus. (I) { t |∃u ∈ EMP(tEmpName] = u[EmpName] ∧ ∀ v∈ DEPT(t[DeptId] ≠ v[DeptId]))} (II) {t |∃ u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] ≠ v[DeptId]))} (III) {t | ∃ u∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] = v[DeptId]))} Which of the above queries are safe? Correct Answer (I), (II) and (III)

Concept:

Safe tuple expression is the one that guaranteed to yield a finite number of tuples as its results. Otherwise, it is called unsafe.

Explanation:

∀ = for all

∃ = There exist / some

Consider the options one by one

Option 1:

 {t |∃u ∈ EMP(tEmpName] = u ∧ ∀ v∈ DEPT(t ≠ v))}

It gives all the name of employees who do not belong to the any department. Before ∧ operator, it results in finite tuples, after ∧ it results in infinite number of tuples. Finite ∧ infinite results in finite number of tuples. So, it is safe expression

Option 2:

{t |∃ u ∈ EMP(t = u ∧ ∃ v ∈ DEPT(t ≠ v))}

It gives the employee names who do not belong to some department. Before ∧ it is finite, after ∧ it is infinite. Results in a finite number of tuples. So, it is safe expression.

Option 3:

{t | ∃ u∈ EMP(t = u ∧ ∃ v ∈ DEPT(t = v))}

This expression gives the name of employees who belongs to atleast one same department. It also results in a finite expression. So, it is safe expression.

All three are safe expressions.

Related Questions

Consider the following relational schema: employee(empId,empName,empDept) customer(custId,custName,salesRepId,rating) salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C.salesRepId = E.empId AND C.rating <> ’GOOD’);
A query in the tuple relational calculus is expressed as:
The following are the conditions for selecting list of a suitable candidates to be called for interview after the written test for the recruitment is conducted/ organized for management-level persons of a multi-national company. For providing accounting services and sales the candidate must (a) be holding a graduation in basic science with 65% or above or B.E degree with 55% and above marks (b) have passed the written test with 70% or above marks (c) the age must be in the group 25 to 30 yrs as on 1/4/18 (d) have experience in an accounting firms for three yrs and diploma in accounting with 60% or above marks (e) be presently drawing CTC of 6 Lakhs per annum and above In case the applicant who satisfies all other terms above except 1) at (a) above, then be referred as Junior Accountant 2) at (d) & (e) above then be referred as Trainee-Accountant Satisfying all the above with experience of 5 yrs then be referred as senior-Accountant Satisfying all the above criteria (a-e) with CA/ ICWA/ MBA (Finance) then be refereed as manager (Accounts) Read all the above information and answer the following question: Radha Mohan has done her graduation in physics with 58% of marks. She has passed the written examination with 76% of marks. She is 27 yrs as on June 2018. She has the experience in the accounting company for four years with salary of 7 Lakhs per annum. She also has passed diploma in accounting with 61% of marks. She may be referred for the position of: