{"id":561,"date":"2017-09-19T13:10:20","date_gmt":"2017-09-19T17:10:20","guid":{"rendered":"https:\/\/folvera.commons.gc.cuny.edu\/?p=561"},"modified":"2021-09-16T14:58:02","modified_gmt":"2021-09-16T18:58:02","slug":"database-administration-fundamentals-sf17sql1001-day-6","status":"publish","type":"post","link":"https:\/\/folvera.commons.gc.cuny.edu\/?p=561","title":{"rendered":"Database Administration Fundamentals (SF17SQL1001) &#8211; Day 6"},"content":{"rendered":"<p>Last night, aside from <tt>INNER JOIN<\/tt> that allows us to retrieve all data shared by <tt>table1<\/tt> and <tt>table2<\/tt><\/p>\n<pre>SELECT field1, field2 ...\r\nFROM table1         <span style=\"color: #339966\">-- all data related to table2<\/span>\r\nINNNER JOIN table2  <span style=\"color: #339966\">-- all data related to table1<\/span>\r\n  ON table1.fieldX = table2.fieldX;\r\n<\/pre>\n<p>we covered <tt>LEFT JOIN<\/tt> that allows us to retrieve data from <tt>table1<\/tt> and any related data from <tt>table2<\/tt><\/p>\n<pre>SELECT field1, field2 ...\r\nFROM table1         <span style=\"color: #339966\">-- all data<\/span>\r\nLEFT JOIN table2    <span style=\"color: #339966\">-- corresponding data related to table1<\/span>\r\n  ON table1.fieldX = table2.fieldX;\r\n<\/pre>\n<p>and <tt>RIGHT JOIN<\/tt> that allows us to retrieve data from <tt>table2<\/tt> and any related data from <tt>table1<\/tt>.<\/p>\n<pre>SELECT field1, field2 ...\r\nFROM table1         <span style=\"color: #339966\">-- corresponding data related to table2<\/span>\r\nRIGHT JOIN table2   <span style=\"color: #339966\">-- all data<\/span>\r\n  ON table1.fieldX = table2.fieldX;\r\n<\/pre>\n<p>Download the\u00a0<a title=\"Class Notes for SF17SQL1001 - Day 6 (2017\/09\/18)\" href=\"https:\/\/folvera.commons.gc.cuny.edu\/wp-content\/blogs.dir\/2501\/files\/2017\/09\/SF17SQL1001.20170918.pdf\">class notes<\/a>\u00a0for day 6.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last night, aside from INNER JOIN that allows us to retrieve all data shared by table1 and table2 SELECT field1, field2 &#8230; FROM table1 &#8212; all data related to table2 INNNER JOIN table2 &#8212; all data related to table1 ON table1.fieldX = table2.fieldX; we covered LEFT JOIN that allows us to retrieve data from table1 [&hellip;]<\/p>\n","protected":false},"author":7213,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"send_to_group_blog":0,"footnotes":""},"categories":[20,3,1,17,2],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-sf17sql1001","category-computer-programming","category-cuny","category-open-source","category-sql"],"_links":{"self":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/users\/7213"}],"replies":[{"embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=561"}],"version-history":[{"count":5,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":571,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions\/571"}],"wp:attachment":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}