|
(Ignore the select command in the example)
Employee: select fname, lname, salary, dno from employee; +--------+---------+----------+-----+ | fname | lname | salary | dno | +--------+---------+----------+-----+ | John | Smith | 30000.00 | 5 | | Frankl | Wong | 40000.00 | 5 | | Alicia | Zelaya | 25000.00 | 4 | | Jennif | Wallace | 43000.00 | 4 | | Ramesh | Narayan | 38000.00 | 5 | | Joyce | English | 25000.00 | 5 | | Ahmad | Jabbar | 25000.00 | 4 | | James | Borg | 55000.00 | 1 | +--------+---------+----------+-----+ |
Notice that:
|
|
Therefore:
|
Employee × Department: +--------+---------+----------+-----+----------------+---------+ | fname | lname | salary | dno | dname | dnumber | +--------+---------+----------+-----+----------------+---------+ | John | Smith | 30000.00 | 5 | Research | 5 | | John | Smith | 30000.00 | 5 | Administration | 4 | | John | Smith | 30000.00 | 5 | Headquarters | 1 | | Frankl | Wong | 40000.00 | 5 | Research | 5 | | Frankl | Wong | 40000.00 | 5 | Administration | 4 | | Frankl | Wong | 40000.00 | 5 | Headquarters | 1 | | Alicia | Zelaya | 25000.00 | 4 | Research | 5 | | Alicia | Zelaya | 25000.00 | 4 | Administration | 4 | | Alicia | Zelaya | 25000.00 | 4 | Headquarters | 1 | | Jennif | Wallace | 43000.00 | 4 | Research | 5 | | Jennif | Wallace | 43000.00 | 4 | Administration | 4 | | Jennif | Wallace | 43000.00 | 4 | Headquarters | 1 | | Ramesh | Narayan | 38000.00 | 5 | Research | 5 | | Ramesh | Narayan | 38000.00 | 5 | Administration | 4 | | Ramesh | Narayan | 38000.00 | 5 | Headquarters | 1 | | Joyce | English | 25000.00 | 5 | Research | 5 | | Joyce | English | 25000.00 | 5 | Administration | 4 | | Joyce | English | 25000.00 | 5 | Headquarters | 1 | | Ahmad | Jabbar | 25000.00 | 4 | Research | 5 | | Ahmad | Jabbar | 25000.00 | 4 | Administration | 4 | | Ahmad | Jabbar | 25000.00 | 4 | Headquarters | 1 | | James | Borg | 55000.00 | 1 | Research | 5 | | James | Borg | 55000.00 | 1 | Administration | 4 | | James | Borg | 55000.00 | 1 | Headquarters | 1 | +--------+---------+----------+-----+----------------+---------+ |
Question:
|
Answer:
σ dno = dnumber ( Employee × Department ) |
The tuples in Employee × Department that satisfy the condition dno = dnumber are:
σ dno = dnumber ( Employee × Department ): +--------+---------+----------+-----+----------------+---------+ | fname | lname | salary | dno | dname | dnumber | +--------+---------+----------+-----+----------------+---------+ | John | Smith | 30000.00 | 5 | Research | 5 | | Frankl | Wong | 40000.00 | 5 | Research | 5 | | Alicia | Zelaya | 25000.00 | 4 | Administration | 4 | | Jennif | Wallace | 43000.00 | 4 | Administration | 4 | | Ramesh | Narayan | 38000.00 | 5 | Research | 5 | | Joyce | English | 25000.00 | 5 | Research | 5 | | Ahmad | Jabbar | 25000.00 | 4 | Administration | 4 | | James | Borg | 55000.00 | 1 | Headquarters | 1 | +--------+---------+----------+-----+----------------+---------+ |
|
R1 ⋈Cond R2 = σCond ( R1 × R2 ) |
Employee: select fname, lname, salary, dno from employee; +--------+---------+----------+-----+ | fname | lname | salary | dno | +--------+---------+----------+-----+ | John | Smith | 30000.00 | 5 | | Frankl | Wong | 40000.00 | 5 | | Alicia | Zelaya | 25000.00 | 4 | | Jennif | Wallace | 43000.00 | 4 | | Ramesh | Narayan | 38000.00 | 5 | | Joyce | English | 25000.00 | 5 | | Ahmad | Jabbar | 25000.00 | 4 | | James | Borg | 55000.00 | 1 | +--------+---------+----------+-----+ |