{"id":2889,"date":"2021-08-23T15:44:13","date_gmt":"2021-08-23T10:14:13","guid":{"rendered":"https:\/\/binaryterms.com\/?p=2889"},"modified":"2021-08-24T10:14:45","modified_gmt":"2021-08-24T04:44:45","slug":"domain-relational-calculus","status":"publish","type":"post","link":"https:\/\/binaryterms.com\/domain-relational-calculus.html","title":{"rendered":"Domain Relational Calculus"},"content":{"rendered":"<p><span data-preserver-spaces=\"true\"><strong>Domain relational calculus<\/strong> (DRC) is a formal query language that is &#8216;non-procedural&#8217; and &#8216;declarative&#8217;. Being a form of relational calculus the domain relation calculus also specifies what information has to be retrieved, not how that information has to be retrieved.\u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">Domain relational calculus is much similar to the tuple relational calculus the only difference is that the variables it uses in the formula are the domain variables. The domain variable is the variable whose value ranges over the domain of an attribute.\u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">DRC forms the basis for the language <strong>Query-By-Example (QBE)<\/strong> as the tuple relation calculus form the basis for structured query language (SQL). In the section ahead we will discuss the format of the expression in DRC.\u00a0<\/span><\/p>\n<h2><span data-preserver-spaces=\"true\">Expressions in Domain Relation Calculus<\/span><\/h2>\n<p><span data-preserver-spaces=\"true\">To retrieve the information using domain relation calculus the expressions are of the form:<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">{&lt; x1, x2, . . . , xn &gt; | P(x1, x2, . . . , xn)}<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">You can observe the expression above is expressed in two parts. The first part presents the list of the domain variables whose values we are expecting the result relation and the second part represent the formula or condition that must be satisfied by the specified domain variables.\u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">The formula in the above expression is made of several atoms where an atom is a formula that doesn&#8217;t have a deeper propositional structure or we can say a formula that doesn&#8217;t hold any subformula. In short, an atom is a simple formula made of simple logic. These atoms can be of the following form:<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">&lt; x1, x2, . . . , xn &gt; \u2208 r this means all the domain variables from x1 to xn are the attributes to the relation r.\u00a0<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">The formula may have xi op xj where op is the comparison operator which could be anything from &lt;, \u2264, =, =, &gt;, \u2265 and xi and xj are the attributes or domain variables that can be compared.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">The atom may be of the form xi op c where again op is the comparison operator and c is the constant that has to be compared with the domain variable xi.\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-preserver-spaces=\"true\">Now we use the following rules to define the formula in domain relation calculus expression.\u00a0<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">If you are considering P1 as a formula then \u00acP1 and (P1) are also the formula.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">If we have P1 and P2 as formulae then P1 \u2228 P2, P1 \u2227 P2, and P1 \u21d2 P2 are also the formulae.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">If P1(x) is a formula where x is a free domain variable then \u2203 x (P1(x)) and \u2200 x (P1(x)).<\/span><\/li>\n<\/ul>\n<h3>Queries in Domain Relational Calculus<\/h3>\n<p>Let us overview some examples of domain relational calculus. Let us consider we have a relation instructor with domain variables ID, Name, Dept_Name, Salary.<\/p>\n<p>Now if you have to determine details of all the instructors then domain relational calculus expression for the same would be<\/p>\n<p>{&lt;I,n, d, s&gt;\/&lt;I,n,d, s&gt; <span data-preserver-spaces=\"true\">\u2208 instructor<\/span>}<\/p>\n<p>To select the name of the instructor whose salary is greater than $50,000, the expression would be<\/p>\n<p>{&lt;n&gt;\/&lt;I,n,d, s&gt; <span data-preserver-spaces=\"true\">\u2208 instructor \u2227 s &gt; 50000<\/span>}<\/p>\n<h3>Safety Expression<\/h3>\n<p><span data-preserver-spaces=\"true\">A Domain relation calculus expression is considered a safe expression if it produces a finite number of values that are present in the domain of the expression. The expression below is unsafe as it will result in values that are not in the domain of the expression.\u00a0\u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">{ c&lt; i, n, d, s &gt; | \u00ac(&lt; i, n, d, s &gt; \u2208 instructor )}\u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">To define a restriction to the relational calculus formula so, that it yields a finite number of values referenced by the domain of the formula we must include &#8216;there exist&#8217; and &#8216;for all&#8217; clauses with the following rules.<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">All the values appearing in the result of domain relational calculus expression must be from\u00a0<\/span><em><span data-preserver-spaces=\"true\">dom(<\/span><\/em><span data-preserver-spaces=\"true\">P<\/span><em><span data-preserver-spaces=\"true\">).\u00a0<\/span><\/em><\/li>\n<li><span data-preserver-spaces=\"true\">The subformula, \u2203 x (P1(x)) including &#8216;there exist&#8217; clause is true if there exists a value x in the domain of the formula P1 i.e.\u00a0<\/span><em><span data-preserver-spaces=\"true\">dom(<\/span><\/em><span data-preserver-spaces=\"true\">P1<\/span><em><span data-preserver-spaces=\"true\">), and such that P1(x) is true.<\/span><\/em><\/li>\n<li><span data-preserver-spaces=\"true\">The subformula, \u2200x (P1(x)) including &#8216;for all&#8217; clause is true if, for all values of x, P1 (x) is true from\u00a0<\/span><em><span data-preserver-spaces=\"true\">dom(<\/span><\/em><span data-preserver-spaces=\"true\">P1<\/span><em><span data-preserver-spaces=\"true\">)<\/span><\/em><span data-preserver-spaces=\"true\">.<\/span><\/li>\n<\/ul>\n<p><span data-preserver-spaces=\"true\">The restrictions we defined above reduces the expression to the finite number of tuples that we have to consider to determine the result of the expression.\u00a0<\/span><\/p>\n<p>To find all the instructor ID in the database whose salary is greater than 50000 the expression would be:<\/p>\n<p>{&lt; i &gt; | \u2203 n, d, s (&lt; i, n, d, s &gt; \u2208 instructor \u2227 s &gt; 80000)}<\/p>\n<h3>Expressive Power of Languages<\/h3>\n<p><span data-preserver-spaces=\"true\">The safe expressions in domain relational calculus are equivalent to the safe expressions in tuple relational calculus. On the other hand, when tuple relational calculus is restricted to the safe expression it becomes equivalent to relational algebra.\u00a0 \u00a0 \u00a0<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">In short, all three i.e., basic relational algebra expression, restricted safe tuple relational calculus expression and restricted safe domain relational calculus expression has the equivalent expressive power. Although, like tuple relational calculus, the domain relational calculus is also unable to express aggregation, grouping and ordering but, it can be extended to support all this.\u00a0<\/span><\/p>\n<p>So, this is all about the domain relational calculus that is a non-procedural declarative language. The domain relational calculus uses the domain variables in the formula to retrieve the desired information and it is the basis for the language query-by-example QBE.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Domain relational calculus (DRC) is a formal query language that is &#8216;non-procedural&#8217; and &#8216;declarative&#8217;. Being a form of relational calculus the domain relation calculus also specifies what information has to be retrieved, not how that information has to be retrieved.\u00a0 Domain relational calculus is much similar to the tuple relational calculus the only difference is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[4],"tags":[],"class_list":{"0":"post-2889","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-dbms","7":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Domain Relational Calculus? Brief Explanation - Binary Terms<\/title>\n<meta name=\"description\" content=\"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/binaryterms.com\/domain-relational-calculus.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Domain Relational Calculus? Brief Explanation - Binary Terms\" \/>\n<meta property=\"og:description\" content=\"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/binaryterms.com\/domain-relational-calculus.html\" \/>\n<meta property=\"og:site_name\" content=\"Binary Terms\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-23T10:14:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-24T04:44:45+00:00\" \/>\n<meta name=\"author\" content=\"Neha T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Neha T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html\"},\"author\":{\"name\":\"Neha T\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\"},\"headline\":\"Domain Relational Calculus\",\"datePublished\":\"2021-08-23T10:14:13+00:00\",\"dateModified\":\"2021-08-24T04:44:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html\"},\"wordCount\":879,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"articleSection\":[\"DBMS\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/binaryterms.com\/domain-relational-calculus.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html\",\"url\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html\",\"name\":\"What is Domain Relational Calculus? Brief Explanation - Binary Terms\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/#website\"},\"datePublished\":\"2021-08-23T10:14:13+00:00\",\"dateModified\":\"2021-08-24T04:44:45+00:00\",\"description\":\"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.\",\"breadcrumb\":{\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/binaryterms.com\/domain-relational-calculus.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/binaryterms.com\/domain-relational-calculus.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/binaryterms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Domain Relational Calculus\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/binaryterms.com\/#website\",\"url\":\"https:\/\/binaryterms.com\/\",\"name\":\"Binary Terms\",\"description\":\"The Computer Science &amp; IT Guide\",\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/binaryterms.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/binaryterms.com\/#organization\",\"name\":\"Binary Terms\",\"url\":\"https:\/\/binaryterms.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"width\":400,\"height\":63,\"caption\":\"Binary Terms\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\",\"name\":\"Neha T\",\"url\":\"https:\/\/binaryterms.com\/author\/author\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Domain Relational Calculus? Brief Explanation - Binary Terms","description":"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/binaryterms.com\/domain-relational-calculus.html","og_locale":"en_GB","og_type":"article","og_title":"What is Domain Relational Calculus? Brief Explanation - Binary Terms","og_description":"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.","og_url":"https:\/\/binaryterms.com\/domain-relational-calculus.html","og_site_name":"Binary Terms","article_published_time":"2021-08-23T10:14:13+00:00","article_modified_time":"2021-08-24T04:44:45+00:00","author":"Neha T","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Neha T","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html#article","isPartOf":{"@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html"},"author":{"name":"Neha T","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe"},"headline":"Domain Relational Calculus","datePublished":"2021-08-23T10:14:13+00:00","dateModified":"2021-08-24T04:44:45+00:00","mainEntityOfPage":{"@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html"},"wordCount":879,"commentCount":0,"publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"articleSection":["DBMS"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/binaryterms.com\/domain-relational-calculus.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html","url":"https:\/\/binaryterms.com\/domain-relational-calculus.html","name":"What is Domain Relational Calculus? Brief Explanation - Binary Terms","isPartOf":{"@id":"https:\/\/binaryterms.com\/#website"},"datePublished":"2021-08-23T10:14:13+00:00","dateModified":"2021-08-24T04:44:45+00:00","description":"Domain relational calculus is a formal query language that is non-procedural and declarative that describes what information is required.","breadcrumb":{"@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/binaryterms.com\/domain-relational-calculus.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/binaryterms.com\/domain-relational-calculus.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/binaryterms.com\/"},{"@type":"ListItem","position":2,"name":"Domain Relational Calculus"}]},{"@type":"WebSite","@id":"https:\/\/binaryterms.com\/#website","url":"https:\/\/binaryterms.com\/","name":"Binary Terms","description":"The Computer Science &amp; IT Guide","publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/binaryterms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/binaryterms.com\/#organization","name":"Binary Terms","url":"https:\/\/binaryterms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","width":400,"height":63,"caption":"Binary Terms"},"image":{"@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe","name":"Neha T","url":"https:\/\/binaryterms.com\/author\/author"}]}},"_links":{"self":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/comments?post=2889"}],"version-history":[{"count":7,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2889\/revisions"}],"predecessor-version":[{"id":2896,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2889\/revisions\/2896"}],"wp:attachment":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/media?parent=2889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/categories?post=2889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/tags?post=2889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}