Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Relational algebra
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Semijoin === The left semijoin (β and β) is a joining similar to the natural join and written as <math alt="π β π">R \ltimes S</math> where <math alt="π ">R</math> and <math alt="π">S</math> are [[relation (database)|relation]]s.{{efn|In [[Unicode]], the ltimes symbol is β (U+22C9). The rtimes symbol is β (U+22CA)}} The result is the set of all tuples in <math alt="π ">R</math> for which there is a tuple in <math alt="π">S</math> that is equal on their common attribute names. The difference from a natural join is that other columns of <math alt="π">S</math> do not appear. For example, consider the tables ''Employee'' and ''Dept'' and their semijoin:{{citation needed|date=April 2022}} {{col-begin|width=auto; margin:0.5em auto}} {{col-break}} {| class="wikitable" |+ ''Employee'' |- ! Name !! EmpId !! DeptName |- | Harry || 3415 || Finance |- | Sally || 2241 || Sales |- | George || 3401 || Finance |- | Harriet || 2202 || Production |} {{col-break|gap=2em}} {| class="wikitable" |+ ''Dept'' |- ! DeptName !! Manager |- | Sales || Sally |- | Production|| Harriet |} {{col-break|gap=2em}} {| class="wikitable" |+ ''Employee'' β ''Dept'' |- ! Name !! EmpId !! DeptName |- | Sally || 2241 || Sales |- | Harriet || 2202 || Production |} {{col-end}} More formally the semantics of the semijoin can be defined as follows: <math alt="π β π = { π‘ : π‘ β π β§β β π β π(Fun(π‘ β© π ))}">R \ltimes S = \{ t : t \in R \land \exists s \in S(\operatorname{Fun}(t \cup s)) \}</math> where <math alt="Fun(π)">\operatorname{Fun}(r)</math> is as in the definition of natural join. The semijoin can be simulated using the natural join as follows. If <math alt="a<sub>1</sub>, ..., a<sub>n</sub>">a_1, \ldots, a_n</math> are the attribute names of <math alt="π ">R</math>, then <math alt="π β π = Ξ _{a<sub>1</sub>, ..., a<sub>n</sub>} (π β π)">R \ltimes S = \Pi_{a_1, \ldots, a_n}(R \bowtie S).</math> Since we can simulate the natural join with the basic operators it follows that this also holds for the semijoin. In Codd's 1970 paper, semijoin is called restriction.<ref name="Codd1970" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)