YAK
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
###### tags: `Data Base` # Data Base 第三章 ## 資料模型: 包含 Data, Relation, constraint。 ## 三種不同資料模型: ### 概念資料模型 - 以幾何方式描述使用者認知資料 - 使用幾何圖形符號建立模型 ### 邏輯資料模型 - 使用 4 種資料庫類型建立資料模型 ### 實體資料模型 - 實體建構資料 ## 概念資料模型: ### 實體關聯模型: - 以幾何圖形建立資料庫結構圖 - 畫出來的圖稱之為[實體關聯圖] - Base on Entity and Relation ## 邏輯資料模型: #### 階層式資料庫模型: - 資料結構:階層式樹狀結構,使用父子關聯指標連接'紀錄集合' 父紀錄多個子節點,子記錄一個父節點 - 有兩種基本集合型態: - 紀錄型態:一組欄位組成,每筆資料稱為 '紀錄',實際資料式若干比紀錄構成 - 父子關聯型態:兩個'紀錄型態'間連接型態,為一對多 #### 網路式資料庫模型: - 資料結構:使用'連接'來連結'紀錄集合',父與 子節點,為多對多 - 有兩種基本集合型態: - 紀錄型態: - 連接型態:描述兩個紀錄型態的關係,屬於一對多 #### 關聯式資料庫模型: - 定義:一組關聯表的集合 資料結構: - 關聯表綱要:包含關聯表之表名,屬性,定義域 - 關聯表實例:儲存數據,每筆資料都是一個 tuple - 資料操作或運算:新增,刪除,更新,查詢(關聯式係數) - 完整性限制條件:維護資料完整性條件集,確保儲存資料 合理 - 術語: 維度:有幾個 attribute 基數: tuple 個數 主鍵(PK):一個或多個 attr 而成的單元,用於辨識關聯表 內唯一的紀錄 定義域:屬性的 Datatype - 關聯表綱要的表示語法 ``` SQL= relation_name (attribute1, attribute2, … , attributeN) ``` 屬性有加上實線底線的表示主鍵角色 屬性有加上虛線底線(不一定有)的表示外來鍵角色 - 如果在關聯表綱要裡,需要標示定義域,可以使用括號標示在屬性後 ``` SQL= Students (sid(int), name(char), address(var char), tel(char), birthday(date)) ``` - 關聯表實例: 若干個值組(Tuples)的集合,因為資料可能隨時更改,所以關聯表實例是指某一個時間點的值組集 - 空值(NULL Values): 1.未知,不適用,不知道,找不到的值 2.不是 0 ,不是空字串 3.沒意義,不能做真假比較 4.所有定義域包含空值 - 三種不同關聯表: - 基底關聯表: - 真正的儲存資料 - 真實關聯表 - 視界 - 無真正儲存資料 - 定義於其他基底關聯表的一種虛擬關聯表 - 快照 - 在某一時點的關聯表內容 - 有真正的儲存資料,屬於一種唯讀關聯表 - 完整限制條件: - 檢查輸入資料庫的資料,確保資料正確 - 避免關聯表之間資料不一致 - 防止不合法的資料存入 DB - 完整限制條件: - 鍵限制條件 - 鍵: - 單一或一組屬性的集合 - 超鍵: - 單一或一組屬性集合 - 超鍵滿足唯一性,即沒有2個超鍵值相同 - 透過超鍵的辨識,就可以在關聯表存取指定的值 - 候選鍵: - 每個關聯表至少有一個候選鍵 - 候選鍵是一個具有最少屬性的超鍵 - 候選鍵中沒有一個屬性可以刪除 - 單一屬性的超鍵一定是候選鍵 - 主鍵: - 從各候選鍵中選出其一,只有一個 - 辨識某比特定資料 - 主鍵不能維空值 - 盡可能選單一屬性為主鍵 - 替代鍵: - 不是主見的其他候選鍵稱為替代鍵 - 用於替代主鍵 - 外來鍵: - 單一屬性或一組屬性集合 - 參考其他關連表的主鍵 - 外來鍵與所參考主鍵定義域一樣,但屬性名可不同 - 外來鍵值可以為空值 - 同一個關聯表可以多個外來鍵 - 定義域限制條件 - 設定該屬性的 Datatype - 實體完整性 - 關聯表只能有一個主鍵 - 主鍵的任何部分都不可以是空值 - 主鍵值不能重複 - 使用主鍵值可以找到特定一筆資料 - 參考完整性 - 關聯表可以有多個外來鍵 - 外來鍵值可以是空值 - 外來鍵值若非空值,一定是來自所參考的關聯表的主鍵值 - 主鍵值的更新與刪除: - 限制性處理方式(Restrict):主鍵值有被外來鍵值參考時,拒絕更新或刪除操作 - 連鎖性處理方式(Cascade):主鍵值允許更新或刪除操作,並連鎖反應到參考的外來鍵值 - 空值化處理方式(Nullify):主鍵值允許更新或刪除操作,並將所有參考的外來鍵值都設為空值 - 關聯式資料庫綱要:一組關聯表綱要 + 各綱要附屬的完整性限制條件 #### 物件導向式資料庫模型 ## 實體資料模型: 針對特定 DB system 建立實際架構的模型 資料模型顯示資料如何實作和儲存在 DB

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

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

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully