diff --git a/content/notes/ER-Diagram.md b/content/notes/ER-Diagram.md index cb70d50dc..22c3721e0 100644 --- a/content/notes/ER-Diagram.md +++ b/content/notes/ER-Diagram.md @@ -19,5 +19,12 @@ Attibute types: Relationship: when one entity refers to another Relationship type: a set of relationships with the same entity types - relationships can have attributes -- relationships haveL +- relationships have: + - degree (bi/n-ary) + - cardinality (1:1, 1:N N:M) + - participation constraints (total (marked by double line) or partial) +Weak entities +- no key attributes +- requires total participation constraint on identifying relationship to its identifying entity type +- partial key used in combination with identifying entity diff --git a/content/notes/databases.md b/content/notes/databases.md index bc5a34cb9..5acb0834c 100644 --- a/content/notes/databases.md +++ b/content/notes/databases.md @@ -13,6 +13,23 @@ Database: integrated collection of data [ER Diagram](notes/ER-Diagram) [Schemas](notes/Schemas) +# Relational Model +Two parts +- Relation Schema +- Domain + +Constraints +- Domain: each value must an atomic value in the domain e.g., integer, string, date, etc +- Key and NULL: + - Superkey: uniquely ids a tuple e.g., set of all attrs + - Key: minimal superkey + - Candidate key: a possible key + - Primary key: the chosen candidate key: cannot have NULL values +- Ref Integrity: Foreign key +- Functional Dependencies + - fd: when one value determines another e.g., sid -> sname, {sid, cid} -> grade + - armstrong axioms: + # Normal Forms [Normal Forms](notes/Normal-Forms) # SQL