Relational Queries questions

Q23

GATE CS 2021 CS-1Relational QueriesNAT1 mark
A relation r(A,B)r(A, B) in a relational database has 1200 tuples. The attribute AA has integer values ranging from 6 to 20, and the attribute BB has integer values ranging from 1 to 20. Assume that the attributes AA and BB are independently distributed.
The estimated number of tuples in the output of σ(A>10)∨(B=18)(r)\sigma_{(A>10) \vee (B=18)}(r) is ______.
Show answer without attempting

Answer: 819 to 820 OR 205

Q27

GATE CS 2021 CS-1Relational QueriesMCQ2 marks−2/3 if wrong
The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
empAge(empNo‾,age)empAge(\underline{empNo}, age)
Consider the following relational algebra expression:
ΠempNo(empAge⋈(age>age1)ρempNo1, age1(empAge))\Pi_{empNo}\left(empAge \bowtie_{(age > age1)} \rho_{empNo1,\, age1}(empAge)\right)
What does the above expression generate?
Show answer without attempting

Answer: C

Q31

GATE CS 2021 CS-2Relational QueriesMCQ2 marks−2/3 if wrong
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

emp(empId‾\underline{\text{empId}}, name, gender, salary, deptId)

Consider the following SQL query:
select deptId, count(*)
from emp
where gender = "female" and salary > (select avg(salary) from emp)
group by deptId;
The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
Show answer without attempting

Answer: B

0/30 correct0 marks

Related topics in Databases