toshiki-notebook/assets/academic_cis105_cis105-l17-lecture-note.md.4448a57e.lean.js

2 lines
5.4 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as n}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.65c6b98c.js";import{_ as o,o as t,c as l,k as e,a as r,E as i,O as p}from"./chunks/framework.c989bd33.js";import"./chunks/commonjsHelpers.725317a4.js";const g=JSON.parse('{"title":"CIS105: Computer Applications & Information Systems Lect. 17","description":"","frontmatter":{},"headers":[],"relativePath":"academic/cis105/cis105-l17-lecture-note.md","filePath":"academic/cis105/cis105-l17-lecture-note.md","lastUpdated":1726418178000}'),c={name:"academic/cis105/cis105-l17-lecture-note.md"};function m(d,a,u,y,h,b){const s=n;return t(),l("div",null,[a[0]||(a[0]=e("h1",{id:"cis105-computer-applications-information-systems-lect-17",tabindex:"-1"},[r("CIS105: Computer Applications & Information Systems Lect. 17 "),e("a",{class:"header-anchor",href:"#cis105-computer-applications-information-systems-lect-17","aria-label":'Permalink to "CIS105: Computer Applications & Information Systems Lect. 17"'},"")],-1)),i(s,{readTime:"1",words:"131"}),a[1]||(a[1]=p('<h2 id="chapter-17-sql-clauses-join-query" tabindex="-1">Chapter 17: SQL Clauses: <code>JOIN</code> Query <a class="header-anchor" href="#chapter-17-sql-clauses-join-query" aria-label="Permalink to &quot;Chapter 17: SQL Clauses: `JOIN` Query&quot;"></a></h2><h3 id="_17-1-join-on-clauses" tabindex="-1">17.1: <code>JOIN</code> &amp; <code>ON</code> Clauses <a class="header-anchor" href="#_17-1-join-on-clauses" aria-label="Permalink to &quot;17.1: `JOIN` &amp; `ON` Clauses&quot;"></a></h3><ul><li><code>JOIN</code>: Join tables together to connect multiple fields into 1 query.</li><li><code>ON</code>: Linking the primary and foreign key</li><li>Linking formula: <code>FROM table1 + JOIN table2 ON table1.primarykey = table2.foreignkey</code></li></ul><div class="language-sql vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki github-dark-dimmed vp-code-dark"><code><span class="line"><span style="color:#F47067;">SELECT</span><span style="color:#ADBAC7;"> first_name, last_name, link_to_major, major_id, major_name</span></span>\n<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">FROM</span><span style="color:#ADBAC7;"> member</span></span>\n<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">JOIN</span><span style="color:#ADBAC7;"> major</span></span>\n<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">ON</span><span style="color:#ADBAC7;"> member. link_to_major </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">major</span><span style="color:#ADBAC7;">.</span><span style="color:#6CB6FF;">major_id</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">SELECT</span><span style="color:#24292E;"> first_name, last_name, link_to_major, major_id, major_name</span></span>\n<span class="line"><span style="color:#24292E;"> </span><span style="color:#D73A49;">FROM</span><span style="color:#24292E;"> member</span></span>\n<span class="line"><span style="color:#24292E;"> </span><span style="color:#D73A49;">JOIN</span><span style="color:#24292E;"> major</span></span>\n<span class="line"><span style="color:#24292E;"> </span><span style="color:#D73A49;">ON</span><span style="color:#24292E;"> member. link_to_major </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">major</span><span style="color:#24292E;">.</span><span style="color:#005CC5;">major_id</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="_17-2-sql-statements-primary-vs-foreign-keys" tabindex="-1">17.2: SQL Statements: Primary vs. Foreign Keys <a class="header-anchor" href="#_17-2-sql-statements-primary-vs-foreign-keys" aria-label="Permalink to &quot;17.2: SQL Statements: Primary vs. Foreign Keys&quot;"></a></h3><ul><li>Primary key: A field on a database table that uniquely identifies each row of the table.</li><li>Foreign key: is used to combine the rows from one table wit the rows of another table.</li></ul><h3 id="_17-3-sql-statement-date-time-formatting" tabindex="-1">17.3: SQL Statement: Date &amp; Time Formatting <a class="header-anchor" href="#_17-3-sql-statement-date-time-formatting" aria-label="Permalink to &quot;17.3: SQL Statement: Date &amp; Time Formatting&quot;"></a></h3><ul><li><p>The common conventional format of SQL date &amp; time searching is as followed, in form of <code>YEAR-MONTH-DATT12:00:00</code></p><ul><li><div class="language-sql vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki github-dark-dimmed vp-code-dark"><code><span class="line"><span style="color:#96D0FF;">&#39;2022-04-17T12:00:00&#39;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#032F62;">&#39;2022-04-17T12:00:00&#39;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div></li></ul></li></ul>',8))])}const k=o(c,[["render",m]]);export{g as __pageData,k as default};