mirror of
https://github.com/andatoshiki/toshiki-notebook.git
synced 2026-06-05 23:46:27 +00:00
2 lines
6.3 KiB
JavaScript
2 lines
6.3 KiB
JavaScript
import{_ as t}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.250b3e56.js";import{_ as a,o as l,c as s,H as c,k as e,a as i,Q as n}from"./chunks/framework.b7580407.js";import"./chunks/commonjsHelpers.725317a4.js";const S=JSON.parse('{"title":"CIS105: Computer Applications & Information Systems Lect. 14","description":"","frontmatter":{},"headers":[],"relativePath":"academic/cis105/cis105-l14-lecture-note.md","filePath":"academic/cis105/cis105-l14-lecture-note.md","lastUpdated":1726415491000}'),r={name:"academic/cis105/cis105-l14-lecture-note.md"},d=e("h1",{id:"cis105-computer-applications-information-systems-lect-14",tabindex:"-1"},[i("CIS105: Computer Applications & Information Systems Lect. 14 "),e("a",{class:"header-anchor",href:"#cis105-computer-applications-information-systems-lect-14","aria-label":'Permalink to "CIS105: Computer Applications & Information Systems Lect. 14"'},"")],-1),p=n('<h2 id="chapter-14-more-sql-statement" tabindex="-1">Chapter 14: More SQL Statement <a class="header-anchor" href="#chapter-14-more-sql-statement" aria-label="Permalink to "Chapter 14: More SQL Statement""></a></h2><h3 id="_14-1-statement-review" tabindex="-1">14.1: Statement Review <a class="header-anchor" href="#_14-1-statement-review" aria-label="Permalink to "14.1: Statement Review""></a></h3><ul><li><code>SELECT</code>: What <strong>fields</strong> (column) you want <ul><li><code>fieldname</code>: If the name is used in only one table</li></ul></li><li><code>FROM</code>: What table or tables contain the fields</li><li><code>ORDER BY</code>: Sorting</li><li><code>DISTINCT</code>: Use after <code>SELECT</code> when you only want to show each vale of the selected field(s) once</li><li><code>LIMIT</code>: Use when you want to limit the number of records produced</li></ul><h3 id="_14-2-new-sql-statements" tabindex="-1">14.2: New SQL Statements <a class="header-anchor" href="#_14-2-new-sql-statements" aria-label="Permalink to "14.2: New SQL Statements""></a></h3><ul><li><p><code>WHERE</code>: Applies conditions, filters</p><ul><li><p><code>WHERE</code> clause conditions follow a pattern: field + comparison operator + value</p></li><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:#F47067;">WHERE</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">crime</span><span style="color:#ADBAC7;">.</span><span style="color:#6CB6FF;">iucr_no</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">420</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">WHERE</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">crime</span><span style="color:#24292E;">.</span><span style="color:#005CC5;">iucr_no</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">420</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div></li></ul></li><li><p>Comparison Operators:</p><ul><li><code>></code> : Returns all records larger than the specified value</li><li><code>>=</code>: Returns all records that are at least as large as the specified value (including the value)</li><li><code><</code> : Returns all records smaller than the specified value</li><li><code><=</code>: Returns all records that are at least as small as the specified value (including the value)</li><li><code>=</code> : Returns all records that are exactly equal to the specified value</li><li><code><></code>: Returns all records that are not equal to the specified value</li></ul></li><li><p><code>NULL</code>: An empty value</p></li><li><p><code>NOT</code>: Can be used to create a condition that reverses the logic of any condition</p><ul><li>Similar logic to the <code>NOT</code> function in Excel</li></ul></li><li><p><code>AND</code>: Both conditions must be met for row to be included in query</p></li><li><p><code>OR</code>: Used to combine criteria when we want our results to mach any criteria</p></li><li><p><code>BETWEEN</code>: Shorthand way to include values in a range</p></li><li><p><code>IN</code>: Shorthand way to include values in a range</p></li><li><p><code>LIKE</code>: Use this statement when you aren't sure of the values in a record</p></li><li><p><code>%</code>: any combination of characters</p><ul><li><code>%Keyword</code>: ends with keyword</li><li><code>\uFEFF\uFEFF%Keyword%</code>: looks for %keyword% anywhere in the record</li><li><code>Keyword%</code>: starts with keyword</li></ul></li><li><p><code>-</code> substitutes for any single character</p><ul><li><p>'<code>t_p</code>' would return '<code>tip</code>', '<code>tap</code>', or '<code>top</code>''; but not '<code>stop</code>'</p></li><li><p>'<code>p_st</code>" would return '<code>past</code>"', but not '<code>paste</code>'</p></li><li><p><code>'h__s_n'</code> would return '<code>hanson</code>', 'hensen', or '<code>hansen</code>'; but not '<code>harrison</code>' (note that '<code>h%s_n</code>' would return '<code>harrison</code>')</p></li></ul></li></ul><h3 id="_14-3-rules-to-remember" tabindex="-1">14.3: Rules to Remember <a class="header-anchor" href="#_14-3-rules-to-remember" aria-label="Permalink to "14.3: Rules to Remember""></a></h3><ul><li>To combine <code>AND</code> and <code>OR</code> statements, you must follow the order of operations (<code>AND</code> 1st, <code>OR</code> 2nd) <ul><li>If <code>OR</code> must be first, use <code>()</code></li></ul></li><li>All words must be in between <code>('_')</code>, <code>("_")</code><ul><li>If your value contains a quotation, use double quotation or a <code>/</code></li><li>All <code>#s</code> is left as-is</li></ul></li></ul>',7);function u(h,m,f,y,_,b){const o=t;return l(),s("div",null,[d,c(o,{readTime:"2",words:"370"}),p])}const g=a(r,[["render",u]]);export{S as __pageData,g as default};
|