Relationship Database Design
Content
- Conceptual model - ERD
- Logical model - schema, data dictionary, attributes mapping, ...
- Physical model
E-R Diagram (Conceptual Model)
-
How should I write a relationship in the diamond?
Reading order: From left to right.
For example, an employee manages other employees. -
ERD could represent superclass-subclass relationships.
"O" is overlapping, meaning there could be overlapping between each subclass entities. (A manager could also be a salesperson)
Besides, we can use "D" for disjoint subclasses.
A single line between Employee and its subclasses implies an optinal participation (an employee may not belong to any subclass), while a double line implies a mandatory participation (an employee must be in one or more subclasses).
An U-like symbol identify subclasses by pointing to them. (the entity the bottom of "U" points to is a subclass)
Logical Model
Schema represents abstract (strong and weak) entities and associated attributes and necessary relationships between entities.
A schema looks like this:
STUDENT(
Stu_num, Stu_Lname, Stu_Fname, program_num@, age, gender)
(PK "Stu_num" should be underscored. I use italic instead)
Data dictionary contains metadata of attributes, with which you could understand the what, where, how, how much, who, when questions about data.
Normal Form
A good logical model should follow normal form of database.
-
UNF
Contains repeating values. -
1NF
Each cell in the table contains only one value (so that the table can be represented in a relational database). -
2NF
Satisfies 1NF;
No partial dependencies.
Meaning: A non-primary-key attribute cannot be dependent on part of primary-key.
For example, in R(
A B C D), if
(A+B) -> C, D,
(B) -> D,
D is partially dependent on primary key (A+B), thus not satisfying 2NF.
-
3NF
Satisfies 2NF;
No transitive dependencies.
Meaning: A non-primary-key attribute cannot determine non-primary-key attributes. (But a non-primary-key attribute can determine a primary-key attribute) -
BCNF
Satisfies 3NF;
No non-CK dependencies.
Another way to say this: For all functional dependencies exist in the table, all their determinants are candidate keys.
Meaning: the second and third normal forms normalize non-prime attributes, and BCNF normalizes relationships between prime attributes.
For example (a model in 3NF but not in BCNF)
In R(
A B C D), there are
(A+B) -> C, D;
(A+C) -> B, D;
(C) -> B.
With a non-primary-key attribute C determines primary-key attribute B, the model does not satisfy BCNF.
- 4NF
Satisfies BCNF;
No multi-value attributes.
作者:jin2017
連結:
來源:簡書
著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14377/viewspace-2680817/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Design and implementation of database anomaly monitoring system based on AI algorithmDatabaseAIGo
- sqlalchemy中relationship使用SQL
- SAP Table Relationship of Material Classification
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- Error querying database. XXXXXXXXXXXXX, No database selected。ErrorDatabase
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- Database TimeoutDatabase
- Database OverallDatabase
- database no shardingDatabase
- design for failureAI
- Design ten
- Oracle 12.2 使用Database Link優化Standby Database WorkloadOracleDatabase優化
- Ant Design 官方《Ant Design 實戰教程》釋出
- ORACLE database vaultOracleDatabase
- 3.4 Quiescing a DatabaseUIDatabase
- idea--DatabaseIdeaDatabase
- Oracle clone databaseOracleDatabase
- database的connectDatabase
- SAP HUM 內向交貨單憑證流和Relationship Browser
- Password is required when adding a database to AG group if the database has a master keyUIDatabaseAST
- ORA-16649: possible failover to another database prevents this database from beiAIDatabase
- Design a Moore FSM
- System Design InterviewView
- System design summary
- Design Compiler(一)Compile
- STL and Design Pattern
- Design Patterns - Component
- Ant Design VueVue
- [Design Pattern] Upload big file - 3. Code Design - part 1
- [Design Pattern] Upload big file - 4. Code Design - part 2 & Summary
- Guide to Database as a Service (DBaaS)GUIIDEDatabase
- Oracle Database Scheduler整理OracleDatabase
- 3.4.1 About Quiescing a DatabaseUIDatabase
- 3.3 Shutting Down a DatabaseDatabase
- 3.2.2 Opening a Closed DatabaseDatabase
- 3.2.1 Mounting a Database to an InstanceDatabase
- 4.5.1.2 srvctl add databaseDatabase