Intro
- Chapter six assumes that you have an ER design.
- To turn this into a database you mus
- Replace entities and attributes with tables an columns
- Represent relationships and maximal cardinalities with foreign keys
- Represent minimum cardinality by defining actions to constrain activities on values of primary and foreign keys.
- Create a table for each entity
- Select a primary key.
- This facilitates searching.
- Used in creating indexes as well
- Ideal:
- If none exist, use a surrogate key.
- Disadvantages to surrogate keys
- The numbers are meaningless to the institution.
- They may eventually become meaningful, but at least initially they are meaningless.
- They are a problem when databases are merged or information is shared.
- This is a problem of duplicate, misaligned, missing or different keys for the same data in different databases.
- Candidate Keys
- Sometimes known as alternate keys.
- Are used in the normalization process.
- Specify column properties
- Null or not
- NULL means no data has been supplied.
- Primary keys may never be NULL
- Alternate keys may be, see discussion
- Data type
- Matches available data in DBMS
- Default Value
- General variable initialization problem.
- Data Constraints
- Normal bounds checking.
- Logic implementing policies and such.
- Referential Integrity Checks.
- Verify normalization
- Check things out as carefully as possible with the client.
- Write it all down so the team, and future maintainers know what was done and why.