{"id":160333,"date":"2023-09-26T12:57:18","date_gmt":"2023-09-26T07:27:18","guid":{"rendered":"https:\/\/www.gkseries.com\/blog\/?p=160333"},"modified":"2023-09-26T12:57:19","modified_gmt":"2023-09-26T07:27:19","slug":"consider-the-relations-ra-b-and-sb-c-where-s-b-is-a-primary-key-and-r-b-is-a-foreign-key-referencing-s-b","status":"publish","type":"post","link":"https:\/\/www.gkseries.com\/blog\/consider-the-relations-ra-b-and-sb-c-where-s-b-is-a-primary-key-and-r-b-is-a-foreign-key-referencing-s-b\/","title":{"rendered":"Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B"},"content":{"rendered":"\n<p>Q. Consider the relations <em>r<\/em>(<em>A, B<\/em>) and <em>s<\/em>(<em>B, C<\/em>), where <em>s<strong>.<\/strong>B <\/em>is a primary key and <em>r<strong>.<\/strong>B <\/em>is a foreign key referencing <em>s<strong>.<\/strong>B<\/em>. Consider the query<\/p>\n\n\n\n<p>Q:\u00a0\u00a0 \ud835\udc5f \u22c8 (\ud835\udf0e\ud835\udc35&lt;5(\ud835\udc60))<\/p>\n\n\n\n<p>Let <em>LOJ <\/em>denote the natural left outer-join operation. Assume that <em>r <\/em>and <em>s <\/em>contain no null values.<\/p>\n\n\n\n<p>Which one of the following queries is NOT equivalent to Q?<\/p>\n\n\n\n<p>(A) \ud835\udf0e\ud835\udc35&lt;5(\ud835\udc5f \u22c8 \ud835\udc60)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (B) \ud835\udf0e\ud835\udc35&lt;5(\ud835\udc5f \ud835\udc3f\ud835\udc42\ud835\udc3d \ud835\udc60)<\/p>\n\n\n\n<p>(C) \ud835\udc5f \ud835\udc3f\ud835\udc42\ud835\udc3d (\ud835\udf0e\ud835\udc35&lt;5(\ud835\udc60))\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (D) \ud835\udf0e\ud835\udc35&lt;5(\ud835\udc5f) \ud835\udc3f\ud835\udc42\ud835\udc3d \ud835\udc60<\/p>\n\n\n\n<p>Ans: \ud835\udc5f \ud835\udc3f\ud835\udc42\ud835\udc3d (\ud835\udf0e\ud835\udc35&lt;5(\ud835\udc60))\u00a0\u00a0<\/p>\n\n\n\n<p>Sol:<\/p>\n\n\n\n<p>Since, we are joining\/LOJ using attribute B which is primary key of table s and foreign key of table r.<\/p>\n\n\n\n<p>So, we need to apply condition \u03c3<sub>B&lt;5<\/sub>&nbsp;on left table of join always, i.e., table r because left outer join (LOJ) returns all the values from an inner join plus all values in the left table that do not match to the right table.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q. Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query Q:\u00a0\u00a0 \ud835\udc5f \u22c8 (\ud835\udf0e\ud835\udc35&lt;5(\ud835\udc60)) Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values. Which one of the following queries is NOT [&hellip;]<\/p>\n","protected":false},"author":419,"featured_media":160334,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5141],"tags":[5140],"class_list":["post-160333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gate","tag-gate-questions"],"_links":{"self":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/users\/419"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/comments?post=160333"}],"version-history":[{"count":1,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160333\/revisions"}],"predecessor-version":[{"id":160335,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160333\/revisions\/160335"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media\/160334"}],"wp:attachment":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media?parent=160333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/categories?post=160333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/tags?post=160333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}