{"id":839,"date":"2019-03-12T09:56:04","date_gmt":"2019-03-12T13:56:04","guid":{"rendered":"https:\/\/folvera.commons.gc.cuny.edu\/?p=839"},"modified":"2021-09-16T14:57:29","modified_gmt":"2021-09-16T18:57:29","slug":"database-administration-fundamentals-ws19sql10004-day-4","status":"publish","type":"post","link":"https:\/\/folvera.commons.gc.cuny.edu\/?p=839","title":{"rendered":"Database Administration Fundamentals (WS19SQL10004) \u2013 Day 4"},"content":{"rendered":"<p>So far, we have covered how <tt>JOIN<\/tt> tables, built-in functions to manipulate strings, numbers and even convert numbers (currencies and dates) to strings, <tt>GROUP BY<\/tt> and <tt>ORDER BY<\/tt> clauses and the structure of a <tt>SELECT<\/tt> statement.<\/p>\n<pre>  SELECT table1.field1,\r\n    table1.field2,\r\n    ...\r\n    table2.field1,\r\n    table2.field2,\r\n    ...\r\n    table3.field1,\r\n    table3.field2,\r\n    ...\r\n\r\n  FROM table1\r\n  INNER|LEFT|RIGHT JOIN table2\r\n    ON table1.shared_field1 = table2.shared_field1\r\n    AND table1.shared_field2 = table2.shared_field2\r\n  ...\r\n  INNER|LEFT|RIGHT JOIN table3\r\n    ON table1.shared_field1 = table3.shared_field1\r\n    AND table1.shared_field2 = table3.shared_field2\r\n  ...\r\n\r\n  WHERE condition1\r\n    AND|OR condition2\r\n    AND|OR condition3\r\n  ...\r\n\r\n  GROUP BY table1.field1,\r\n    table1.field2,\r\n    ...\r\n    table2.field1,\r\n    table2.field2,\r\n    ...\r\n    table3.field1,\r\n    table3.field2,\r\n    ...\r\n\r\n  ORDER BY\r\n    table1.field1 ASC|DESC,\r\n    table1.field2 ASC|DESC,\r\n    ...\r\n    table2.field1 ASC|DESC,\r\n    table2.field2 ASC|DESC,\r\n    ...\r\n    table3.field1 ASC|DESC,\r\n    table3.field2 ASC|DESC,\r\n    ...\r\n<\/pre>\n<p>Download the\u00a0<a title=\"Class Notes for WS19SQL10004 - Day 4 (2019\/03\/11)\" href=\"https:\/\/folvera.commons.gc.cuny.edu\/wp-content\/blogs.dir\/2501\/files\/2019\/03\/WS19SQL10004_20190311.pdf\">class notes<\/a>\u00a0for day 4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So far, we have covered how JOIN tables, built-in functions to manipulate strings, numbers and even convert numbers (currencies and dates) to strings, GROUP BY and ORDER BY clauses and the structure of a SELECT statement. SELECT table1.field1, table1.field2, &#8230; table2.field1, table2.field2, &#8230; table3.field1, table3.field2, &#8230; FROM table1 INNER|LEFT|RIGHT JOIN table2 ON table1.shared_field1 = table2.shared_field1 [&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":[26,3,1,17,2],"tags":[],"class_list":["post-839","post","type-post","status-publish","format-standard","hentry","category-ws19sql10004","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\/839","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=839"}],"version-history":[{"count":2,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions"}],"predecessor-version":[{"id":848,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions\/848"}],"wp:attachment":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}