Skip to content

Instantly share code, notes, and snippets.

@ilake
Last active August 29, 2015 14:01
Show Gist options
  • Save ilake/dc2b32775aa26eba6231 to your computer and use it in GitHub Desktop.
Save ilake/dc2b32775aa26eba6231 to your computer and use it in GitHub Desktop.

Database view

  1. 何時用?
  • 常用的query, subquery, 目的可以讓application layer 更清楚看這東西
  1. 特性:虛擬表格, 沒有真的存資料, view 的建立來源也可以從view 來 , 把它當作 named subquery, view 是just-in-time 是即時的。
  2. 資料變動 :
  • 更新view table, original table will change too., 可以設定check option 來保證這資料符合view table query 條件
  • 更新original table 勒 ?? you can only modify views by modifying the tables they depend on, 資料應該直接改original table, 可是拿的時候可以從view 拿。
  1. 效能? 沒差別, 就是個named subquery,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment