import{_ as a}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.65c6b98c.js";import{_ as l,o as s,c,k as o,a as i,E as n,O as r}from"./chunks/framework.c989bd33.js";import"./chunks/commonjsHelpers.725317a4.js";const C=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":1726418622000}'),d={name:"academic/cis105/cis105-l14-lecture-note.md"};function p(u,e,m,h,f,y){const t=a;return s(),c("div",null,[e[0]||(e[0]=o("h1",{id:"cis105-computer-applications-information-systems-lect-14",tabindex:"-1"},[i("CIS105: Computer Applications & Information Systems Lect. 14 "),o("a",{class:"header-anchor",href:"#cis105-computer-applications-information-systems-lect-14","aria-label":'Permalink to "CIS105: Computer Applications & Information Systems Lect. 14"'},"")],-1)),n(t,{readTime:"2",words:"370"}),e[1]||(e[1]=r('
SELECT: What fields (column) you want fieldname: If the name is used in only one tableFROM: What table or tables contain the fieldsORDER BY: SortingDISTINCT: Use after SELECT when you only want to show each vale of the selected field(s) onceLIMIT: Use when you want to limit the number of records producedWHERE: Applies conditions, filters
WHERE clause conditions follow a pattern: field + comparison operator + value
WHERE crime.iucr_no = 420WHERE crime.iucr_no = 420Comparison Operators:
> : Returns all records larger than the specified value>=: Returns all records that are at least as large as the specified value (including the value)< : Returns all records smaller than the specified value<=: Returns all records that are at least as small as the specified value (including the value)= : Returns all records that are exactly equal to the specified value<>: Returns all records that are not equal to the specified valueNULL: An empty value
NOT: Can be used to create a condition that reverses the logic of any condition
NOT function in ExcelAND: Both conditions must be met for row to be included in query
OR: Used to combine criteria when we want our results to mach any criteria
BETWEEN: Shorthand way to include values in a range
IN: Shorthand way to include values in a range
LIKE: Use this statement when you aren't sure of the values in a record
%: any combination of characters
%Keyword: ends with keyword\uFEFF\uFEFF%Keyword%: looks for %keyword% anywhere in the recordKeyword%: starts with keyword- substitutes for any single character
't_p' would return 'tip', 'tap', or 'top''; but not 'stop'
'p_st" would return 'past"', but not 'paste'
'h__s_n' would return 'hanson', 'hensen', or 'hansen'; but not 'harrison' (note that 'h%s_n' would return 'harrison')
AND and OR statements, you must follow the order of operations (AND 1st, OR 2nd) OR must be first, use ()('_'), ("_")/#s is left as-is