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!
== Set operators == {{main|Set theory}} The relational algebra uses [[set union]], [[set difference]], and [[Cartesian product]] from set theory, and adds additional constraints to these operators to create new ones. For set union and set difference, the two [[relation (database)|relation]]s involved must be ''union-compatible''—that is, the two relations must have the same set of attributes. Because [[set intersection]] is defined in terms of set union and set difference, the two relations involved in set intersection must also be union-compatible. For the Cartesian product to be defined, the two relations involved must have disjoint headers—that is, they must not have a common attribute name. In addition, the Cartesian product is defined differently from the one in [[Set (mathematics)|set]] theory in the sense that tuples are considered to be "shallow" for the purposes of the operation. That is, the Cartesian product of a set of ''n''-tuples with a set of ''m''-tuples yields a set of "flattened" {{math|(''n'' + ''m'')}}-tuples (whereas basic set theory would have prescribed a set of 2-tuples, each containing an ''n''-tuple and an ''m''-tuple). More formally, ''R'' × ''S'' is defined as follows: <math display=block>R\times S:=\{(r_1,r_2,\dots,r_n,s_1,s_2,\dots,s_m)|(r_1,r_2,\dots,r_n)\in R, (s_1,s_2,\dots,s_m)\in S\}</math> The cardinality of the Cartesian product is the product of the cardinalities of its factors, that is, |''R'' × ''S''| = |''R''| × |''S''|.
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)