Please enable JavaScript.
Coggle requires JavaScript to display documents.
Zybooks 4 - Coggle Diagram
Zybooks 4
Cardinality
Relationship Maximum
cardinality
-
-
has two, for both ends, like a UML diagram
Relationship minimum
the least number of of instances of one entity that can relate to a single instance of another entity.
-
-
-
-
-
Implementing entities
Selecting primary keys
The first step of the logical design phase, each entity becomes a table and each attribute becomes a column.
-
-
-
-
-
Database design
The implement entities step create an initial table design and specifies primary keys. If no suitable primary key is available, an artificial key is specified.
The design is augmented in subsequent steps, as relationships and attributes are implemented. The final SQL specification stabilizes as tables are reviewed for normal form
First, Second, third normal form
Functional dependence
-
-
-
-
Functional dependence reflects business ruless like "each student receives one letter grade in a course". indicates that grade column depends on the composite column (studentID, CourseCode)
Types
Multivalued dependence
both of these entail dependencies between three or more columns, However, multivalued and join dependencies are complex, uncommon, and not discussed in this material.
-
Normal Forms
Redundancy
-
-
When related values are updated, all copies must be changed. which makes queries slow and complex.
If copies are not updated uniformly, the copies become inconsistent and the correct version is uncertain.
Normal Form
-
numbered, first through fifth.
Additional normal form, Boyce-Codd, improved version of third normal form
Six normal forms comprise a sequence, with each successive normal form allowing less redundancy
First Normal Form
-
A table is in first normal form when, in addition, the table has a primary key. This definition has two corollaries:
In a first normal form table, every non-key column depends on the primary key.
Each primary key value appears in exactly one row,
-
-
-
Second normal form
What is it?
-
In other words, a non-key column cannot depend on part of a composite primary key.
-
Third Normal Form
About
Redundancy can occur in a second normal form table when a non-key column depends on another non-key column.
Informally, a table is in third normal form when all non-key columns depend on the key, the whole key, and nothing but the key. A formal definition appears elsewhere in this material.
-
-
Third normal Form
is whenever a non-key column A depends on column B, then B is unique
-
Although B is unique, B is not necessarily minimal and therefore is not necessarily a candidate key
Discovery
-
Names
-
-
Names have the form EntityQualifierType, such as EmployeeFirstName
Entity
-
if its obvious in ER diagrams, you can sometimes ommit it
Qualifier
-
like first, last, alternate
-
Type
chosen from list of standard attribute types such as Name, Number Count
-
-
Strong and Weak entities
indentifying attribute
unique, singular, required
Corresponds one-to0one, or identify, entity instances
Strong entity
-
When implemented as a table, one of the identifying attributes may become the primary key
Weak Entities
-
-
-
in an ER diagram an identifying relationship has a diamond next to the identifying entity. Cardinality of the identifying entity is always 1(1), so the diamond replaces the cardinality symbol
Database design
After entities, relationships, attributes, and cardinality are determined, the database designer distinguishes strong and weak entities.
For each weak entity, the identifying relationship is noted.
-
Most database designers use software tools to manage ER diagrams. Software tools usually allow users to choose from alternative conventions and automatically switch between conventions
-
-
Implementing Attributes
-
-
-
Database design
THe implementing attributes step specifies columns, column rules and data types. Plural attributes become new dependent tables.
Unique and required cardinality is enforced with UNIQUE, NOT NULL and PRIMARY KEY keywords.
After the implementing attributes step, the database is completely specified in SQL as CREATE TABLE statements. THe final step, review tables for third normal form, ensures that tables do not contain redundant data and fine-tunes the design if necessary
Entities, Relationships, and Attributes
-
-
-
-
Boyce-Codd normal form
About
In a Boyce-Codd normal form table, all dependencies are on unique columns.
Dependence on a unique column never creates redundancy,
-
-
although fourth and fifth normal forms remove additional types of redundancy, these redundancies are uncommon and of little practical concern.
Trivial dependencies
When the columns of A are subset of the columns of B, A always depends on B. Ex FareClass depends on (FlightCode, FareClass). These dependencies are called trivial
Technically, trivial dependencies must be excluded in definitions of normal form. A table is in Boyce-Codd normal form if, for all non-trivial dependencies B -> A, B is unique.