|
In other words:
|
|
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
The content of the relation Employee1 convey the following facts:
|
Employee1(SSN, FName, LName, PNumber, PName, Hours) into: R1 (SSN, FName, LName) R2 (PNumber, PName, Hours) |
we must also:
|
R1 = πSSN, FName, LName(Employee1) R2 = πPNumber, PName, Hours(Employee1) |
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
|
|
|
|
if ( R1 ∩ R2 != ∅ ) { reconstruction = R1 * R2 // Natural join } else { reconstruction = R1 × R2 // Cartesian product } |
|
× |
|
= |
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-11-1111 | John | Smith | pj1 | DBApplet | 5 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 20 |
111-22-3333 | Jane | Doe | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
|
Compare the content of the reconstruction to the content of the original Employee1 relation:
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
|
|
|
Employee1(SSN, FName, LName, PNumber, PName, Hours) into: R3 (SSN, FName, LName) R4 (SSN, PNumber, PName, Hours) |
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
Content of the decomposition:
|
|
|
* |
|
= |
SSN | FName | LName | PNumber | PName | Hours |
---|---|---|---|---|---|
111-11-1111 | John | Smith | pj1 | DBApplet | 20 |
111-11-1111 | John | Smith | pj2 | WebServer | 10 |
111-22-3333 | Jane | Doe | pj1 | DBApplet | 5 |
Conclusion:
|
|
where * is changed to a cartesian product if R1 ∩ R2 = ∅
|
|
|