Consider the following relational database schema:
EMP contains information about employees. PROJ about projects and involved about which employees involved in which projects. The underlined attributes are the primary keys for the respective relations.
State in English (in not more than 15 words)
What the following relational algebra expressions are designed to determine
$\Pi_{eno}(\text{INVOLVED}) - \Pi_{eno} ((\Pi_{eno}(\text{INVOLVED}) \times \Pi_{pno}(\text{PROJ}))-\text{INVOLVED})$
$\Pi_{age}(\text{EMP})-\Pi_{age} (\sigma _{ E.age<Emp.age}( (\rho E(\text{EMP}) \times \text{EMP})) $
(Note: $\rho E(\text{EMP}) $ conceptually makes a copy of $\text{EMP}$ and names it $E$ ($\rho$ is called the rename operator))
$\Pi_{eno}(INVOLVED)$$-\Pi_{eno}((\Pi_{eno}(INVOLVED)\times \Pi_{pno}(PROJ)−INVOLVED)$
$\Pi_{age}(EMP)−\Pi_{age}(σ_{Eage<EMP.age}(ρE(EMP)\times EMP))$
TYPO-
πage(EMP)−Πage(σEage<EMP.age(ρE(EMP)×EMP))πage(EMP)− Age of all employees →(C)
should be
πage(EMP)- Age of all employees →(C)
I didn't get the solution of ii part.
(ii)
$=π_{age}(EMP)−π_{E.age}(E.age<EMP.age(ρE(EMP)×EMP))$
$π_{E.age}(E.age<EMP.age(ρE(EMP)×EMP))$ : Returns all ages except the youngest one
$=π_{age}(EMP)$ : All Ages
Their difference will be: All ages - (all ages except the youngest one) = Youngest Age
There overall query returns the youngest age.
chauhansunil20th $\Pi_{age} (σ_{Eage<EMP.age} (ρE(EMP)\times EMP))$ ~> Employees who have age less than at least one other employee MEANS return ALL employee except the one who's age is not less than any one MEANS all employee except the oldest one
@ register_user_19 yes, you're correct.
@shreejeetp
Even I had the same doubt.
If E.age is selected then answer is max of ages.
If Emp.age is selected then answer is min of ages.
@rohith1001 it wouldn't be min of ages if it is EMP.age. It would be rather be all the ages which are not max.
Lets take an example:
$\Pi _{E.age}(\sigma_{E.age<Emp.age}((\rho E(EMP) \times EMP))$ would give ages which is lesser than atleast one other employee's age i;e
$\Pi _{Emp.age}(\sigma_{E.age<Emp.age}((\rho E(EMP) \times EMP))$ would give ages which is greater than atleast one other employee's age i;e
Subtract the results from the emp table we get max(age) when we have E.age and min(age) when we have Emp.age.
Mitali gupta corrected
Part (i) is incorrect. Suppose an employee is not involved in any project, he/she does not have an entry in INVOLVED table. As B in your answer does not include such employees, the output also contains employees who are not involved in any project. Please correct me if I am wrong.
64.3k questions
77.9k answers
244k comments
80.0k users