From 150f2510de5c2371a587949fe2a42109b95b2e38 Mon Sep 17 00:00:00 2001 From: "@andatoshiki" Date: Thu, 11 Apr 2024 14:25:07 -0700 Subject: [PATCH] doc(cis105): add course lecture note for chapter 17 on more sql statement and clauses specifically with `join` & `on` query selector for table linking & add corresponded affiliated sidebar hyperlink component entry for quick access --- docs/.vitepress/config/sidebar.ts | 4 +++ .../cis105/cis105-l17-lecture-note.md | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 docs/academic/cis105/cis105-l17-lecture-note.md diff --git a/docs/.vitepress/config/sidebar.ts b/docs/.vitepress/config/sidebar.ts index c3a493bb..c9a6ec94 100644 --- a/docs/.vitepress/config/sidebar.ts +++ b/docs/.vitepress/config/sidebar.ts @@ -237,6 +237,10 @@ export const sidebar: DefaultTheme.Config['sidebar'] = { { text: 'Lect 16: Information Technology Careers', link: '/academic/cis105/cis105-l16-lecture-note' + }, + { + text: 'Lect 17: SQL Clauses: JOIN Query', + link: '/academic/cis105/cis105-l17-lecture-note' } ], }, diff --git a/docs/academic/cis105/cis105-l17-lecture-note.md b/docs/academic/cis105/cis105-l17-lecture-note.md new file mode 100644 index 00000000..7aad6e89 --- /dev/null +++ b/docs/academic/cis105/cis105-l17-lecture-note.md @@ -0,0 +1,30 @@ +# CIS105: Computer Applications & Information Systems Lect. 17 + +## Chapter 17: SQL Clauses: `JOIN` Query + +### 17.1: `JOIN` & `ON` Clauses + +- `JOIN`: Join tables together to connect multiple fields into 1 query. +- `ON`: Linking the primary and foreign key +- Linking formula: `FROM table1 + JOIN table2 ON table1.primarykey = table2.foreignkey` + +```sql +SELECT first_name, last_name, link_to_major, major_id, major_name + FROM member + JOIN major + ON member. link_to_major = major.major_id +``` + +### 17.2: SQL Statements: Primary vs. Foreign Keys + +- Primary key: A field on a database table that uniquely identifies each row of the table. +- Foreign key: is used to combine the rows from one table wit the rows of another table. + +### 17.3: SQL Statement: Date & Time Formatting + +- The common conventional format of SQL date & time searching is as followed, in form of `YEAR-MONTH-DATT12:00:00` + + - ```sql + '2022-04-17T12:00:00' + ``` +