The condition clause is a boolean expression that only uses:
|
|
|
|
|
employee: +-----------+--------+---------+----------+ | ssn | fname | lname | salary | +-----------+--------+---------+----------+ | 123456789 | John | Smith | 30000.00 | | 333445555 | Frankl | Wong | 40000.00 | | 999887777 | Alicia | Zelaya | 25000.00 | | 987654321 | Jennif | Wallace | 43000.00 | | 666884444 | Ramesh | Narayan | 38000.00 | | 453453453 | Joyce | English | 25000.00 | | 987987987 | Ahmad | Jabbar | 25000.00 | | 888665555 | James | Borg | 55000.00 | +-----------+--------+---------+----------+ |
σfname='John' AND lname='Smith'(employee) +-----------+--------+---------+----------+ | ssn | fname | lname | salary | +-----------+--------+---------+----------+ | 123456789 | John | Smith | 30000.00 | +-----------+--------+---------+----------+ |
employee × (σfname='John' AND lname='Smith'(employee)) +-----------+--------+---------+----------+-----------+--------+---------+----------+ | ssn | fname | lname | salary | ssn | fname | lname | salary | +-----------+--------+---------+----------+-----------+--------+---------+----------+ | 123456789 | John | Smith | 30000.00 | 123456789 | John | Smith | 30000.00 | | 333445555 | Frankl | Wong | 40000.00 | 123456789 | John | Smith | 30000.00 | | 999887777 | Alicia | Zelaya | 25000.00 | 123456789 | John | Smith | 30000.00 | | 987654321 | Jennif | Wallace | 43000.00 | 123456789 | John | Smith | 30000.00 | | 666884444 | Ramesh | Narayan | 38000.00 | 123456789 | John | Smith | 30000.00 | | 453453453 | Joyce | English | 25000.00 | 123456789 | John | Smith | 30000.00 | | 987987987 | Ahmad | Jabbar | 25000.00 | 123456789 | John | Smith | 30000.00 | | 888665555 | James | Borg | 55000.00 | 123456789 | John | Smith | 30000.00 | +-----------+--------+---------+----------+-----------+--------+---------+----------+ |
We can find the employees who have a higher salary than John Smith as follows:
employee ⋈salary > salary (σfname='John' AND lname='Smith'(employee)) +-----------+--------+---------+----------+-----------+--------+---------+----------+ | ssn | fname | lname | salary | ssn | fname | lname | salary | +-----------+--------+---------+----------+-----------+--------+---------+----------+ | 333445555 | Frankl | Wong | 40000.00 | 123456789 | John | Smith | 30000.00 | | 987654321 | Jennif | Wallace | 43000.00 | 123456789 | John | Smith | 30000.00 | | 666884444 | Ramesh | Narayan | 38000.00 | 123456789 | John | Smith | 30000.00 | | 888665555 | James | Borg | 55000.00 | 123456789 | John | Smith | 30000.00 | +-----------+--------+---------+----------+-----------+--------+---------+----------+ |
Employee: fname lname dnumber salary ------ -------- ----------- --------- John Smith 5 30000.00 Frankl Wong 5 40000.00 Alicia Zelaya 4 25000.00 Jennif Wallace 4 43000.00 Ramesh Narayan 5 38000.00 Joyce English 5 25000.00 Ahmad Jabbar 4 25000.00 James Borg 1 55000.00 Department: dname dnumber mgrssn mgrstartdate --------------- ----------- --------- ------------ Research 5 333445555 22-MAY-78 Administration 4 987654321 01-JAN-85 Headquarters 1 888665555 19-JUN-71 |
fname lname dnumber salary dname dnumber mgrssn mgrstartdate ------ -------- ----------- --------- --------------- ----------- --------- ------------ John Smith 5 30000.00 Research 5 333445555 22-MAY-78 Frankl Wong 5 40000.00 Research 5 333445555 22-MAY-78 Alicia Zelaya 4 25000.00 Administration 4 987654321 01-JAN-85 Jennif Wallace 4 43000.00 Administration 4 987654321 01-JAN-85 Ramesh Narayan 5 38000.00 Research 5 333445555 22-MAY-78 Joyce English 5 25000.00 Research 5 333445555 22-MAY-78 Ahmad Jabbar 4 25000.00 Administration 4 987654321 01-JAN-85 James Borg 1 55000.00 Headquarters 1 888665555 19-JUN-71 |
Notice that:
|
|
Examples:
|