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

This commit is contained in:
Anda Toshiki 2024-04-11 14:25:07 -07:00
parent 37c8f26eb8
commit 150f2510de
2 changed files with 34 additions and 0 deletions

View File

@ -237,6 +237,10 @@ export const sidebar: DefaultTheme.Config['sidebar'] = {
{ {
text: 'Lect 16: Information Technology Careers', text: 'Lect 16: Information Technology Careers',
link: '/academic/cis105/cis105-l16-lecture-note' link: '/academic/cis105/cis105-l16-lecture-note'
},
{
text: 'Lect 17: SQL Clauses: JOIN Query',
link: '/academic/cis105/cis105-l17-lecture-note'
} }
], ],
}, },

View File

@ -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'
```