CINXE.COM

Relational algebra - Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Relational algebra - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"fcdac51e-87ce-4d09-b68c-1fd86eb25a5c","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Relational_algebra","wgTitle":"Relational algebra","wgCurRevisionId":1257005006,"wgRevisionId":1257005006,"wgArticleId":175285,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["CS1 maint: location missing publisher","Articles with short description","Short description is different from Wikidata","Articles to be split from March 2023","All articles to be split","All articles with unsourced statements","Articles with unsourced statements from April 2022","Wikipedia external links cleanup from January 2017","Database management systems","Relational algebra","Relational model"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel" :"wikitext","wgRelevantPageName":"Relational_algebra","wgRelevantArticleId":175285,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":40000,"wgRelatedArticlesCompat":[],"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q840540","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile", "model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.math.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp", "ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.math.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.5"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Relational algebra - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Relational_algebra"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Relational_algebra&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Relational_algebra"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Relational_algebra rootpage-Relational_algebra skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Relational+algebra" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Relational+algebra" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Relational+algebra" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Relational+algebra" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Introduction" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Introduction"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Introduction</span> </div> </a> <ul id="toc-Introduction-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Set_operators" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Set_operators"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Set operators</span> </div> </a> <ul id="toc-Set_operators-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Projection" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Projection"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Projection</span> </div> </a> <ul id="toc-Projection-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Selection" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Selection"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Selection</span> </div> </a> <ul id="toc-Selection-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Rename" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Rename"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Rename</span> </div> </a> <ul id="toc-Rename-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Joins_and_join-like_operators" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Joins_and_join-like_operators"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Joins and join-like operators</span> </div> </a> <button aria-controls="toc-Joins_and_join-like_operators-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Joins and join-like operators subsection</span> </button> <ul id="toc-Joins_and_join-like_operators-sublist" class="vector-toc-list"> <li id="toc-Natural_join" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Natural_join"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.1</span> <span>Natural join</span> </div> </a> <ul id="toc-Natural_join-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-θ-join_and_equijoin" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#θ-join_and_equijoin"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.2</span> <span><i>θ</i>-join and equijoin</span> </div> </a> <ul id="toc-θ-join_and_equijoin-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Semijoin" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Semijoin"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.3</span> <span>Semijoin</span> </div> </a> <ul id="toc-Semijoin-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Antijoin" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Antijoin"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.4</span> <span>Antijoin</span> </div> </a> <ul id="toc-Antijoin-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Division" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Division"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.5</span> <span>Division</span> </div> </a> <ul id="toc-Division-sublist" class="vector-toc-list"> <li id="toc-Example" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Example"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.5.1</span> <span>Example</span> </div> </a> <ul id="toc-Example-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </li> <li id="toc-Common_extensions" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Common_extensions"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Common extensions</span> </div> </a> <button aria-controls="toc-Common_extensions-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Common extensions subsection</span> </button> <ul id="toc-Common_extensions-sublist" class="vector-toc-list"> <li id="toc-Outer_joins" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Outer_joins"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1</span> <span>Outer joins</span> </div> </a> <ul id="toc-Outer_joins-sublist" class="vector-toc-list"> <li id="toc-Left_outer_join" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Left_outer_join"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.1</span> <span>Left outer join</span> </div> </a> <ul id="toc-Left_outer_join-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Right_outer_join" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Right_outer_join"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.2</span> <span>Right outer join</span> </div> </a> <ul id="toc-Right_outer_join-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Full_outer_join" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Full_outer_join"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.3</span> <span>Full outer join</span> </div> </a> <ul id="toc-Full_outer_join-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Operations_for_domain_computations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Operations_for_domain_computations"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2</span> <span>Operations for domain computations</span> </div> </a> <ul id="toc-Operations_for_domain_computations-sublist" class="vector-toc-list"> <li id="toc-Aggregation" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Aggregation"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2.1</span> <span>Aggregation</span> </div> </a> <ul id="toc-Aggregation-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Transitive_closure" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Transitive_closure"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3</span> <span>Transitive closure</span> </div> </a> <ul id="toc-Transitive_closure-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Implementations" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Implementations"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Implementations</span> </div> </a> <ul id="toc-Implementations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">11</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Further_reading" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Further_reading"> <div class="vector-toc-text"> <span class="vector-toc-numb">12</span> <span>Further reading</span> </div> </a> <ul id="toc-Further_reading-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">13</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Relational algebra</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 28 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-28" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">28 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%A7%D9%84%D8%AC%D8%A8%D8%B1_%D8%A7%D9%84%D8%B9%D9%84%D8%A7%D8%A6%D9%82%D9%8A" title="الجبر العلائقي – Arabic" lang="ar" hreflang="ar" data-title="الجبر العلائقي" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-az mw-list-item"><a href="https://az.wikipedia.org/wiki/%C6%8Flaq%C9%99l%C9%99r_c%C9%99bri" title="Əlaqələr cəbri – Azerbaijani" lang="az" hreflang="az" data-title="Əlaqələr cəbri" data-language-autonym="Azərbaycanca" data-language-local-name="Azerbaijani" class="interlanguage-link-target"><span>Azərbaycanca</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Rela%C4%8Dn%C3%AD_algebra" title="Relační algebra – Czech" lang="cs" hreflang="cs" data-title="Relační algebra" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Relationale_Algebra" title="Relationale Algebra – German" lang="de" hreflang="de" data-title="Relationale Algebra" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/%C3%81lgebra_relacional" title="Álgebra relacional – Spanish" lang="es" hreflang="es" data-title="Álgebra relacional" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%AC%D8%A8%D8%B1_%D8%B1%D8%A7%D8%A8%D8%B7%D9%87%E2%80%8C%D8%A7%DB%8C" title="جبر رابطه‌ای – Persian" lang="fa" hreflang="fa" data-title="جبر رابطه‌ای" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Alg%C3%A8bre_relationnelle" title="Algèbre relationnelle – French" lang="fr" hreflang="fr" data-title="Algèbre relationnelle" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EA%B4%80%EA%B3%84%EB%8C%80%EC%88%98" title="관계대수 – Korean" lang="ko" hreflang="ko" data-title="관계대수" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Aljabar_relasional" title="Aljabar relasional – Indonesian" lang="id" hreflang="id" data-title="Aljabar relasional" data-language-autonym="Bahasa Indonesia" data-language-local-name="Indonesian" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/T%C3%B6flualgebra" title="Töflualgebra – Icelandic" lang="is" hreflang="is" data-title="Töflualgebra" data-language-autonym="Íslenska" data-language-local-name="Icelandic" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Algebra_relazionale" title="Algebra relazionale – Italian" lang="it" hreflang="it" data-title="Algebra relazionale" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%90%D7%9C%D7%92%D7%91%D7%A8%D7%94_%D7%A8%D7%9C%D7%A6%D7%99%D7%95%D7%A0%D7%99%D7%AA" title="אלגברה רלציונית – Hebrew" lang="he" hreflang="he" data-title="אלגברה רלציונית" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-lmo mw-list-item"><a href="https://lmo.wikipedia.org/wiki/%C3%80lgebra_relazziunala" title="Àlgebra relazziunala – Lombard" lang="lmo" hreflang="lmo" data-title="Àlgebra relazziunala" data-language-autonym="Lombard" data-language-local-name="Lombard" class="interlanguage-link-target"><span>Lombard</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Relationele_algebra" title="Relationele algebra – Dutch" lang="nl" hreflang="nl" data-title="Relationele algebra" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E9%96%A2%E4%BF%82%E4%BB%A3%E6%95%B0_(%E9%96%A2%E4%BF%82%E3%83%A2%E3%83%87%E3%83%AB)" title="関係代数 (関係モデル) – Japanese" lang="ja" hreflang="ja" data-title="関係代数 (関係モデル)" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Relasjonsalgebra" title="Relasjonsalgebra – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Relasjonsalgebra" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Rachunek_relacyjny" title="Rachunek relacyjny – Polish" lang="pl" hreflang="pl" data-title="Rachunek relacyjny" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/%C3%81lgebra_relacional" title="Álgebra relacional – Portuguese" lang="pt" hreflang="pt" data-title="Álgebra relacional" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BB%D1%8F%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D0%B0%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B0" title="Реляционная алгебра – Russian" lang="ru" hreflang="ru" data-title="Реляционная алгебра" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-si mw-list-item"><a href="https://si.wikipedia.org/wiki/%E0%B7%83%E0%B7%8F%E0%B6%B4%E0%B7%9A%E0%B6%9A%E0%B7%8A%E0%B7%82_%E0%B7%80%E0%B7%93%E0%B6%A2%E0%B7%93%E0%B6%BA%E0%B6%BA" title="සාපේක්ෂ වීජීයය – Sinhala" lang="si" hreflang="si" data-title="සාපේක්ෂ වීජීයය" data-language-autonym="සිංහල" data-language-local-name="Sinhala" class="interlanguage-link-target"><span>සිංහල</span></a></li><li class="interlanguage-link interwiki-sk mw-list-item"><a href="https://sk.wikipedia.org/wiki/Rela%C4%8Dn%C3%A1_algebra" title="Relačná algebra – Slovak" lang="sk" hreflang="sk" data-title="Relačná algebra" data-language-autonym="Slovenčina" data-language-local-name="Slovak" class="interlanguage-link-target"><span>Slovenčina</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BB%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%B0_%D0%B0%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B0" title="Релациона алгебра – Serbian" lang="sr" hreflang="sr" data-title="Релациона алгебра" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Relaatioalgebra" title="Relaatioalgebra – Finnish" lang="fi" hreflang="fi" data-title="Relaatioalgebra" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Ba%C4%9F%C4%B1nt%C4%B1sal_cebir" title="Bağıntısal cebir – Turkish" lang="tr" hreflang="tr" data-title="Bağıntısal cebir" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BB%D1%8F%D1%86%D1%96%D0%B9%D0%BD%D0%B0_%D0%B0%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B0" title="Реляційна алгебра – Ukrainian" lang="uk" hreflang="uk" data-title="Реляційна алгебра" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/%C4%90%E1%BA%A1i_s%E1%BB%91_quan_h%E1%BB%87" title="Đại số quan hệ – Vietnamese" lang="vi" hreflang="vi" data-title="Đại số quan hệ" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E9%97%9C%E4%BF%82%E4%BB%A3%E6%95%B8" title="關係代數 – Cantonese" lang="yue" hreflang="yue" data-title="關係代數" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E5%85%B3%E7%B3%BB%E4%BB%A3%E6%95%B0_(%E6%95%B0%E6%8D%AE%E5%BA%93)" title="关系代数 (数据库) – Chinese" lang="zh" hreflang="zh" data-title="关系代数 (数据库)" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q840540#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Relational_algebra" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Relational_algebra" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Relational_algebra"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Relational_algebra"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Relational_algebra" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Relational_algebra" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;oldid=1257005006" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Relational_algebra&amp;id=1257005006&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRelational_algebra"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRelational_algebra"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Relational_algebra&amp;action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Relational_algebra&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Category:Relational_algebra" hreflang="en"><span>Wikimedia Commons</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q840540" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Theory of relational databases</div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">Not to be confused with <a href="/wiki/Relation_algebra" title="Relation algebra">Relation algebra</a>.</div> <p>In <a href="/wiki/Database_theory" title="Database theory">database theory</a>, <b>relational algebra</b> is a theory that uses <a href="/wiki/Algebraic_structure" title="Algebraic structure">algebraic structures</a> for modeling data and defining queries on it with well founded <a href="/wiki/Semantics_(computer_science)" title="Semantics (computer science)">semantics</a>. The theory was introduced by <a href="/wiki/Edgar_F._Codd" title="Edgar F. Codd">Edgar F. Codd</a>.<sup id="cite_ref-Codd1970_1-0" class="reference"><a href="#cite_note-Codd1970-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> </p><p>The main application of relational algebra is to provide a theoretical foundation for <a href="/wiki/Relational_database" title="Relational database">relational databases</a>, particularly <a href="/wiki/Query_language" title="Query language">query languages</a> for such databases, chief among which is <a href="/wiki/SQL" title="SQL">SQL</a>. Relational databases store tabular data represented as <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>. Queries over relational databases often likewise return tabular data represented as relations. </p><p>The main purpose of relational algebra is to define <a href="/wiki/Operator_(mathematics)" title="Operator (mathematics)">operators</a> that transform one or more input relations to an output relation. Given that these operators accept relations as input and produce relations as output, they can be combined and used to express complex queries that transform multiple input relations (whose data are stored in the database) into a single output relation (the query results). </p><p><a href="/wiki/Unary_operator" class="mw-redirect" title="Unary operator">Unary operators</a> accept a single relation as input. Examples include operators to filter certain attributes (columns) or <a href="/wiki/Tuple" title="Tuple">tuples</a> (rows) from an input relation. <a href="/wiki/Binary_operator" class="mw-redirect" title="Binary operator">Binary operators</a> accept two relations as input and combine them into a single output relation. For example, taking all tuples found in either relation (<a href="/wiki/Union_(set_theory)" title="Union (set theory)">union</a>), removing tuples from the first relation found in the second relation (<a href="/wiki/Difference_(set_theory)" class="mw-redirect" title="Difference (set theory)">difference</a>), extending the tuples of the first relation with tuples in the second relation matching certain conditions, and so forth. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Introduction">Introduction</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=1" title="Edit section: Introduction"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Relational algebra received little attention outside of pure mathematics until the publication of <a href="/wiki/Edgar_F._Codd" title="Edgar F. Codd">E.F. Codd</a>'s <a href="/wiki/Relational_model" title="Relational model">relational model of data</a> in 1970. Codd proposed such an algebra as a basis for database query languages. </p><p>Relational algebra operates on homogeneous sets of tuples <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle S=\{(s_{j1},s_{j2},...s_{jn})|j\in 1...m\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>S</mi> <mo>=</mo> <mo fence="false" stretchy="false">{</mo> <mo stretchy="false">(</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>j</mi> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>j</mi> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>.</mo> <mo>.</mo> <mo>.</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>j</mi> <mi>n</mi> </mrow> </msub> <mo stretchy="false">)</mo> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>j</mi> <mo>&#x2208;<!-- ∈ --></mo> <mn>1...</mn> <mi>m</mi> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle S=\{(s_{j1},s_{j2},...s_{jn})|j\in 1...m\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f478a3b336a309d3236c5877d6bf3b421fc31c4b" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:32.121ex; height:3.009ex;" alt="{\displaystyle S=\{(s_{j1},s_{j2},...s_{jn})|j\in 1...m\}}"></span> where we commonly interpret <i>m</i> to be the number of rows of tuples in a table and <i>n</i> to be the number of columns. All entries in each column have the same <a href="/wiki/Data_domain" title="Data domain">type</a>. </p><p>A relation also has a unique tuple called the <b>header</b> which gives each column a unique name or <b>attribute</b> inside the relation). Attributes are used in projections and selections. </p> <div class="mw-heading mw-heading2"><h2 id="Set_operators">Set operators</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=2" title="Edit section: Set operators"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Set_theory" title="Set theory">Set theory</a></div> <p>The relational algebra uses <a href="/wiki/Set_union" class="mw-redirect" title="Set union">set union</a>, <a href="/wiki/Set_difference" class="mw-redirect" title="Set difference">set difference</a>, and <a href="/wiki/Cartesian_product" title="Cartesian product">Cartesian product</a> from set theory, and adds additional constraints to these operators to create new ones. </p><p>For set union and set difference, the two <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a> involved must be <i>union-compatible</i>—that is, the two relations must have the same set of attributes. Because <a href="/wiki/Set_intersection" class="mw-redirect" title="Set intersection">set intersection</a> is defined in terms of set union and set difference, the two relations involved in set intersection must also be union-compatible. </p><p>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. </p><p>In addition, the Cartesian product is defined differently from the one in <a href="/wiki/Set_(mathematics)" title="Set (mathematics)">set</a> 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 <i>n</i>-tuples with a set of <i>m</i>-tuples yields a set of "flattened" <span class="texhtml">(<i>n</i>&#160;+&#160;<i>m</i>)</span>-tuples (whereas basic set theory would have prescribed a set of 2-tuples, each containing an <i>n</i>-tuple and an <i>m</i>-tuple). More formally, <i>R</i> × <i>S</i> is defined as follows: </p><p><span class="mwe-math-element"><span class="mwe-math-mathml-display mwe-math-mathml-a11y" style="display: none;"><math display="block" xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 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\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> <mo>&#x00D7;<!-- × --></mo> <mi>S</mi> <mo>:=</mo> <mo fence="false" stretchy="false">{</mo> <mo stretchy="false">(</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mo stretchy="false">)</mo> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo stretchy="false">(</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo stretchy="false">)</mo> <mo>&#x2208;<!-- ∈ --></mo> <mi>R</mi> <mo>,</mo> <mo stretchy="false">(</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mo stretchy="false">)</mo> <mo>&#x2208;<!-- ∈ --></mo> <mi>S</mi> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle 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\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/fa3f152025b960f99a213cee14a6ca793e4f5cf1" class="mwe-math-fallback-image-display mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:81.165ex; height:2.843ex;" alt="{\displaystyle 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\}}"></span> </p><p>The cardinality of the Cartesian product is the product of the cardinalities of its factors, that is, |<i>R</i> × <i>S</i>| = |<i>R</i>| × |<i>S</i>|. </p> <div class="mw-heading mw-heading2"><h2 id="Projection">Projection</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=3" title="Edit section: Projection"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Projection_(relational_algebra)" title="Projection (relational algebra)">Projection (relational algebra)</a></div> <p>A <b>projection</b> (<span class="texhtml">&#928;</span>) is a <a href="/wiki/Unary_operation" title="Unary operation">unary operation</a> written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Pi _{a_{1},\ldots ,a_{n}}(R)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi mathvariant="normal">&#x03A0;<!-- Π --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Pi _{a_{1},\ldots ,a_{n}}(R)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ca7a826cf139117a870e3db396a549fa35f024ba" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:11.925ex; height:3.009ex;" alt="{\displaystyle \Pi _{a_{1},\ldots ,a_{n}}(R)}"></span> where <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle a_{1},\ldots ,a_{n}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle a_{1},\ldots ,a_{n}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/451345cc97e2ed923dd4656fcc400c3f37119cca" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:9.911ex; height:2.009ex;" alt="{\displaystyle a_{1},\ldots ,a_{n}}"></span> is a set of attribute names. The result of such projection is defined as the <a href="/wiki/Set_(mathematics)" title="Set (mathematics)">set</a> that is obtained when all <a href="/wiki/Tuple" title="Tuple">tuples</a> in <i>R</i> are restricted to the set <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \{a_{1},\ldots ,a_{n}\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo fence="false" stretchy="false">{</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \{a_{1},\ldots ,a_{n}\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f985892ccc9f753dc96b7da26722b0cb302bdcc9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:12.235ex; height:2.843ex;" alt="{\displaystyle \{a_{1},\ldots ,a_{n}\}}"></span>. </p><p>Note: when implemented in <a href="/wiki/SQL" title="SQL">SQL</a> standard the "default projection" returns a <a href="/wiki/Multiset" title="Multiset">multiset</a> instead of a set, and the <span class="texhtml">&#928;</span> projection to eliminate duplicate data is obtained by the addition of the <a href="/wiki/Select_(SQL)" title="Select (SQL)"><code>DISTINCT</code> keyword</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Selection">Selection</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=4" title="Edit section: Selection"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Selection_(relational_algebra)" title="Selection (relational algebra)">Selection (relational algebra)</a></div> <p>A <b>generalized selection</b> (&#963;) is a <a href="/wiki/Unary_operation" title="Unary operation">unary operation</a> written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma _{\varphi }(R)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mi>&#x03C6;<!-- φ --></mi> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma _{\varphi }(R)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/87ee37b1a098ac4980c9580f56a9813fc10cdba5" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:6.208ex; height:3.009ex;" alt="{\displaystyle \sigma _{\varphi }(R)}"></span> where <span class="texhtml"><i>φ</i></span> is a <a href="/wiki/Propositional_formula" title="Propositional formula">propositional formula</a> that consists of <a href="/wiki/Atomic_formula" title="Atomic formula">atoms</a> as allowed in the <a href="/wiki/Selection_(relational_algebra)" title="Selection (relational algebra)">normal selection</a> and the logical operators <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \wedge }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo>&#x2227;<!-- ∧ --></mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \wedge }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1caa4004cb216ef2930bb12fe805a76870caed94" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.55ex; height:2.009ex;" alt="{\displaystyle \wedge }"></span> (<a href="/wiki/Logical_conjunction" title="Logical conjunction">and</a>), <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \lor }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo>&#x2228;<!-- ∨ --></mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \lor }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ab47f6b1f589aedcf14638df1d63049d233d851a" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.55ex; height:2.009ex;" alt="{\displaystyle \lor }"></span> (<a href="/wiki/Logical_disjunction" title="Logical disjunction">or</a>) and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \neg }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">&#x00AC;<!-- ¬ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \neg }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/fa78fd02085d39aa58c9e47a6d4033ce41e02fad" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: 0.204ex; margin-bottom: -0.376ex; width:1.55ex; height:1.176ex;" alt="{\displaystyle \neg }"></span> (<a href="/wiki/Negation" title="Negation">negation</a>). This selection selects all those <a href="/wiki/Tuple" title="Tuple">tuples</a> in <i>R</i> for which <span class="texhtml"><i>φ</i></span> holds. </p><p>To obtain a listing of all friends or business associates in an address book, the selection might be written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma _{{\text{isFriend = true}}\,\lor \,{\text{isBusinessContact = true}}}({\text{addressBook}})}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mrow class="MJX-TeXAtom-ORD"> <mtext>isFriend = true</mtext> </mrow> <mspace width="thinmathspace" /> <mo>&#x2228;<!-- ∨ --></mo> <mspace width="thinmathspace" /> <mrow class="MJX-TeXAtom-ORD"> <mtext>isBusinessContact = true</mtext> </mrow> </mrow> </msub> <mo stretchy="false">(</mo> <mrow class="MJX-TeXAtom-ORD"> <mtext>addressBook</mtext> </mrow> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma _{{\text{isFriend = true}}\,\lor \,{\text{isBusinessContact = true}}}({\text{addressBook}})}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1143214ca89a7f741518f8fc300ceea071797735" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:47.518ex; height:2.843ex;" alt="{\displaystyle \sigma _{{\text{isFriend = true}}\,\lor \,{\text{isBusinessContact = true}}}({\text{addressBook}})}"></span>. The result would be a relation containing every attribute of every unique record where <span class="texhtml texhtml-big" style="font-size:90%;">isFriend</span> is true or where <span class="texhtml texhtml-big" style="font-size:90%;">isBusinessContact</span> is true. </p> <div class="mw-heading mw-heading2"><h2 id="Rename">Rename</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=5" title="Edit section: Rename"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Rename_(relational_algebra)" title="Rename (relational algebra)">Rename (relational algebra)</a></div> <p>A <b>rename</b> (<i>ρ</i>) is a <a href="/wiki/Unary_operation" title="Unary operation">unary operation</a> written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \rho _{a/b}(R)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <mi>b</mi> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \rho _{a/b}(R)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ff02829e7d8a0f7a89682d97acfd4bb8d73fd986" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.171ex; width:7.404ex; height:3.176ex;" alt="{\displaystyle \rho _{a/b}(R)}"></span> where the result is identical to <i>R</i> except that the <i>b</i> attribute in all tuples is renamed to an <i>a</i> attribute. This is commonly used to rename the attribute of a <a href="/wiki/Relation_(database)" title="Relation (database)">relation</a> for the purpose of a join. </p><p>To rename the "isFriend" attribute to "isBusinessContact" in a relation, <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \rho _{\text{isBusinessContact / isFriend}}({\text{addressBook}})}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mtext>isBusinessContact / isFriend</mtext> </mrow> </msub> <mo stretchy="false">(</mo> <mrow class="MJX-TeXAtom-ORD"> <mtext>addressBook</mtext> </mrow> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \rho _{\text{isBusinessContact / isFriend}}({\text{addressBook}})}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/6a017168eab17fa7c071bf730c73fc02b8546597" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.171ex; width:36.769ex; height:3.176ex;" alt="{\displaystyle \rho _{\text{isBusinessContact / isFriend}}({\text{addressBook}})}"></span> might be used. </p><p>There is also the <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \rho _{x(A_{1},\ldots ,A_{n})}(R)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo stretchy="false">(</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo stretchy="false">)</mo> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \rho _{x(A_{1},\ldots ,A_{n})}(R)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/842583f0ecaaddb48192e3c2a70e649d446d33bc" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.171ex; width:14.329ex; height:3.176ex;" alt="{\displaystyle \rho _{x(A_{1},\ldots ,A_{n})}(R)}"></span> notation, where <i>R</i> is renamed to <i>x</i> and the attributes <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \{a_{1},\ldots ,a_{n}\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo fence="false" stretchy="false">{</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \{a_{1},\ldots ,a_{n}\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f985892ccc9f753dc96b7da26722b0cb302bdcc9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:12.235ex; height:2.843ex;" alt="{\displaystyle \{a_{1},\ldots ,a_{n}\}}"></span> are renamed to <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \{A_{1},\ldots ,A_{n}\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo fence="false" stretchy="false">{</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \{A_{1},\ldots ,A_{n}\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4f59c806c483fcf623b7120c4ad8f75b2a9fecf9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.262ex; height:2.843ex;" alt="{\displaystyle \{A_{1},\ldots ,A_{n}\}}"></span>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Joins_and_join-like_operators">Joins and join-like operators</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=6" title="Edit section: Joins and join-like operators"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="plainlinks metadata ambox ambox-move" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Split-arrows.svg/50px-Split-arrows.svg.png" decoding="async" width="50" height="17" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Split-arrows.svg/75px-Split-arrows.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Split-arrows.svg/100px-Split-arrows.svg.png 2x" data-file-width="60" data-file-height="20" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">It has been suggested that this section be <a href="/wiki/Wikipedia:Splitting" title="Wikipedia:Splitting">split</a> out into another article&#32;titled <i><a href="/wiki/Join_(relational_algebra)" class="mw-redirect" title="Join (relational algebra)">Join (relational algebra)</a></i>. (<a href="/wiki/Talk:Relational_algebra#Split_join_into_its_own_article" title="Talk:Relational algebra">Discuss</a>) <small><i>(March 2023)</i></small></div></td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="Natural_join">Natural join</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=7" title="Edit section: Natural join"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">"Natural join" redirects here. For the SQL implementation, see <a href="/wiki/Natural_join_(SQL)" class="mw-redirect" title="Natural join (SQL)">Natural join (SQL)</a>.</div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">"⋈" redirects here. For the band sometimes represented by this symbol, see <a href="/wiki/The_Armed" title="The Armed">The Armed</a>.</div> <p>Natural join (⨝) is a <a href="/wiki/Binary_relation" title="Binary relation">binary operator</a> that is written as (<i>R</i> ⨝ <i>S</i>) where <i>R</i> and <i>S</i> are <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">&#91;</span>a<span class="cite-bracket">&#93;</span></a></sup> The result of the natural join is the set of all combinations of tuples in <i>R</i> and <i>S</i> that are equal on their common attribute names. For an example consider the tables <i>Employee</i> and <i>Dept</i> and their natural join:<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p> <style data-mw-deduplicate="TemplateStyles:r1216972533">.mw-parser-output .col-begin{border-collapse:collapse;padding:0;color:inherit;width:100%;border:0;margin:0}.mw-parser-output .col-begin-small{font-size:90%}.mw-parser-output .col-break{vertical-align:top;text-align:left}.mw-parser-output .col-break-2{width:50%}.mw-parser-output .col-break-3{width:33.3%}.mw-parser-output .col-break-4{width:25%}.mw-parser-output .col-break-5{width:20%}@media(max-width:720px){.mw-parser-output .col-begin,.mw-parser-output .col-begin>tbody,.mw-parser-output .col-begin>tbody>tr,.mw-parser-output .col-begin>tbody>tr>td{display:block!important;width:100%!important}.mw-parser-output .col-break{padding-left:0!important}}</style><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales </td></tr> <tr> <td>Mary</td> <td>1257</td> <td>Human Resources </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Finance</td> <td>George </td></tr> <tr> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Production</td> <td>Charles </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i>&#160;⨝&#160;<i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance</td> <td>George </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance</td> <td>George </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales</td> <td>Harriet </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>Note that neither the employee named Mary nor the Production department appear in the result. </p><p>This can also be used to define <a href="/wiki/Composition_of_relations" title="Composition of relations">composition of relations</a>. For example, the composition of <i>Employee</i> and <i>Dept</i> is their join as shown above, projected on all but the common attribute <i>DeptName</i>. In <a href="/wiki/Category_theory" title="Category theory">category theory</a>, the join is precisely the <a href="/wiki/Fiber_product" class="mw-redirect" title="Fiber product">fiber product</a>. </p><p>The natural join is arguably one of the most important operators since it is the relational counterpart of the logical AND operator. Note that if the same variable appears in each of two predicates that are connected by AND, then that variable stands for the same thing and both appearances must always be substituted by the same value (this is a consequence of the <a href="/wiki/Idempotence" title="Idempotence">idempotence</a> of the logical AND). In particular, natural join allows the combination of relations that are associated by a <a href="/wiki/Foreign_key" title="Foreign key">foreign key</a>. For example, in the above example a foreign key probably holds from <i>Employee</i>.<i>DeptName</i> to <i>Dept</i>.<i>DeptName</i> and then the natural join of <i>Employee</i> and <i>Dept</i> combines all employees with their departments. This works because the foreign key holds between attributes with the same name. If this is not the case such as in the foreign key from <i>Dept</i>.<i>Manager</i> to <i>Employee</i>.<i>Name</i> then these columns must be renamed before taking the natural join. Such a join is sometimes also referred to as an <b>equijoin</b>. </p><p>More formally the semantics of the natural join are defined as follows: </p> <table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R\bowtie S=\left\{r\cup s\ \vert \ r\in R\ \land \ s\in S\ \land \ {\mathit {Fun}}(r\cup s)\right\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo>=</mo> <mrow> <mo>{</mo> <mrow> <mi>r</mi> <mo>&#x222A;<!-- ∪ --></mo> <mi>s</mi> <mtext>&#xA0;</mtext> <mo fence="false" stretchy="false">|</mo> <mtext>&#xA0;</mtext> <mi>r</mi> <mo>&#x2208;<!-- ∈ --></mo> <mi>R</mi> <mtext>&#xA0;</mtext> <mo>&#x2227;<!-- ∧ --></mo> <mtext>&#xA0;</mtext> <mi>s</mi> <mo>&#x2208;<!-- ∈ --></mo> <mi>S</mi> <mtext>&#xA0;</mtext> <mo>&#x2227;<!-- ∧ --></mo> <mtext>&#xA0;</mtext> <mrow class="MJX-TeXAtom-ORD"> <mrow class="MJX-TeXAtom-ORD"> <mi class="MJX-tex-mathit" mathvariant="italic">F</mi> <mi class="MJX-tex-mathit" mathvariant="italic">u</mi> <mi class="MJX-tex-mathit" mathvariant="italic">n</mi> </mrow> </mrow> <mo stretchy="false">(</mo> <mi>r</mi> <mo>&#x222A;<!-- ∪ --></mo> <mi>s</mi> <mo stretchy="false">)</mo> </mrow> <mo>}</mo> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R\bowtie S=\left\{r\cup s\ \vert \ r\in R\ \land \ s\in S\ \land \ {\mathit {Fun}}(r\cup s)\right\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/42d03b194cca0a501136ece44860f5cc4c1abafb" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:47.773ex; height:2.843ex;" alt="{\displaystyle R\bowtie S=\left\{r\cup s\ \vert \ r\in R\ \land \ s\in S\ \land \ {\mathit {Fun}}(r\cup s)\right\}}"></span></td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_1" class="reference nourlexpansion" style="font-weight:bold;">1</span>)</b></td></tr></tbody></table> <p>where <i>Fun(t)</i> is a <a href="/wiki/Predicate_(mathematics)" class="mw-redirect" title="Predicate (mathematics)">predicate</a> that is true for a <a href="/wiki/Relation_(mathematics)" title="Relation (mathematics)">relation</a> <i>t</i> (in the mathematical sense) <a href="/wiki/Iff" class="mw-redirect" title="Iff">iff</a> <i>t</i> is a function (that is, <i>t</i> does not map any attribute to multiple values). It is usually required that <i>R</i> and <i>S</i> must have at least one common attribute, but if this constraint is omitted, and <i>R</i> and <i>S</i> have no common attributes, then the natural join becomes exactly the Cartesian product. </p><p>The natural join can be simulated with Codd's primitives as follows. Assume that <i>c</i><sub>1</sub>,...,<i>c</i><sub><i>m</i></sub> are the attribute names common to <i>R</i> and <i>S</i>, <i>r</i><sub>1</sub>,...,<i>r</i><sub><i>n</i></sub> are the attribute names unique to <i>R</i> and <i>s</i><sub>1</sub>,...,<i>s</i><sub><i>k</i></sub> are the attribute names unique to <i>S</i>. Furthermore, assume that the attribute names <i>x</i><sub>1</sub>,...,<i>x</i><sub><i>m</i></sub> are neither in <i>R</i> nor in <i>S</i>. In a first step the common attribute names in <i>S</i> can be renamed: </p> <table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle T=\rho _{x_{1}/c_{1},\ldots ,x_{m}/c_{m}}(S)=\rho _{x_{1}/c_{1}}(\rho _{x_{2}/c_{2}}(\ldots \rho _{x_{m}/c_{m}}(S)\ldots ))}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>T</mi> <mo>=</mo> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo>=</mo> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mo>&#x2026;<!-- … --></mo> <msub> <mi>&#x03C1;<!-- ρ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mrow class="MJX-TeXAtom-ORD"> <mo>/</mo> </mrow> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo>&#x2026;<!-- … --></mo> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle T=\rho _{x_{1}/c_{1},\ldots ,x_{m}/c_{m}}(S)=\rho _{x_{1}/c_{1}}(\rho _{x_{2}/c_{2}}(\ldots \rho _{x_{m}/c_{m}}(S)\ldots ))}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/5c591661e5ae892fb99445827839f9b208846f67" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.171ex; width:55.569ex; height:3.176ex;" alt="{\displaystyle T=\rho _{x_{1}/c_{1},\ldots ,x_{m}/c_{m}}(S)=\rho _{x_{1}/c_{1}}(\rho _{x_{2}/c_{2}}(\ldots \rho _{x_{m}/c_{m}}(S)\ldots ))}"></span></td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_2" class="reference nourlexpansion" style="font-weight:bold;">2</span>)</b></td></tr></tbody></table> <p>Then we take the Cartesian product and select the tuples that are to be joined: </p> <table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle P=\sigma _{c_{1}=x_{1},\ldots ,c_{m}=x_{m}}(R\times T)=\sigma _{c_{1}=x_{1}}(\sigma _{c_{2}=x_{2}}(\ldots \sigma _{c_{m}=x_{m}}(R\times T)\ldots ))}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>P</mi> <mo>=</mo> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>=</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mo>=</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x00D7;<!-- × --></mo> <mi>T</mi> <mo stretchy="false">)</mo> <mo>=</mo> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>=</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>=</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mo>&#x2026;<!-- … --></mo> <msub> <mi>&#x03C3;<!-- σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mo>=</mo> <msub> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x00D7;<!-- × --></mo> <mi>T</mi> <mo stretchy="false">)</mo> <mo>&#x2026;<!-- … --></mo> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle P=\sigma _{c_{1}=x_{1},\ldots ,c_{m}=x_{m}}(R\times T)=\sigma _{c_{1}=x_{1}}(\sigma _{c_{2}=x_{2}}(\ldots \sigma _{c_{m}=x_{m}}(R\times T)\ldots ))}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/0c7ad95a19c626dbe0a5715d91fa6b5ae8f14a91" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:67.946ex; height:3.009ex;" alt="{\displaystyle P=\sigma _{c_{1}=x_{1},\ldots ,c_{m}=x_{m}}(R\times T)=\sigma _{c_{1}=x_{1}}(\sigma _{c_{2}=x_{2}}(\ldots \sigma _{c_{m}=x_{m}}(R\times T)\ldots ))}"></span></td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_3" class="reference nourlexpansion" style="font-weight:bold;">3</span>)</b></td></tr></tbody></table> <p>Finally we take a projection to get rid of the renamed attributes: </p> <table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle U=\Pi _{r_{1},\ldots ,r_{n},c_{1},\ldots ,c_{m},s_{1},\ldots ,s_{k}}(P)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>U</mi> <mo>=</mo> <msub> <mi mathvariant="normal">&#x03A0;<!-- Π --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> <mo>,</mo> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>c</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>P</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle U=\Pi _{r_{1},\ldots ,r_{n},c_{1},\ldots ,c_{m},s_{1},\ldots ,s_{k}}(P)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/2475ed88a3111f04c7a7a36a49de5dfdc5a378bd" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:29.951ex; height:3.009ex;" alt="{\displaystyle U=\Pi _{r_{1},\ldots ,r_{n},c_{1},\ldots ,c_{m},s_{1},\ldots ,s_{k}}(P)}"></span></td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_4" class="reference nourlexpansion" style="font-weight:bold;">4</span>)</b></td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="θ-join_and_equijoin"><span id=".CE.B8-join_and_equijoin"></span><i>θ</i>-join and equijoin</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=8" title="Edit section: θ-join and equijoin"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Consider tables <i>Car</i> and <i>Boat</i> which list models of cars and boats and their respective prices. Suppose a customer wants to buy a car and a boat, but she does not want to spend more money for the boat than for the car. The <i>θ</i>-join (⋈<sub><i>θ</i></sub>) on the predicate <i>CarPrice</i> ≥ <i>BoatPrice</i> produces the flattened pairs of rows which satisfy the predicate. When using a condition where the attributes are equal, for example Price, then the condition may be specified as <i>Price</i>=<i>Price</i> or alternatively (<i>Price</i>) itself. </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Car</i> </caption> <tbody><tr> <th>CarModel</th> <th>CarPrice </th></tr> <tr> <td>CarA</td> <td>20,000 </td></tr> <tr> <td>CarB</td> <td>30,000 </td></tr> <tr> <td>CarC</td> <td>50,000 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Boat</i> </caption> <tbody><tr> <th>BoatModel</th> <th>BoatPrice </th></tr> <tr> <td>Boat1</td> <td>10,000 </td></tr> <tr> <td>Boat2</td> <td>40,000 </td></tr> <tr> <td>Boat3</td> <td>60,000 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {Car\bowtie Boat \atop \scriptstyle CarPrice\geq BoatPrice}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mrow class="MJX-TeXAtom-ORD"> <mfrac linethickness="0"> <mrow> <mi>C</mi> <mi>a</mi> <mi>r</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>B</mi> <mi>o</mi> <mi>a</mi> <mi>t</mi> </mrow> <mstyle displaystyle="false" scriptlevel="1"> <mi>C</mi> <mi>a</mi> <mi>r</mi> <mi>P</mi> <mi>r</mi> <mi>i</mi> <mi>c</mi> <mi>e</mi> <mo>&#x2265;<!-- ≥ --></mo> <mi>B</mi> <mi>o</mi> <mi>a</mi> <mi>t</mi> <mi>P</mi> <mi>r</mi> <mi>i</mi> <mi>c</mi> <mi>e</mi> </mstyle> </mfrac> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle {Car\bowtie Boat \atop \scriptstyle CarPrice\geq BoatPrice}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ff006eda3fde84d62ea99aae51fc508a797540e5" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.005ex; width:16.246ex; height:5.509ex;" alt="{\displaystyle {Car\bowtie Boat \atop \scriptstyle CarPrice\geq BoatPrice}}"></span> </caption> <tbody><tr> <th>CarModel</th> <th>CarPrice</th> <th>BoatModel</th> <th>BoatPrice </th></tr> <tr> <td>CarA</td> <td>20,000</td> <td>Boat1</td> <td>10,000 </td></tr> <tr> <td>CarB</td> <td>30,000</td> <td>Boat1</td> <td>10,000 </td></tr> <tr> <td>CarC</td> <td>50,000</td> <td>Boat1</td> <td>10,000 </td></tr> <tr> <td>CarC</td> <td>50,000</td> <td>Boat2</td> <td>40,000 </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>In order to combine tuples from two relations where the combination condition is not simply the equality of shared attributes it is convenient to have a more general form of join operator, which is the <i>θ</i>-join (or theta-join). The <i>θ</i>-join is a binary operator that is written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ b}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mrow class="MJX-TeXAtom-ORD"> <mfrac linethickness="0"> <mrow> <mi>R</mi> <mtext>&#xA0;</mtext> <mo>&#x22C8;<!-- ⋈ --></mo> <mtext>&#xA0;</mtext> <mi>S</mi> </mrow> <mrow> <mi>a</mi> <mtext>&#xA0;</mtext> <mi>&#x03B8;<!-- θ --></mi> <mtext>&#xA0;</mtext> <mi>b</mi> </mrow> </mfrac> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ b}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4949920c7ae2979a6d353082b9a32672e3e4d745" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:8.364ex; height:5.343ex;" alt="{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ b}}"></span> or <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ v}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mrow class="MJX-TeXAtom-ORD"> <mfrac linethickness="0"> <mrow> <mi>R</mi> <mtext>&#xA0;</mtext> <mo>&#x22C8;<!-- ⋈ --></mo> <mtext>&#xA0;</mtext> <mi>S</mi> </mrow> <mrow> <mi>a</mi> <mtext>&#xA0;</mtext> <mi>&#x03B8;<!-- θ --></mi> <mtext>&#xA0;</mtext> <mi>v</mi> </mrow> </mfrac> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ v}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7ec5235053b3152d3c4d4a558d77a736f84f1d2d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:8.364ex; height:5.343ex;" alt="{\displaystyle {R\ \bowtie \ S \atop a\ \theta \ v}}"></span> where <i>a</i> and <i>b</i> are attribute names, <i>θ</i> is a binary <a href="/wiki/Relational_operator" title="Relational operator">relational operator</a> in the set <span class="texhtml">{&lt;, ≤, =, ≠, &gt;, ≥</span>}, <i>υ</i> is a value constant, and <i>R</i> and <i>S</i> are relations. The result of this operation consists of all combinations of tuples in <i>R</i> and <i>S</i> that satisfy <i>θ</i>. The result of the <i>θ</i>-join is defined only if the headers of <i>S</i> and <i>R</i> are disjoint, that is, do not contain a common attribute. </p><p>The simulation of this operation in the fundamental operations is therefore as follows: </p> <dl><dd><i>R</i> ⋈<sub><i>θ</i></sub> <i>S</i> = <i>σ<sub>θ</sub></i>(<i>R</i> × <i>S</i>)</dd></dl> <p>In case the operator <i>θ</i> is the equality operator (=) then this join is also called an <b>equijoin</b>. </p><p>Note, however, that a computer language that supports the natural join and selection operators does not need <i>θ</i>-join as well, as this can be achieved by selection from the result of a natural join (which degenerates to Cartesian product when there are no shared attributes). </p><p>In SQL implementations, joining on a predicate is usually called an <i>inner join</i>, and the <i>on</i> keyword allows one to specify the predicate used to filter the rows. It is important to note: forming the flattened Cartesian product then filtering the rows is conceptually correct, but an implementation would use more sophisticated data structures to speed up the join query. </p> <div class="mw-heading mw-heading3"><h3 id="Semijoin">Semijoin</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=9" title="Edit section: Semijoin"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The left semijoin (⋉ and ⋊) is a joining similar to the natural join and written as <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R\ltimes S}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> <mo>&#x22C9;<!-- ⋉ --></mo> <mi>S</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R\ltimes S}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/13bf48cd329deb65740f4caa962329f29d4bacd2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:6.104ex; height:2.176ex;" alt="{\displaystyle R\ltimes S}"></span> where <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4b0bfb3769bf24d80e15374dc37b0441e2616e33" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.764ex; height:2.176ex;" alt="{\displaystyle R}"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle S}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>S</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle S}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4611d85173cd3b508e67077d4a1252c9c05abca2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.499ex; height:2.176ex;" alt="{\displaystyle S}"></span> are <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">&#91;</span>b<span class="cite-bracket">&#93;</span></a></sup> The result is the set of all tuples in <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4b0bfb3769bf24d80e15374dc37b0441e2616e33" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.764ex; height:2.176ex;" alt="{\displaystyle R}"></span> for which there is a tuple in <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle S}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>S</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle S}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4611d85173cd3b508e67077d4a1252c9c05abca2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.499ex; height:2.176ex;" alt="{\displaystyle S}"></span> that is equal on their common attribute names. The difference from a natural join is that other columns of <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle S}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>S</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle S}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4611d85173cd3b508e67077d4a1252c9c05abca2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.499ex; height:2.176ex;" alt="{\displaystyle S}"></span> do not appear. For example, consider the tables <i>Employee</i> and <i>Dept</i> and their semijoin:<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Production </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sales</td> <td>Sally </td></tr> <tr> <td>Production</td> <td>Harriet </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i> ⋉ <i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Production </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>More formally the semantics of the semijoin can be defined as follows: </p><p><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R\ltimes S=\{t:t\in R\land \exists s\in S(\operatorname {Fun} (t\cup s))\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> <mo>&#x22C9;<!-- ⋉ --></mo> <mi>S</mi> <mo>=</mo> <mo fence="false" stretchy="false">{</mo> <mi>t</mi> <mo>:</mo> <mi>t</mi> <mo>&#x2208;<!-- ∈ --></mo> <mi>R</mi> <mo>&#x2227;<!-- ∧ --></mo> <mi mathvariant="normal">&#x2203;<!-- ∃ --></mi> <mi>s</mi> <mo>&#x2208;<!-- ∈ --></mo> <mi>S</mi> <mo stretchy="false">(</mo> <mi>Fun</mi> <mo>&#x2061;<!-- ⁡ --></mo> <mo stretchy="false">(</mo> <mi>t</mi> <mo>&#x222A;<!-- ∪ --></mo> <mi>s</mi> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R\ltimes S=\{t:t\in R\land \exists s\in S(\operatorname {Fun} (t\cup s))\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1ea162396468f5cb3ad1bf1fc735a6fad1ee95c7" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:41.288ex; height:2.843ex;" alt="{\displaystyle R\ltimes S=\{t:t\in R\land \exists s\in S(\operatorname {Fun} (t\cup s))\}}"></span> </p><p>where <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \operatorname {Fun} (r)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>Fun</mi> <mo>&#x2061;<!-- ⁡ --></mo> <mo stretchy="false">(</mo> <mi>r</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \operatorname {Fun} (r)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b6086e28fb74ad7a0af3bced37836c17d0d4ff3a" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.961ex; height:2.843ex;" alt="{\displaystyle \operatorname {Fun} (r)}"></span> is as in the definition of natural join. </p><p>The semijoin can be simulated using the natural join as follows. If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle a_{1},\ldots ,a_{n}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle a_{1},\ldots ,a_{n}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/451345cc97e2ed923dd4656fcc400c3f37119cca" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:9.911ex; height:2.009ex;" alt="{\displaystyle a_{1},\ldots ,a_{n}}"></span> are the attribute names of <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4b0bfb3769bf24d80e15374dc37b0441e2616e33" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.764ex; height:2.176ex;" alt="{\displaystyle R}"></span>, then </p><p><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle R\ltimes S=\Pi _{a_{1},\ldots ,a_{n}}(R\bowtie S).}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>R</mi> <mo>&#x22C9;<!-- ⋉ --></mo> <mi>S</mi> <mo>=</mo> <msub> <mi mathvariant="normal">&#x03A0;<!-- Π --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>a</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo>.</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle R\ltimes S=\Pi _{a_{1},\ldots ,a_{n}}(R\bowtie S).}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cbd0b2f3211ef1591478227c6e15b24a9eb8b2d8" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:26.655ex; height:3.009ex;" alt="{\displaystyle R\ltimes S=\Pi _{a_{1},\ldots ,a_{n}}(R\bowtie S).}"></span> </p><p>Since we can simulate the natural join with the basic operators it follows that this also holds for the semijoin. </p><p>In Codd's 1970 paper, semijoin is called restriction.<sup id="cite_ref-Codd1970_1-1" class="reference"><a href="#cite_note-Codd1970-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Antijoin">Antijoin</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=10" title="Edit section: Antijoin"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The antijoin (▷), written as <i>R</i> ▷ <i>S</i> where <i>R</i> and <i>S</i> are <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>,<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">&#91;</span>c<span class="cite-bracket">&#93;</span></a></sup> is similar to the semijoin, but the result of an antijoin is only those tuples in <i>R</i> for which there is <i>no</i> tuple in <i>S</i> that is equal on their common attribute names.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p><p>For an example consider the tables <i>Employee</i> and <i>Dept</i> and their antijoin: </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Production </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sales</td> <td>Sally </td></tr> <tr> <td>Production</td> <td>Harriet </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i> ▷ <i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>The antijoin is formally defined as follows: </p> <dl><dd><span class="texhtml"><i>R</i> ▷ <i>S</i> = { <i>t</i>&#160;: <i>t</i> ∈ <i>R</i> &#8743; ¬&#8707;<i>s</i> ∈ <i>S</i>(<i>Fun</i> (<i>t</i> &#8746; <i>s</i>))</span>}</dd></dl> <p>or </p> <dl><dd><span class="texhtml"><i>R</i> ▷ <i>S</i> = { <i>t</i>&#160;: <i>t</i> ∈ <i>R</i>, there is no tuple <i>s</i> of <i>S</i> that satisfies <i>Fun</i> (<i>t</i> &#8746; <i>s</i>)</span>}</dd></dl> <p>where <span class="texhtml"><i>Fun</i> (<i>t</i> &#8746; <i>s</i>)</span> is as in the definition of natural join. </p><p>The antijoin can also be defined as the <a href="/wiki/Complement_(set_theory)" title="Complement (set theory)">complement</a> of the semijoin, as follows: </p> <table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"> <span class="texhtml"><i>R</i> ▷ <i>S</i> = <i>R</i>&#160;&#8722;&#160;<i>R</i> ⋉ <i>S</i></span> </td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_5" class="reference nourlexpansion" style="font-weight:bold;">5</span>)</b></td></tr></tbody></table> <p>Given this, the antijoin is sometimes called the anti-semijoin, and the antijoin operator is sometimes written as semijoin symbol with a bar above it, instead of ▷. </p><p>In the case where the relations have the same attributes (union-compatible), antijoin is the same as minus. </p> <div class="mw-heading mw-heading3"><h3 id="Division">Division</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=11" title="Edit section: Division"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The division (÷) is a binary operation that is written as <i>R</i> ÷ <i>S</i>. Division is not implemented directly in SQL. The result consists of the restrictions of tuples in <i>R</i> to the attribute names unique to <i>R</i>, i.e., in the header of <i>R</i> but not in the header of <i>S</i>, for which it holds that all their combinations with tuples in <i>S</i> are present in <i>R</i>. </p> <div class="mw-heading mw-heading4"><h4 id="Example">Example</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=12" title="Edit section: Example"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Completed</i> </caption> <tbody><tr> <th>Student</th> <th>Task </th></tr> <tr> <td>Fred</td> <td>Database1 </td></tr> <tr> <td>Fred</td> <td>Database2 </td></tr> <tr> <td>Fred</td> <td>Compiler1 </td></tr> <tr> <td>Eugene</td> <td>Database1 </td></tr> <tr> <td>Eugene</td> <td>Compiler1 </td></tr> <tr> <td>Sarah</td> <td>Database1 </td></tr> <tr> <td>Sarah</td> <td>Database2 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>DBProject</i> </caption> <tbody><tr> <th>Task </th></tr> <tr> <td>Database1 </td></tr> <tr> <td>Database2 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Completed</i> ÷ <i>DBProject</i> </caption> <tbody><tr> <th>Student </th></tr> <tr> <td>Fred </td></tr> <tr> <td>Sarah </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div><p>If <i>DBProject</i> contains all the tasks of the Database project, then the result of the division above contains exactly the students who have completed both of the tasks in the Database project. More formally the semantics of the division is defined as follows:</p><table role="presentation" style="border-collapse:collapse; margin:0 0 0 1.6em; border:none;"><tbody><tr><td style="vertical-align:middle; border:none; padding:0;" class="nowrap"> <span class="texhtml"><i>R</i> ÷ <i>S</i> = { <i>t</i>[<i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub>]&#160;: <i>t</i> ∈ <i>R</i> ∧ ∀<i>s</i> ∈ <i>S</i> ( (<i>t</i>[<i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub>] ∪ <i>s</i>) ∈ <i>R</i>) } </span> </td> <td style="vertical-align:middle; width:99%; border:none; padding:0;"></td> <td style="vertical-align:middle; border:none; padding:0;" class="nowrap"><b>(<span id="math_6" class="reference nourlexpansion" style="font-weight:bold;">6</span>)</b></td></tr></tbody></table><p>where {<i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub>} is the set of attribute names unique to <i>R</i> and <i>t</i>[<i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub>] is the restriction of <i>t</i> to this set. It is usually required that the attribute names in the header of <i>S</i> are a subset of those of <i>R</i> because otherwise the result of the operation will always be empty. </p><p>The simulation of the division with the basic operations is as follows. We assume that <i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub> are the attribute names unique to <i>R</i> and <i>b</i><sub>1</sub>,...,<i>b</i><sub><i>m</i></sub> are the attribute names of <i>S</i>. In the first step we project <i>R</i> on its unique attribute names and construct all combinations with tuples in <i>S</i>: </p> <dl><dd><i>T</i>&#160;:= π<sub><i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub></sub>(<i>R</i>) × <i>S</i></dd></dl> <p>In the prior example, T would represent a table such that every Student (because Student is the unique key / attribute of the Completed table) is combined with every given Task. So Eugene, for instance, would have two rows, Eugene → Database1 and Eugene → Database2 in T. </p> <dl><dd><dl><dd>EG: First, let's pretend that "Completed" has a third attribute called "grade". It's unwanted baggage here, so we must project it off always. In fact in this step we can drop "Task" from R as well; the multiply puts it back on.</dd> <dd><i>T</i>&#160;:= π<sub>Student</sub>(<i>R</i>) × <i>S</i> // This gives us every possible desired combination, including those that don't actually exist in R, and excluding others (eg Fred | compiler1, which is not a desired combination)</dd></dl></dd></dl> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break" style="padding-left: 5em;"> <table class="wikitable"> <caption><i>T</i> </caption> <tbody><tr> <th>Student</th> <th>Task </th></tr> <tr> <td>Fred</td> <td>Database1 </td></tr> <tr> <td>Fred</td> <td>Database2 </td></tr> <tr> <td>Eugene</td> <td>Database1 </td></tr> <tr> <td>Eugene</td> <td>Database2 </td></tr> <tr> <td>Sarah</td> <td>Database1 </td></tr> <tr> <td>Sarah</td> <td>Database2 </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div><p> In the next step we subtract <i>R</i> from <i>T</i> </p><p><a href="/wiki/Relation_(database)" title="Relation (database)">relation</a>: </p> <dl><dd><i>U</i>&#160;:= <i>T</i> &#8722; <i>R</i></dd></dl> <p>In <i>U</i> we have the possible combinations that "could have" been in <i>R</i>, but weren't. </p> <dl><dd><dl><dd>EG: Again with projections — <i>T</i> and <i>R</i> need to have identical attribute names/headers.</dd> <dd><i>U</i>&#160;:= <i>T</i> &#8722; π<sub>Student,Task</sub>(<i>R</i>) // This gives us a "what's missing" list.</dd></dl></dd></dl> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break" style="padding-left: 5em;"> <table class="wikitable"> <caption><i>T</i> </caption> <tbody><tr> <th>Student</th> <th>Task </th></tr> <tr> <td>Fred</td> <td>Database1 </td></tr> <tr> <td>Fred</td> <td>Database2 </td></tr> <tr> <td>Eugene</td> <td>Database1 </td></tr> <tr> <td>Eugene</td> <td>Database2 </td></tr> <tr> <td>Sarah</td> <td>Database1 </td></tr> <tr> <td>Sarah</td> <td>Database2 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>R</i> a.k.a. <i>Completed</i> </caption> <tbody><tr> <th>Student</th> <th>Task </th></tr> <tr> <td>Fred</td> <td>Database1 </td></tr> <tr> <td>Fred</td> <td>Database2 </td></tr> <tr> <td>Fred</td> <td>Compiler1 </td></tr> <tr> <td>Eugene</td> <td>Database1 </td></tr> <tr> <td>Eugene</td> <td>Compiler1 </td></tr> <tr> <td>Sarah</td> <td>Database1 </td></tr> <tr> <td>Sarah</td> <td>Database2 </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>U</i> </caption> <caption>aka </caption> <caption><i>T</i> &#8722; <i>R</i> </caption> <caption>aka </caption> <caption><i>what's missing</i> </caption> <tbody><tr> <th>Student</th> <th>Task </th></tr> <tr> <td>Eugene</td> <td>Database2 </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div><p> So if we now take the projection on the attribute names unique to <i>R</i> </p><p>then we have the restrictions of the tuples in <i>R</i> for which not all combinations with tuples in <i>S</i> were present in <i>R</i>: </p> <dl><dd><i>V</i>&#160;:= π<sub><i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub></sub>(<i>U</i>) <dl><dd>EG: Project <i>U</i> down to just the attribute(s) in question (Student)</dd> <dd><i>V</i>&#160;:= π<sub>Student</sub>(<i>U</i>)</dd></dl></dd></dl> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break" style="padding-left: 5em;"> <table class="wikitable"> <caption><i>V</i> </caption> <tbody><tr> <th>Student </th></tr> <tr> <td>Eugene </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>So what remains to be done is take the projection of <i>R</i> on its unique attribute names and subtract those in <i>V</i>: </p> <dl><dd><i>W</i>&#160;:= π<sub><i>a</i><sub>1</sub>,...,<i>a</i><sub><i>n</i></sub></sub>(<i>R</i>) &#8722; <i>V</i> <dl><dd>EG: <i>W</i>&#160;:= π<sub>Student</sub>(<i>R</i>) &#8722; <i>V</i>.</dd></dl></dd></dl> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break" style="padding-left: 5em;"> <table class="wikitable"> <caption>π<sub>Student</sub>(<i>R</i>) </caption> <tbody><tr> <th>Student </th></tr> <tr> <td>Fred </td></tr> <tr> <td>Eugene </td></tr> <tr> <td>Sarah </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>V</i> </caption> <tbody><tr> <th>Student </th></tr> <tr> <td>Eugene </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>W</i> </caption> <caption>aka </caption> <caption><span class="texhtml">(π<sub>Student</sub>(<i>R</i>) &#8722; <i>V</i>)</span> </caption> <caption>aka </caption> <caption>desired result </caption> <tbody><tr> <th>Student </th></tr> <tr> <td>Fred </td></tr> <tr> <td>Sarah </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <div class="mw-heading mw-heading2"><h2 id="Common_extensions">Common extensions</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=13" title="Edit section: Common extensions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In practice the classical relational algebra described above is extended with various operations such as outer joins, aggregate functions and even transitive closure.<sup id="cite_ref-ÖzsuValduriez2011_6-0" class="reference"><a href="#cite_note-ÖzsuValduriez2011-6"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Outer_joins">Outer joins</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=14" title="Edit section: Outer joins"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Join_(SQL)#Outer_join" title="Join (SQL)">Join (SQL) §&#160;Outer join</a></div> <p>Whereas the result of a join (or inner join) consists of tuples formed by combining matching tuples in the two operands, an outer join contains those tuples and additionally some tuples formed by extending an unmatched tuple in one of the operands by "fill" values for each of the attributes of the other operand. Outer joins are not considered part of the classical relational algebra discussed so far.<sup id="cite_ref-O&#39;NeilO&#39;Neil2001_7-0" class="reference"><a href="#cite_note-O&#39;NeilO&#39;Neil2001-7"><span class="cite-bracket">&#91;</span>4<span class="cite-bracket">&#93;</span></a></sup> </p><p>The operators defined in this section assume the existence of a <i>null</i> value, <i>ω</i>, which we do not define, to be used for the fill values; in practice this corresponds to the <a href="/wiki/Null_(SQL)" title="Null (SQL)">NULL</a> in SQL. In order to make subsequent selection operations on the resulting table meaningful, a semantic meaning needs to be assigned to nulls; in Codd's approach the propositional logic used by the selection is <a href="/wiki/Null_(SQL)#Comparisons_with_NULL_and_the_three-valued_logic_.283VL.29" title="Null (SQL)">extended to a three-valued logic</a>, although we elide those details in this article. </p><p>Three outer join operators are defined: left outer join, right outer join, and full outer join. (The word "outer" is sometimes omitted.) </p> <div class="mw-heading mw-heading4"><h4 id="Left_outer_join">Left outer join</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=15" title="Edit section: Left outer join"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The left outer join (⟕) is written as <i>R</i> ⟕ <i>S</i> where <i>R</i> and <i>S</i> are <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">&#91;</span>d<span class="cite-bracket">&#93;</span></a></sup> The result of the left outer join is the set of all combinations of tuples in <i>R</i> and <i>S</i> that are equal on their common attribute names, in addition (loosely speaking) to tuples in <i>R</i> that have no matching tuples in <i>S</i>.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p><p>For an example consider the tables <i>Employee</i> and <i>Dept</i> and their left outer join: </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales </td></tr> <tr> <td>Tim</td> <td>1123</td> <td>Executive </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Production</td> <td>Charles </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i> ⟕ <i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance</td> <td>ω </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance</td> <td>ω </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Tim</td> <td>1123</td> <td>Executive</td> <td>ω </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>In the resulting relation, tuples in <i>S</i> which have no common values in common attribute names with tuples in <i>R</i> take a <i>null</i> value, <i>ω</i>. </p><p>Since there are no tuples in <i>Dept</i> with a <i>DeptName</i> of <i>Finance</i> or <i>Executive</i>, <i>ω</i>s occur in the resulting relation where tuples in <i>Employee</i> have a <i>DeptName</i> of <i>Finance</i> or <i>Executive</i>. </p><p>Let <i>r</i><sub>1</sub>, <i>r</i><sub>2</sub>, ..., <i>r</i><sub><i>n</i></sub> be the attributes of the relation <i>R</i> and let {(<i>ω</i>, ..., <i>ω</i>)} be the singleton relation on the attributes that are <i>unique</i> to the relation <i>S</i> (those that are not attributes of <i>R</i>). Then the left outer join can be described in terms of the natural join (and hence using basic operators) as follows: </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (R\bowtie S)\cup ((R-\pi _{r_{1},r_{2},\dots ,r_{n}}(R\bowtie S))\times \{(\omega ,\dots ,\omega )\})}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo>&#x222A;<!-- ∪ --></mo> <mo stretchy="false">(</mo> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x2212;<!-- − --></mo> <msub> <mi>&#x03C0;<!-- π --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>r</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> <mo>&#x00D7;<!-- × --></mo> <mo fence="false" stretchy="false">{</mo> <mo stretchy="false">(</mo> <mi>&#x03C9;<!-- ω --></mi> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <mi>&#x03C9;<!-- ω --></mi> <mo stretchy="false">)</mo> <mo fence="false" stretchy="false">}</mo> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (R\bowtie S)\cup ((R-\pi _{r_{1},r_{2},\dots ,r_{n}}(R\bowtie S))\times \{(\omega ,\dots ,\omega )\})}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1fca2cce8a6f1a5c1bd7b9fa67f17c80e9540ef9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:52.466ex; height:3.009ex;" alt="{\displaystyle (R\bowtie S)\cup ((R-\pi _{r_{1},r_{2},\dots ,r_{n}}(R\bowtie S))\times \{(\omega ,\dots ,\omega )\})}"></span></dd></dl> <div class="mw-heading mw-heading4"><h4 id="Right_outer_join">Right outer join</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=16" title="Edit section: Right outer join"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The right outer join (⟖) behaves almost identically to the left outer join, but the roles of the tables are switched. </p><p>The right outer join of <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a> <i>R</i> and <i>S</i> is written as <i>R</i> ⟖ <i>S</i>.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">&#91;</span>e<span class="cite-bracket">&#93;</span></a></sup> The result of the right outer join is the set of all combinations of tuples in <i>R</i> and <i>S</i> that are equal on their common attribute names, in addition to tuples in <i>S</i> that have no matching tuples in <i>R</i>.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p><p>For example, consider the tables <i>Employee</i> and <i>Dept</i> and their right outer join: </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales </td></tr> <tr> <td>Tim</td> <td>1123</td> <td>Executive </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Production</td> <td>Charles </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i> ⟖ <i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>ω</td> <td>ω</td> <td>Production</td> <td>Charles </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>In the resulting relation, tuples in <i>R</i> which have no common values in common attribute names with tuples in <i>S</i> take a <i>null</i> value, <i>ω</i>. </p><p>Since there are no tuples in <i>Employee</i> with a <i>DeptName</i> of <i>Production</i>, <i>ω</i>s occur in the Name and EmpId attributes of the resulting relation where tuples in <i>Dept</i> had <i>DeptName</i> of <i>Production</i>. </p><p>Let <i>s</i><sub>1</sub>, <i>s</i><sub>2</sub>, ..., <i>s</i><sub><i>n</i></sub> be the attributes of the relation <i>S</i> and let {(<i>ω</i>, ..., <i>ω</i>)} be the singleton relation on the attributes that are <i>unique</i> to the relation <i>R</i> (those that are not attributes of <i>S</i>). Then, as with the left outer join, the right outer join can be simulated using the natural join as follows: </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (R\bowtie S)\cup (\{(\omega ,\dots ,\omega )\}\times (S-\pi _{s_{1},s_{2},\dots ,s_{n}}(R\bowtie S)))}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo>&#x222A;<!-- ∪ --></mo> <mo stretchy="false">(</mo> <mo fence="false" stretchy="false">{</mo> <mo stretchy="false">(</mo> <mi>&#x03C9;<!-- ω --></mi> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <mi>&#x03C9;<!-- ω --></mi> <mo stretchy="false">)</mo> <mo fence="false" stretchy="false">}</mo> <mo>&#x00D7;<!-- × --></mo> <mo stretchy="false">(</mo> <mi>S</mi> <mo>&#x2212;<!-- − --></mo> <msub> <mi>&#x03C0;<!-- π --></mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>s</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msub> </mrow> </msub> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x22C8;<!-- ⋈ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (R\bowtie S)\cup (\{(\omega ,\dots ,\omega )\}\times (S-\pi _{s_{1},s_{2},\dots ,s_{n}}(R\bowtie S)))}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/0570296147338af7c86304c653c3431c88b39d3c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:52.29ex; height:3.009ex;" alt="{\displaystyle (R\bowtie S)\cup (\{(\omega ,\dots ,\omega )\}\times (S-\pi _{s_{1},s_{2},\dots ,s_{n}}(R\bowtie S)))}"></span></dd></dl> <div class="mw-heading mw-heading4"><h4 id="Full_outer_join">Full outer join</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=17" title="Edit section: Full outer join"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <b>outer join</b> (⟗) or <b>full outer join</b> in effect combines the results of the left and right outer joins. </p><p>The full outer join is written as <i>R</i> ⟗ <i>S</i> where <i>R</i> and <i>S</i> are <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a>.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">&#91;</span>f<span class="cite-bracket">&#93;</span></a></sup> The result of the full outer join is the set of all combinations of tuples in <i>R</i> and <i>S</i> that are equal on their common attribute names, in addition to tuples in <i>S</i> that have no matching tuples in <i>R</i> and tuples in <i>R</i> that have no matching tuples in <i>S</i> in their common attribute names.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (April 2022)">citation needed</span></a></i>&#93;</sup> </p><p>For an example consider the tables <i>Employee</i> and <i>Dept</i> and their full outer join: </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1216972533"><div> <table class="col-begin" role="presentation" style="width: auto; margin:0.5em auto;"> <tbody><tr> <td class="col-break"> <table class="wikitable"> <caption><i>Employee</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales </td></tr> <tr> <td>Tim</td> <td>1123</td> <td>Executive </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Dept</i> </caption> <tbody><tr> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Production</td> <td>Charles </td></tr></tbody></table> </td> <td class="col-break" style="padding-left: 2em;"> <table class="wikitable"> <caption><i>Employee</i> ⟗ <i>Dept</i> </caption> <tbody><tr> <th>Name</th> <th>EmpId</th> <th>DeptName</th> <th>Manager </th></tr> <tr> <td>Harry</td> <td>3415</td> <td>Finance</td> <td>ω </td></tr> <tr> <td>Sally</td> <td>2241</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>George</td> <td>3401</td> <td>Finance</td> <td>ω </td></tr> <tr> <td>Harriet</td> <td>2202</td> <td>Sales</td> <td>Harriet </td></tr> <tr> <td>Tim</td> <td>1123</td> <td>Executive</td> <td>ω </td></tr> <tr> <td>ω</td> <td>ω</td> <td>Production</td> <td>Charles </td></tr></tbody></table> <p>&#32; </p> </td></tr></tbody></table></div> <p>In the resulting relation, tuples in <i>R</i> which have no common values in common attribute names with tuples in <i>S</i> take a <i>null</i> value, <i>ω</i>. Tuples in <i>S</i> which have no common values in common attribute names with tuples in <i>R</i> also take a <i>null</i> value, <i>ω</i>. </p><p>The full outer join can be simulated using the left and right outer joins (and hence the natural join and set union) as follows: </p> <dl><dd><i>R</i> ⟗ <i>S</i> = (<i>R</i> ⟕ <i>S</i>) &#8746; (<i>R</i> ⟖ <i>S</i>)</dd></dl> <div class="mw-heading mw-heading3"><h3 id="Operations_for_domain_computations">Operations for domain computations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=18" title="Edit section: Operations for domain computations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>There is nothing in relational algebra introduced so far that would allow computations on the data domains (other than evaluation of propositional expressions involving equality). For example, it is not possible using only the algebra introduced so far to write an expression that would multiply the numbers from two columns, e.g. a unit price with a quantity to obtain a total price. Practical query languages have such facilities, e.g. the SQL SELECT allows arithmetic operations to define new columns in the result <code class="mw-highlight mw-highlight-lang-sql mw-content-ltr" dir="ltr"><span class="k">SELECT</span><span class="w"> </span><span class="n">unit_price</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">quantity</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">total_price</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">t</span></code>, and a similar facility is provided more explicitly by Tutorial D's <code>EXTEND</code> keyword.<sup id="cite_ref-Date2011_11-0" class="reference"><a href="#cite_note-Date2011-11"><span class="cite-bracket">&#91;</span>5<span class="cite-bracket">&#93;</span></a></sup> In database theory, this is called <b>extended projection</b>.<sup id="cite_ref-Garcia-MolinaUllman2009_12-0" class="reference"><a href="#cite_note-Garcia-MolinaUllman2009-12"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup><sup class="reference nowrap"><span title="Page / location: 213">&#58;&#8202;213&#8202;</span></sup> </p> <div class="mw-heading mw-heading4"><h4 id="Aggregation">Aggregation</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=19" title="Edit section: Aggregation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Furthermore, computing various functions on a column, like the summing up of its elements, is also not possible using the relational algebra introduced so far. There are five <a href="/wiki/Aggregate_function" title="Aggregate function">aggregate functions</a> that are included with most relational database systems. These operations are Sum, Count, Average, Maximum and Minimum. In relational algebra the aggregation operation over a schema (<i>A</i><sub>1</sub>, <i>A</i><sub>2</sub>, ... <i>A</i><sub><i>n</i></sub>) is written as follows: </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle G_{1},G_{2},\ldots ,G_{m}\ g_{f_{1}({A_{1}}'),f_{2}({A_{2}}'),\ldots ,f_{k}({A_{k}}')}\ (r)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>G</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>,</mo> <msub> <mi>G</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>G</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>m</mi> </mrow> </msub> <mtext>&#xA0;</mtext> <msub> <mi>g</mi> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>f</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo stretchy="false">(</mo> <msup> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> </mrow> <mo>&#x2032;</mo> </msup> <mo stretchy="false">)</mo> <mo>,</mo> <msub> <mi>f</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo stretchy="false">(</mo> <msup> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> </mrow> <mo>&#x2032;</mo> </msup> <mo stretchy="false">)</mo> <mo>,</mo> <mo>&#x2026;<!-- … --></mo> <mo>,</mo> <msub> <mi>f</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> </mrow> </msub> <mo stretchy="false">(</mo> <msup> <mrow class="MJX-TeXAtom-ORD"> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> </mrow> </msub> </mrow> <mo>&#x2032;</mo> </msup> <mo stretchy="false">)</mo> </mrow> </msub> <mtext>&#xA0;</mtext> <mo stretchy="false">(</mo> <mi>r</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle G_{1},G_{2},\ldots ,G_{m}\ g_{f_{1}({A_{1}}'),f_{2}({A_{2}}'),\ldots ,f_{k}({A_{k}}')}\ (r)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/c74b92d02fb0ae8df720ba3355e2cd7bc7a3e58f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.338ex; width:40.727ex; height:3.343ex;" alt="{\displaystyle G_{1},G_{2},\ldots ,G_{m}\ g_{f_{1}({A_{1}}&#039;),f_{2}({A_{2}}&#039;),\ldots ,f_{k}({A_{k}}&#039;)}\ (r)}"></span></dd></dl> <p>where each <i>A</i><sub><i>j</i></sub>', 1 ≤ <i>j</i> ≤ <i>k</i>, is one of the original attributes <i>A</i><sub><i>i</i></sub>, 1 ≤ <i>i</i> ≤ <i>n</i>. </p><p>The attributes preceding the <i>g</i> are grouping attributes, which function like a "group by" clause in SQL. Then there are an arbitrary number of aggregation functions applied to individual attributes. The operation is applied to an arbitrary relation <i>r</i>. The grouping attributes are optional, and if they are not supplied, the aggregation functions are applied across the entire relation to which the operation is applied. </p><p>Let's assume that we have a table named <style data-mw-deduplicate="TemplateStyles:r886049734">.mw-parser-output .monospaced{font-family:monospace,monospace}</style><span class="monospaced">Account</span> with three columns, namely <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Account_Number, Branch_Name</span> and <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Balance</span>. We wish to find the maximum balance of each branch. This is accomplished by <sub><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Branch_Name</span></sub><i>G</i><sub>Max(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Balance</span>)</sub>(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Account</span>). To find the highest balance of all accounts regardless of branch, we could simply write <i>G</i><sub>Max(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Balance</span>)</sub>(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Account</span>). </p><p>Grouping is often written as <sub><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Branch_Name</span></sub><i>ɣ</i><sub>Max(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Balance</span>)</sub>(<link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r886049734"><span class="monospaced">Account</span>) instead.<sup id="cite_ref-Garcia-MolinaUllman2009_12-1" class="reference"><a href="#cite_note-Garcia-MolinaUllman2009-12"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Transitive_closure">Transitive closure</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=20" title="Edit section: Transitive closure"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Although relational algebra seems powerful enough for most practical purposes, there are some simple and natural operators on <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a> that cannot be expressed by relational algebra. One of them is the <a href="/wiki/Transitive_closure" title="Transitive closure">transitive closure</a> of a binary relation. Given a domain <i>D</i>, let binary relation <i>R</i> be a subset of <i>D</i>×<i>D</i>. The transitive closure <i>R<sup>+</sup></i> of <i>R</i> is the smallest subset of <i>D</i>×<i>D</i> that contains <i>R</i> and satisfies the following condition: </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \forall x\forall y\forall z\left((x,y)\in R^{+}\wedge (y,z)\in R^{+}\Rightarrow (x,z)\in R^{+}\right)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">&#x2200;<!-- ∀ --></mi> <mi>x</mi> <mi mathvariant="normal">&#x2200;<!-- ∀ --></mi> <mi>y</mi> <mi mathvariant="normal">&#x2200;<!-- ∀ --></mi> <mi>z</mi> <mrow> <mo>(</mo> <mrow> <mo stretchy="false">(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo stretchy="false">)</mo> <mo>&#x2208;<!-- ∈ --></mo> <msup> <mi>R</mi> <mrow class="MJX-TeXAtom-ORD"> <mo>+</mo> </mrow> </msup> <mo>&#x2227;<!-- ∧ --></mo> <mo stretchy="false">(</mo> <mi>y</mi> <mo>,</mo> <mi>z</mi> <mo stretchy="false">)</mo> <mo>&#x2208;<!-- ∈ --></mo> <msup> <mi>R</mi> <mrow class="MJX-TeXAtom-ORD"> <mo>+</mo> </mrow> </msup> <mo stretchy="false">&#x21D2;<!-- ⇒ --></mo> <mo stretchy="false">(</mo> <mi>x</mi> <mo>,</mo> <mi>z</mi> <mo stretchy="false">)</mo> <mo>&#x2208;<!-- ∈ --></mo> <msup> <mi>R</mi> <mrow class="MJX-TeXAtom-ORD"> <mo>+</mo> </mrow> </msup> </mrow> <mo>)</mo> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \forall x\forall y\forall z\left((x,y)\in R^{+}\wedge (y,z)\in R^{+}\Rightarrow (x,z)\in R^{+}\right)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/e785e5bd6f950ac4720195acf0603763b5e8de7a" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:50.187ex; height:3.176ex;" alt="{\displaystyle \forall x\forall y\forall z\left((x,y)\in R^{+}\wedge (y,z)\in R^{+}\Rightarrow (x,z)\in R^{+}\right)}"></span></dd></dl> <p>It can be proved using the fact that there is no relational algebra expression <i>E</i>(<i>R</i>) taking <i>R</i> as a variable argument that produces <i>R</i><sup>+</sup>.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">&#91;</span>7<span class="cite-bracket">&#93;</span></a></sup> </p><p>SQL however officially supports such <a href="/wiki/Hierarchical_and_recursive_queries_in_SQL" title="Hierarchical and recursive queries in SQL">fixpoint queries</a> since 1999, and it had vendor-specific extensions in this direction well before that. </p> <div class="mw-heading mw-heading2"><h2 id="Implementations">Implementations</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=21" title="Edit section: Implementations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The first query language to be based on Codd's algebra was Alpha, developed by Dr. Codd himself. Subsequently, <a href="/wiki/ISBL" title="ISBL">ISBL</a> was created, and this pioneering work has been acclaimed by many authorities<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> as having shown the way to make Codd's idea into a useful language. <a href="/wiki/Business_System_12" class="mw-redirect" title="Business System 12">Business System 12</a> was a short-lived industry-strength relational DBMS that followed the ISBL example. </p><p>In 1998 <a href="/wiki/Christopher_J._Date" title="Christopher J. Date">Chris Date</a> and <a href="/wiki/Hugh_Darwen" title="Hugh Darwen">Hugh Darwen</a> proposed a language called <b>Tutorial D</b> intended for use in teaching relational database theory, and its query language also draws on ISBL's ideas.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">&#91;</span>9<span class="cite-bracket">&#93;</span></a></sup> Rel is an implementation of <b>Tutorial D</b>. Bmg is an implementation of relational algebra in Ruby which closely follows the principles of <b>Tutorial D</b> and <i>The Third Manifesto</i>.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">&#91;</span>10<span class="cite-bracket">&#93;</span></a></sup> </p><p>Even the query language of <a href="/wiki/SQL" title="SQL">SQL</a> is loosely based on a relational algebra, though the operands in SQL (<a href="/wiki/Table_(database)" title="Table (database)">tables</a>) are not exactly <a href="/wiki/Relation_(database)" title="Relation (database)">relations</a> and several useful theorems about the relational algebra do not hold in the SQL counterpart (arguably to the detriment of optimisers and/or users). The SQL table model is a bag (<a href="/wiki/Multiset" title="Multiset">multiset</a>), rather than a set. For example, the expression <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (R\cup S)\setminus T=(R\setminus T)\cup (S\setminus T)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>R</mi> <mo>&#x222A;<!-- ∪ --></mo> <mi>S</mi> <mo stretchy="false">)</mo> <mo class="MJX-variant">&#x2216;<!-- ∖ --></mo> <mi>T</mi> <mo>=</mo> <mo stretchy="false">(</mo> <mi>R</mi> <mo class="MJX-variant">&#x2216;<!-- ∖ --></mo> <mi>T</mi> <mo stretchy="false">)</mo> <mo>&#x222A;<!-- ∪ --></mo> <mo stretchy="false">(</mo> <mi>S</mi> <mo class="MJX-variant">&#x2216;<!-- ∖ --></mo> <mi>T</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (R\cup S)\setminus T=(R\setminus T)\cup (S\setminus T)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/47bb90bb5ceff80faae30764493fe243e72f9ae4" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:31.711ex; height:2.843ex;" alt="{\displaystyle (R\cup S)\setminus T=(R\setminus T)\cup (S\setminus T)}"></span> is a theorem for relational algebra on sets, but not for relational algebra on bags.<sup id="cite_ref-Garcia-MolinaUllman2009_12-2" class="reference"><a href="#cite_note-Garcia-MolinaUllman2009-12"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=22" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1184024115">.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}</style><div class="div-col" style="column-width: 25em;"> <ul><li><a href="/wiki/Cartesian_product" title="Cartesian product">Cartesian product</a></li> <li><a href="/wiki/Codd%27s_theorem" title="Codd&#39;s theorem">Codd's theorem</a></li> <li><a href="/wiki/D4_(programming_language)" class="mw-redirect" title="D4 (programming language)">D4 (programming language)</a> (an implementation of D)</li> <li><a href="/wiki/Data_modeling" title="Data modeling">Data modeling</a></li> <li><a href="/wiki/Database" title="Database">Database</a></li> <li><a href="/wiki/Datalog" title="Datalog">Datalog</a></li> <li><a href="/wiki/Logic_of_relatives" class="mw-redirect" title="Logic of relatives">Logic of relatives</a></li> <li><a href="/wiki/Object-role_modeling" class="mw-redirect" title="Object-role modeling">Object-role modeling</a></li> <li><a href="/wiki/Projection_(mathematics)" title="Projection (mathematics)">Projection (mathematics)</a></li> <li><a href="/wiki/Projection_(relational_algebra)" title="Projection (relational algebra)">Projection (relational algebra)</a></li> <li><a href="/wiki/Projection_(set_theory)" title="Projection (set theory)">Projection (set theory)</a></li> <li><a href="/wiki/Relation_(mathematics)" title="Relation (mathematics)">Relation</a></li> <li><a href="/wiki/Relation_(database)" title="Relation (database)">Relation (database)</a></li> <li><a href="/wiki/Relation_algebra" title="Relation algebra">Relation algebra</a></li> <li><a href="/wiki/Relation_composition" class="mw-redirect" title="Relation composition">Relation composition</a></li> <li><a href="/wiki/Relation_construction" title="Relation construction">Relation construction</a></li> <li><a href="/wiki/Relational_calculus" title="Relational calculus">Relational calculus</a></li> <li><a href="/wiki/Relational_database" title="Relational database">Relational database</a></li> <li><a href="/wiki/Relational_model" title="Relational model">Relational model</a></li> <li><a href="/wiki/SQL" title="SQL">SQL</a></li> <li><a href="/wiki/Theory_of_relations" class="mw-redirect" title="Theory of relations">Theory of relations</a></li> <li><a href="/wiki/Triadic_relation" class="mw-redirect" title="Triadic relation">Triadic relation</a></li> <li><a href="/wiki/Tuple_relational_calculus" title="Tuple relational calculus">Tuple relational calculus</a></li></ul> </div> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=23" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist reflist-lower-alpha"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the join symbol is ⨝ (U+2A1D), and the bowtie symbol, occasionally used instead, is ⋈ (U+22C8).</span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the ltimes symbol is ⋉ (U+22C9). The rtimes symbol is ⋊ (U+22CA)</span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the Antijoin symbol is ▷ (U+25B7).</span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the Left outer join symbol is ⟕ (U+27D5).</span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the Right outer join symbol is ⟖ (U+27D6).</span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text">In <a href="/wiki/Unicode" title="Unicode">Unicode</a>, the Full Outer join symbol is ⟗ (U+27D7).</span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=24" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239543626"><div class="reflist"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-Codd1970-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-Codd1970_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Codd1970_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFCodd1970" class="citation journal cs1"><a href="/wiki/E.F._Codd" class="mw-redirect" title="E.F. Codd">Codd, E.F.</a> (1970). <a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F362384.362685">"A Relational Model of Data for Large Shared Data Banks"</a>. <i><a href="/wiki/Communications_of_the_ACM" title="Communications of the ACM">Communications of the ACM</a></i>. <b>13</b> (6): 377–387. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F362384.362685">10.1145/362384.362685</a></span>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&#160;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:207549016">207549016</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Communications+of+the+ACM&amp;rft.atitle=A+Relational+Model+of+Data+for+Large+Shared+Data+Banks&amp;rft.volume=13&amp;rft.issue=6&amp;rft.pages=377-387&amp;rft.date=1970&amp;rft_id=info%3Adoi%2F10.1145%2F362384.362685&amp;rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A207549016%23id-name%3DS2CID&amp;rft.aulast=Codd&amp;rft.aufirst=E.F.&amp;rft_id=https%3A%2F%2Fdoi.org%2F10.1145%252F362384.362685&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSilberschatzHenry_F._KorthS._Sudarshan2020" class="citation book cs1">Silberschatz, Abraham; Henry F. Korth; S. Sudarshan (2020). <i>Database system concepts</i> (Seventh&#160;ed.). New York. p.&#160;56. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-0-07-802215-9" title="Special:BookSources/978-0-07-802215-9"><bdi>978-0-07-802215-9</bdi></a>. <a href="/wiki/OCLC_(identifier)" class="mw-redirect" title="OCLC (identifier)">OCLC</a>&#160;<a rel="nofollow" class="external text" href="https://search.worldcat.org/oclc/1080554130">1080554130</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Database+system+concepts&amp;rft.place=New+York&amp;rft.pages=56&amp;rft.edition=Seventh&amp;rft.date=2020&amp;rft_id=info%3Aoclcnum%2F1080554130&amp;rft.isbn=978-0-07-802215-9&amp;rft.aulast=Silberschatz&amp;rft.aufirst=Abraham&amp;rft.au=Henry+F.+Korth&amp;rft.au=S.+Sudarshan&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span><span class="cs1-maint citation-comment"><code class="cs1-code">{{<a href="/wiki/Template:Cite_book" title="Template:Cite book">cite book</a>}}</code>: CS1 maint: location missing publisher (<a href="/wiki/Category:CS1_maint:_location_missing_publisher" title="Category:CS1 maint: location missing publisher">link</a>)</span></span> </li> <li id="cite_note-ÖzsuValduriez2011-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-ÖzsuValduriez2011_6-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFM._Tamer_ÖzsuPatrick_Valduriez2011" class="citation book cs1">M. Tamer Özsu; Patrick Valduriez (2011). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=TOBaLQMuNV4C&amp;pg=PA46"><i>Principles of Distributed Database Systems</i></a> (3rd&#160;ed.). Springer. p.&#160;46. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-1-4419-8833-1" title="Special:BookSources/978-1-4419-8833-1"><bdi>978-1-4419-8833-1</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Principles+of+Distributed+Database+Systems&amp;rft.pages=46&amp;rft.edition=3rd&amp;rft.pub=Springer&amp;rft.date=2011&amp;rft.isbn=978-1-4419-8833-1&amp;rft.au=M.+Tamer+%C3%96zsu&amp;rft.au=Patrick+Valduriez&amp;rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DTOBaLQMuNV4C%26pg%3DPA46&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-O&#39;NeilO&#39;Neil2001-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-O&#39;NeilO&#39;Neil2001_7-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFPatrick_O&#39;NeilElizabeth_O&#39;Neil2001" class="citation book cs1">Patrick O'Neil; <a href="/wiki/Elizabeth_O%27Neil" title="Elizabeth O&#39;Neil">Elizabeth O'Neil</a> (2001). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=UXh4qTpmO8QC&amp;pg=PA120"><i>Database: Principles, Programming, and Performance, Second Edition</i></a>. Morgan Kaufmann. p.&#160;120. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-1-55860-438-4" title="Special:BookSources/978-1-55860-438-4"><bdi>978-1-55860-438-4</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Database%3A+Principles%2C+Programming%2C+and+Performance%2C+Second+Edition&amp;rft.pages=120&amp;rft.pub=Morgan+Kaufmann&amp;rft.date=2001&amp;rft.isbn=978-1-55860-438-4&amp;rft.au=Patrick+O%27Neil&amp;rft.au=Elizabeth+O%27Neil&amp;rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DUXh4qTpmO8QC%26pg%3DPA120&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-Date2011-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-Date2011_11-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFC._J._Date2011" class="citation book cs1">C. J. Date (2011). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=WuZGD5tBfMwC&amp;pg=PA133"><i>SQL and Relational Theory: How to Write Accurate SQL Code</i></a>. O'Reilly Media, Inc. pp.&#160;133–135. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-1-4493-1974-8" title="Special:BookSources/978-1-4493-1974-8"><bdi>978-1-4493-1974-8</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=SQL+and+Relational+Theory%3A+How+to+Write+Accurate+SQL+Code&amp;rft.pages=133-135&amp;rft.pub=O%27Reilly+Media%2C+Inc.&amp;rft.date=2011&amp;rft.isbn=978-1-4493-1974-8&amp;rft.au=C.+J.+Date&amp;rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DWuZGD5tBfMwC%26pg%3DPA133&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-Garcia-MolinaUllman2009-12"><span class="mw-cite-backlink">^ <a href="#cite_ref-Garcia-MolinaUllman2009_12-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Garcia-MolinaUllman2009_12-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Garcia-MolinaUllman2009_12-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFHector_Garcia-MolinaJeffrey_D._UllmanJennifer_Widom2009" class="citation book cs1"><a href="/wiki/Hector_Garcia-Molina" class="mw-redirect" title="Hector Garcia-Molina">Hector Garcia-Molina</a>; <a href="/wiki/Jeffrey_Ullman" title="Jeffrey Ullman">Jeffrey D. Ullman</a>; <a href="/wiki/Jennifer_Widom" title="Jennifer Widom">Jennifer Widom</a> (2009). <i>Database systems: the complete book</i> (2nd&#160;ed.). Pearson Prentice Hall. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/978-0-13-187325-4" title="Special:BookSources/978-0-13-187325-4"><bdi>978-0-13-187325-4</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Database+systems%3A+the+complete+book&amp;rft.edition=2nd&amp;rft.pub=Pearson+Prentice+Hall&amp;rft.date=2009&amp;rft.isbn=978-0-13-187325-4&amp;rft.au=Hector+Garcia-Molina&amp;rft.au=Jeffrey+D.+Ullman&amp;rft.au=Jennifer+Widom&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFAhoJeffrey_D._Ullman1979" class="citation journal cs1">Aho, Alfred V.; Jeffrey D. Ullman (1979). <a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F567752.567763">"Universality of data retrieval languages"</a>. <i>Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages</i>: 110–119. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F567752.567763">10.1145/567752.567763</a></span>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&#160;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:3242505">3242505</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Proceedings+of+the+6th+ACM+SIGACT-SIGPLAN+Symposium+on+Principles+of+Programming+Languages&amp;rft.atitle=Universality+of+data+retrieval+languages&amp;rft.pages=110-119&amp;rft.date=1979&amp;rft_id=info%3Adoi%2F10.1145%2F567752.567763&amp;rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A3242505%23id-name%3DS2CID&amp;rft.aulast=Aho&amp;rft.aufirst=Alfred+V.&amp;rft.au=Jeffrey+D.+Ullman&amp;rft_id=https%3A%2F%2Fdoi.org%2F10.1145%252F567752.567763&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFC._J._Date" class="citation web cs1">C. J. Date. <a rel="nofollow" class="external text" href="https://amturing.acm.org/award_winners/codd_1000892.cfm">"Edgar F. Codd - A.M. Turing Award Laureate"</a>. <i>amturing.acm.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2020-12-27</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=amturing.acm.org&amp;rft.atitle=Edgar+F.+Codd+-+A.M.+Turing+Award+Laureate&amp;rft.au=C.+J.+Date&amp;rft_id=https%3A%2F%2Famturing.acm.org%2Faward_winners%2Fcodd_1000892.cfm&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFC._J._Date_and_Hugh_Darwen" class="citation web cs1">C. J. Date and Hugh Darwen. <a rel="nofollow" class="external text" href="https://www.dcs.warwick.ac.uk/~hugh/TTM/DTATRM.pdf">"Databases, Types, and the Relational model: The Third Manifesto"</a> <span class="cs1-format">(PDF)</span><span class="reference-accessdate">. Retrieved <span class="nowrap">2024-07-04</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Databases%2C+Types%2C+and+the+Relational+model%3A+The+Third+Manifesto&amp;rft.au=C.+J.+Date+and+Hugh+Darwen&amp;rft_id=https%3A%2F%2Fwww.dcs.warwick.ac.uk%2F~hugh%2FTTM%2FDTATRM.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.relational-algebra.dev/">"Bmg documentation"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2024-07-04</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Bmg+documentation&amp;rft_id=https%3A%2F%2Fwww.relational-algebra.dev%2F&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=25" title="Edit section: Further reading"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFImielińskiLipski1984" class="citation journal cs1"><a href="/wiki/Tomasz_Imieli%C5%84ski" title="Tomasz Imieliński">Imieliński, T.</a>; Lipski, W. (1984). <a rel="nofollow" class="external text" href="https://doi.org/10.1016%2F0022-0000%2884%2990077-1">"The relational model of data and cylindric algebras"</a>. <i><a href="/wiki/Journal_of_Computer_and_System_Sciences" title="Journal of Computer and System Sciences">Journal of Computer and System Sciences</a></i>. <b>28</b>: 80–102. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1016%2F0022-0000%2884%2990077-1">10.1016/0022-0000(84)90077-1</a></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Journal+of+Computer+and+System+Sciences&amp;rft.atitle=The+relational+model+of+data+and+cylindric+algebras&amp;rft.volume=28&amp;rft.pages=80-102&amp;rft.date=1984&amp;rft_id=info%3Adoi%2F10.1016%2F0022-0000%2884%2990077-1&amp;rft.aulast=Imieli%C5%84ski&amp;rft.aufirst=T.&amp;rft.au=Lipski%2C+W.&amp;rft_id=https%3A%2F%2Fdoi.org%2F10.1016%252F0022-0000%252884%252990077-1&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3ARelational+algebra" class="Z3988"></span> (For relationship with <a href="/wiki/Cylindric_algebra" title="Cylindric algebra">cylindric algebras</a>).</li></ul> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Relational_algebra&amp;action=edit&amp;section=26" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444"><table class="box-External_links plainlinks metadata ambox ambox-style ambox-external_links" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/40px-Edit-clear.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/60px-Edit-clear.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/80px-Edit-clear.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article's <b>use of <a href="/wiki/Wikipedia:External_links" title="Wikipedia:External links">external links</a> may not follow Wikipedia's policies or guidelines</b>.<span class="hide-when-compact"> Please <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Relational_algebra&amp;action=edit">improve this article</a> by removing <a href="/wiki/Wikipedia:What_Wikipedia_is_not#Wikipedia_is_not_a_mirror_or_a_repository_of_links,_images,_or_media_files" title="Wikipedia:What Wikipedia is not">excessive</a> or <a href="/wiki/Wikipedia:External_links" title="Wikipedia:External links">inappropriate</a> external links, and converting useful links where appropriate into <a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">footnote references</a>.</span> <span class="date-container"><i>(<span class="date">January 2017</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <ul><li><a rel="nofollow" class="external text" href="https://web.archive.org/web/20220330063834/https://www.slinfo.una.ac.cr/rat/rat.html">RAT Relational Algebra Translator</a> Free software to convert relational algebra to SQL</li> <li><a rel="nofollow" class="external text" href="http://www.databaselecture.com/processing.html">Lecture Videos: Relational Algebra Processing</a> - An introduction to how database systems process relational algebra</li> <li><a rel="nofollow" class="external text" href="http://www.databasteknik.se/webbkursen/relalg-lecture/index.html">Lecture Notes: Relational Algebra</a> – A quick tutorial to adapt SQL queries into relational algebra</li> <li><a rel="nofollow" class="external text" href="https://ltworf.codeberg.page/relational/">Relational – A graphic implementation of the relational algebra</a></li> <li><a rel="nofollow" class="external text" href="https://graal.ens-lyon.fr/~yrobert/henri3/ioannidis96query.pdf">Query Optimization</a> This paper is an introduction into the use of the relational algebra in optimizing queries, and includes numerous citations for more in-depth study.</li> <li><a rel="nofollow" class="external text" href="https://www.cse.fau.edu/~marty/index.html#RADownload">Relational Algebra System for Oracle and Microsoft SQL Server</a></li> <li><a rel="nofollow" class="external text" href="https://centaurialpha.github.io/pireal/index.html">Pireal – An experimental educational tool for working with Relational Algebra</a></li> <li><a rel="nofollow" class="external text" href="http://des.sourceforge.net">DES – An educational tool for working with Relational Algebra and other formal languages</a></li> <li><a rel="nofollow" class="external text" href="https://dbis-uibk.github.io/relax/">RelaX - Relational Algebra Calculator</a> (open-source software available as an online service without registration)</li> <li><a rel="nofollow" class="external text" href="https://users.cs.duke.edu/~junyang/ra2/">RA: A Relational Algebra Interpreter</a></li> <li><a rel="nofollow" class="external text" href="http://mlwiki.org/index.php/Translating_SQL_to_Relational_Algebra">Translating SQL to Relational Algebra</a></li></ul> <div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="Database_management_systems" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Databases" title="Template:Databases"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Databases" title="Template talk:Databases"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Databases" title="Special:EditPage/Template:Databases"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Database_management_systems" style="font-size:114%;margin:0 4em"><a href="/wiki/Database" title="Database">Database management systems</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%">Types</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Object_database" title="Object database">Object-oriented</a> <ul><li><a href="/wiki/Comparison_of_object_database_management_systems" title="Comparison of object database management systems">comparison</a></li></ul></li> <li><a href="/wiki/Relational_database" title="Relational database">Relational</a> <ul><li><a href="/wiki/List_of_relational_database_management_systems" title="List of relational database management systems">list</a></li> <li><a href="/wiki/Comparison_of_relational_database_management_systems" title="Comparison of relational database management systems">comparison</a></li></ul></li> <li><a href="/wiki/Key%E2%80%93value_database" title="Key–value database">Key–value</a></li> <li><a href="/wiki/Column-oriented_DBMS" class="mw-redirect" title="Column-oriented DBMS">Column-oriented</a> <ul><li><a href="/wiki/List_of_column-oriented_DBMSes" title="List of column-oriented DBMSes">list</a></li></ul></li> <li><a href="/wiki/Document-oriented_database" title="Document-oriented database">Document-oriented</a></li> <li><a href="/wiki/Wide-column_store" title="Wide-column store">Wide-column store</a></li> <li><a href="/wiki/Graph_database" title="Graph database">Graph</a></li> <li><a href="/wiki/NoSQL" title="NoSQL">NoSQL</a></li> <li><a href="/wiki/NewSQL" title="NewSQL">NewSQL</a></li> <li><a href="/wiki/In-memory_database" title="In-memory database">In-memory</a> <ul><li><a href="/wiki/List_of_in-memory_databases" title="List of in-memory databases">list</a></li></ul></li> <li><a href="/wiki/Multi-model_database" title="Multi-model database">Multi-model</a> <ul><li><a href="/wiki/Comparison_of_multi-model_databases" title="Comparison of multi-model databases">comparison</a></li></ul></li> <li><a href="/wiki/Cloud_database" title="Cloud database">Cloud</a></li> <li><a href="/wiki/Blockchain-based_database" title="Blockchain-based database">Blockchain-based database</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Concepts</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Database" title="Database">Database</a></li> <li><a href="/wiki/ACID" title="ACID">ACID</a></li> <li><a href="/wiki/Armstrong%27s_axioms" title="Armstrong&#39;s axioms">Armstrong's axioms</a></li> <li><a href="/wiki/Codd%27s_12_rules" title="Codd&#39;s 12 rules">Codd's 12 rules</a></li> <li><a href="/wiki/CAP_theorem" title="CAP theorem">CAP theorem</a></li> <li><a href="/wiki/Create,_read,_update_and_delete" title="Create, read, update and delete">CRUD</a></li> <li><a href="/wiki/Null_(SQL)" title="Null (SQL)">Null</a></li> <li><a href="/wiki/Candidate_key" title="Candidate key">Candidate key</a></li> <li><a href="/wiki/Foreign_key" title="Foreign key">Foreign key</a></li> <li><a href="/wiki/PACELC_theorem" title="PACELC theorem">PACELC theorem</a></li> <li><a href="/wiki/Superkey" title="Superkey">Superkey</a></li> <li><a href="/wiki/Surrogate_key" title="Surrogate key">Surrogate key</a></li> <li><a href="/wiki/Unique_key" title="Unique key">Unique key</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Objects</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Relation_(database)" title="Relation (database)">Relation</a> <ul><li><a href="/wiki/Table_(database)" title="Table (database)">table</a></li> <li><a href="/wiki/Column_(database)" title="Column (database)">column</a></li> <li><a href="/wiki/Row_(database)" title="Row (database)">row</a></li></ul></li> <li><a href="/wiki/View_(SQL)" title="View (SQL)">View</a></li> <li><a href="/wiki/Database_transaction" title="Database transaction">Transaction</a></li> <li><a href="/wiki/Transaction_log" title="Transaction log">Transaction log</a></li> <li><a href="/wiki/Database_trigger" title="Database trigger">Trigger</a></li> <li><a href="/wiki/Database_index" title="Database index">Index</a></li> <li><a href="/wiki/Stored_procedure" title="Stored procedure">Stored procedure</a></li> <li><a href="/wiki/Cursor_(databases)" title="Cursor (databases)">Cursor</a></li> <li><a href="/wiki/Partition_(database)" title="Partition (database)">Partition</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Components</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Concurrency_control" title="Concurrency control">Concurrency control</a></li> <li><a href="/wiki/Data_dictionary" title="Data dictionary">Data dictionary</a></li> <li><a href="/wiki/Java_Database_Connectivity" title="Java Database Connectivity">JDBC</a></li> <li><a href="/wiki/XQuery_API_for_Java" title="XQuery API for Java">XQJ</a></li> <li><a href="/wiki/Open_Database_Connectivity" title="Open Database Connectivity">ODBC</a></li> <li><a href="/wiki/Query_language" title="Query language">Query language</a></li> <li><a href="/wiki/Query_optimization" title="Query optimization">Query optimizer</a></li> <li><a href="/wiki/Query_Rewriting" class="mw-redirect" title="Query Rewriting">Query rewriting system</a></li> <li><a href="/wiki/Query_plan" title="Query plan">Query plan</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Functions</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Database_administration" title="Database administration">Administration</a></li> <li><a href="/wiki/Query_optimization" title="Query optimization">Query optimization</a></li> <li><a href="/wiki/Replication_(computing)#DATABASE" title="Replication (computing)">Replication</a></li> <li><a href="/wiki/Shard_(database_architecture)" title="Shard (database architecture)">Sharding</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Related topics</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Database_model" title="Database model">Database models</a></li> <li><a href="/wiki/Database_normalization" title="Database normalization">Database normalization</a></li> <li><a href="/wiki/Database_storage_structures" title="Database storage structures">Database storage</a></li> <li><a href="/wiki/Distributed_database" title="Distributed database">Distributed database</a></li> <li><a href="/wiki/Federated_database_system" title="Federated database system">Federated database system</a></li> <li><a href="/wiki/Referential_integrity" title="Referential integrity">Referential integrity</a></li> <li><a class="mw-selflink selflink">Relational algebra</a></li> <li><a href="/wiki/Relational_calculus" title="Relational calculus">Relational calculus</a></li> <li><a href="/wiki/Relational_model" title="Relational model">Relational model</a></li> <li><a href="/wiki/Object%E2%80%93relational_database" title="Object–relational database">Object–relational database</a></li> <li><a href="/wiki/Transaction_processing" title="Transaction processing">Transaction processing</a></li></ul> </div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div> <ul><li><span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <a href="/wiki/Category:Database_management_systems" title="Category:Database management systems">Category</a></li> <li><span class="noviewer" typeof="mw:File"><span title="Outline"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/4/41/Global_thinking.svg/10px-Global_thinking.svg.png" decoding="async" width="10" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/41/Global_thinking.svg/15px-Global_thinking.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/4/41/Global_thinking.svg/21px-Global_thinking.svg.png 2x" data-file-width="130" data-file-height="200" /></span></span> <a href="/wiki/Outline_of_databases" title="Outline of databases">Outline</a></li> <li><span class="noviewer" typeof="mw:File"><span title="WikiProject"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/3/37/People_icon.svg/16px-People_icon.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/3/37/People_icon.svg/24px-People_icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/3/37/People_icon.svg/32px-People_icon.svg.png 2x" data-file-width="100" data-file-height="100" /></span></span> <a href="/wiki/Wikipedia:WikiProject_Databases" title="Wikipedia:WikiProject Databases">WikiProject</a></li></ul> </div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐5c59558b9d‐jmmsq Cached time: 20241130201102 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.657 seconds Real time usage: 0.927 seconds Preprocessor visited node count: 5552/1000000 Post‐expand include size: 79448/2097152 bytes Template argument size: 9749/2097152 bytes Highest expansion depth: 16/100 Expensive parser function count: 15/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 70555/5000000 bytes Lua time usage: 0.316/10.000 seconds Lua memory usage: 7220042/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 689.252 1 -total 24.61% 169.626 2 Template:Reflist 16.39% 112.963 3 Template:Cite_journal 13.32% 91.811 1 Template:Databases 12.83% 88.427 1 Template:Navbox 11.53% 79.438 6 Template:Fact 11.00% 75.833 1 Template:Short_description 9.67% 66.632 6 Template:Fix 7.59% 52.345 1 Template:Split_section 7.17% 49.390 2 Template:Pagetype --> <!-- Saved in parser cache with key enwiki:pcache:idhash:175285-0!canonical and timestamp 20241130201102 and revision id 1257005006. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1&amp;useformat=desktop" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Relational_algebra&amp;oldid=1257005006">https://en.wikipedia.org/w/index.php?title=Relational_algebra&amp;oldid=1257005006</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Database_management_systems" title="Category:Database management systems">Database management systems</a></li><li><a href="/wiki/Category:Relational_algebra" title="Category:Relational algebra">Relational algebra</a></li><li><a href="/wiki/Category:Relational_model" title="Category:Relational model">Relational model</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:CS1_maint:_location_missing_publisher" title="Category:CS1 maint: location missing publisher">CS1 maint: location missing publisher</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Articles_to_be_split_from_March_2023" title="Category:Articles to be split from March 2023">Articles to be split from March 2023</a></li><li><a href="/wiki/Category:All_articles_to_be_split" title="Category:All articles to be split">All articles to be split</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_April_2022" title="Category:Articles with unsourced statements from April 2022">Articles with unsourced statements from April 2022</a></li><li><a href="/wiki/Category:Wikipedia_external_links_cleanup_from_January_2017" title="Category:Wikipedia external links cleanup from January 2017">Wikipedia external links cleanup from January 2017</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 12 November 2024, at 18:08<span class="anonymous-show">&#160;(UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Relational_algebra&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5c59558b9d-r8qsn","wgBackendResponseTime":168,"wgPageParseReport":{"limitreport":{"cputime":"0.657","walltime":"0.927","ppvisitednodes":{"value":5552,"limit":1000000},"postexpandincludesize":{"value":79448,"limit":2097152},"templateargumentsize":{"value":9749,"limit":2097152},"expansiondepth":{"value":16,"limit":100},"expensivefunctioncount":{"value":15,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":70555,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 689.252 1 -total"," 24.61% 169.626 2 Template:Reflist"," 16.39% 112.963 3 Template:Cite_journal"," 13.32% 91.811 1 Template:Databases"," 12.83% 88.427 1 Template:Navbox"," 11.53% 79.438 6 Template:Fact"," 11.00% 75.833 1 Template:Short_description"," 9.67% 66.632 6 Template:Fix"," 7.59% 52.345 1 Template:Split_section"," 7.17% 49.390 2 Template:Pagetype"]},"scribunto":{"limitreport-timeusage":{"value":"0.316","limit":"10.000"},"limitreport-memusage":{"value":7220042,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-5c59558b9d-jmmsq","timestamp":"20241130201102","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Relational algebra","url":"https:\/\/en.wikipedia.org\/wiki\/Relational_algebra","sameAs":"http:\/\/www.wikidata.org\/entity\/Q840540","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q840540","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2003-01-27T16:55:52Z","dateModified":"2024-11-12T18:08:14Z","headline":"family of algebras used for modelling the data stored in relational databases, and defining queries on it"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10