toshiki-notebook/assets/academic_cis105_cis105-l17-lecture-note.md.43f952ed.js

2 lines
5.3 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 s}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.250b3e56.js";import{_ as n,o,c as t,H as l,k as a,a as r,Q as i}from"./chunks/framework.b7580407.js";import"./chunks/commonjsHelpers.725317a4.js";const k=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":1726414997000}'),p={name:"academic/cis105/cis105-l17-lecture-note.md"},c=a("h1",{id:"cis105-computer-applications-information-systems-lect-17",tabindex:"-1"},[r("CIS105: Computer Applications & Information Systems Lect. 17 "),a("a",{class:"header-anchor",href:"#cis105-computer-applications-information-systems-lect-17","aria-label":'Permalink to "CIS105: Computer Applications & Information Systems Lect. 17"'},"")],-1),m=i('<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);function d(u,y,h,_,b,f){const e=s;return o(),t("div",null,[c,l(e,{readTime:"1",words:"131"}),m])}const S=n(p,[["render",d]]);export{k as __pageData,S as default};