Database miscellaneous
- 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(t[EmpName] = 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?
-
View Hint View Answer Discuss in Forum
Consider the each option.
(i) The results empname who does not belongs to any departments.
(ii) The results empname who does not belongs to some departments.
(iii) The results empname who belongs to same departments. All the given queries generate finite number of tuple hence all are safe query.
Hence, option (d) is correct.Correct Option: D
Consider the each option.
(i) The results empname who does not belongs to any departments.
(ii) The results empname who does not belongs to some departments.
(iii) The results empname who belongs to same departments. All the given queries generate finite number of tuple hence all are safe query.
Hence, option (d) is correct.
- Which of the following is NOT a superkey in a relational schema with attributes V,W, X, Y, Z and primary key V Y?
-
View Hint View Answer Discuss in Forum
Super key = Candidate key + other attributes. But option (b) does not include Y which is part of candidate Key.
Correct Option: B
Super key = Candidate key + other attributes. But option (b) does not include Y which is part of candidate Key.
- Let E1 and E2 be two entities in an E/R diagram with simple single valued attributes. R1 and R2 are two relationship between E1 and E2, where R1 is one-to-many and R2 is manyto-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model?
-
View Hint View Answer Discuss in Forum
Since R2 is many to many so E1 has some primary key so one tables for E1 & to represent many to many relationship 1 table for R2 which will have the common attribute of E2.R1 & E2 can be merged. So total 3 tables are required. Hence (b) is correct optionCorrect Option: B
Since R2 is many to many so E1 has some primary key so one tables for E1 & to represent many to many relationship 1 table for R2 which will have the common attribute of E2.R1 & E2 can be merged. So total 3 tables are required. Hence (b) is correct option
- Consider a join (relation algebra) between relations r (R)and s (S) using the nested loop method. There are 3 buffers each of size equal to disk block size, out of which one buffer is reserved for intermediate results. Assuming size (r (R))< size(s (S)), the join will have fewer number of disk block accesses if
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
NA
- Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation. employee (empId, empName, empAge) dependent(depId, eId, depName, depAge) Consider the following relational algebra query :
ΠempId (employee)- ΠempId (employee|X| (empId = eID)^.(empAge. depAge)dependent)
The above query evaluates to the set of empIds of employees whose age is greater than that of
-
View Hint View Answer Discuss in Forum
A gives the set of empIds of those employees whose age is less than or equal to the age of some of his/her dependents. Set of empIds of all employees - set of empIds obtained from part A gives the set of empIds of employees whose age is greater than that of all of his/ her dependents.Correct Option: D
A gives the set of empIds of those employees whose age is less than or equal to the age of some of his/her dependents. Set of empIds of all employees - set of empIds obtained from part A gives the set of empIds of employees whose age is greater than that of all of his/ her dependents.