###### tags: `database` `note` `thu` {%hackmd theme-dark %} # Introduction ## 名詞定義 * **Data** → known facts * **Relation** → a table that hosts many entries of data * **Database** → a collection of ***related*** data * **DBMS** → a collection of software to create and maintain DBs Note: DBMS = (D)ata(b)ase (M)anagement (S)ystem ## Data models 結構就是:Data Structure + Operators e.g. Linked list + Insert/Delete ### 實際存在的DB model #### 1. Relational - Tables + SQL (4th Generation Language) #### 2. Network - Circular Linked List + (Find first...) #### 3. Hierarchical - Tree + tree iterator #### 4. Object-oriented - Relational + 繼承 ## Keys 種類 ### 1. *Candidate* - 不會重複的 ### 2. *Primary* - 常用的candidate key ### 3. *Super keys* (candidate的superset) - e.g. {ID}, {ID, Email}都是Super keys(合起來可唯一決定key) ### 4. *Foreign keys* - 來自別的table的Primary key (可連結表格, ER-model) ## Constraint 種類 ### 1. ***Key*** - Candidate key不可重複 ### 2. *Entity* - Prime attribute (candidate key的attribute)非空 ### 3. *Domain* - 該㯗位的性質規定 (dtype, value range, format) ### 4. *No null* - 非空//FIXME ### 5. *Referential integrity* - 外來的Foreign key不可以隨便消失 ## 比起傳統的檔案的好處 ### 1. *Compact* - 數位資料沒有體積 ### 2. *Speed* - 電腦比人快 ### 3. *Automation* - 可用程式自動化某些流程 ### 4. *Concurrency* - 內容是即時更新的
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up