db-class-excerpt
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionLast revision | |||
— | db-class-excerpt [2011/10/29 00:03] – dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Relational Algebra 2 ===== | ||
+ | **Union** Operator: Problem with × (cross product) and ⋈ (natural joins) is that they try to match tuples (rows) form the relations (tables). | ||
+ | |||
+ | π< | ||
+ | |||
+ | Stanford | ||
+ | Susan | ||
+ | Cornell | ||
+ | Mary | ||
+ | John | ||
+ | ... | ||
+ | |||
+ | **Difference** operator | ||
+ | |||
+ | IDs of students who didn't apply anywhere | ||
+ | |||
+ | π< | ||
+ | |||
+ | IDs **and names** of those students | ||
+ | |||
+ | π< | ||
+ | |||
+ | **Intersection** operator | ||
+ | |||
+ | Names that are both a college name and a student name: | ||
+ | |||
+ | π< | ||
+ | |||
+ | Intersection doesn' | ||
+ | |||
+ | E< | ||
+ | |||
+ | And if the schema is the same between E< | ||
+ | |||
+ | E< | ||
+ | |||
+ | **Rename** Operator (" | ||
+ | |||
+ | - ρ< | ||
+ | - ρ< | ||
+ | - ρ< | ||
+ | |||
+ | ρ< | ||
+ | |||
+ | Rename is used for disambiguation in " | ||
+ | |||
+ | **Pairs** of colleges in same state: Stanford, Berkeley; Berlekey, UCLA; ... | ||
+ | |||
+ | σ< | ||
+ | |||
+ | or | ||
+ | |||
+ | ρ< | ||
+ | |||
+ | This would give us Stanford, Stanford and Berkeley, Berkeley. So add... | ||
+ | |||
+ | σ< | ||
+ | |||
+ | We'll still get Stanford, Berkeley and Berkeley, Stanford. | ||
+ | |||
+ | σ< | ||
+ | |||
+ | Clever, eh? |
db-class-excerpt.txt · Last modified: 2023/04/12 20:44 by 127.0.0.1