20160120_jeffrey - silenceuncrio/diary GitHub Wiki
Index
- 0915 - Step 4-1: List assertions using the simplified E-R diagram - 修正
- 0920 - Step 5: Create detail E-R diagram using assertion
- 0930 - Step 6: Transform the detailed E-R diagram into an implementable R-M diagram
- 0940 - SQL Commands
0915
Step 4-1: List assertions using the simplified E-R diagram - 修正
將這一句 assertion 從
Each Rule must
be associated to many Thing's status
修正成
Each Rule can
be associated to many Thing's status
修正後的 assertion 如下
- A Box
must
containat least one
Thing - Each Thing
must
be contained inonly one
Box - A Thing's status
can
be associated tomany
Rules - Each Rule
can
be associated to many Thing's status - A Rule must trigger
at least one
Actions - Each Action
can
be triggered bymany
Rules
影響的部分再畫一次
0920
Step 5: Create detail E-R diagram using assertion
0930
Step 6: Transform the detailed E-R diagram into an implementable R-M diagram
0940
SQL Commands
先拿下面這三個 table 來動手做 SQL Commands
Table - Boxes
Column | Data Type | Length | Indexed | Required(Default) |
---|---|---|---|---|
(PK)BoxId | Number | NA | Yes, Primary Key | Yes |
BoxName | Character | 16 | No | Yes |
BoxLocation | Character | 32 | No | Yes |
BoxConfig_ | Character | 32 | No | Yes |
Table - Things
Column | Data Type | Length | Indexed | Required(Default) |
---|---|---|---|---|
(PK)ThingId | Number | NA | Yes, Primary Key | Yes |
ThingType | Number | NA | No | Yes |
ThingStatus_ | Character | 32 | No | No |
(FK)BoxId | Number | NA | Yes, Foreign Key | Yes |
Table - OpenDetectors
Column | Data Type | Length | Indexed | Required(Default) |
---|---|---|---|---|
(PK)OpenId | Number | NA | Yes, Primary Key | Yes |
OpenConfig_ | Character | 32 | No | Yes |
OpenStatus_ | Character | 32 | No | Yes |
(FK)ThingId | Number | NA | Yes, Foreign Key | Yes |
不過我們使用的是 SQLite
抱抱佛腳看個書 [Using SQLite - Chapter 6 Database Design] (https://github.com/silenceuncrio/study/wiki/Using-SQLite-Chapter-6-Database-Design)