Академический Документы
Профессиональный Документы
Культура Документы
Primary keys
First
column Most designers follow this convention Unique for each row Principle: A row is unique if any one of its columns is unique.
Foreign Key
An
attribute in one table that matches a primary key of another table Many database designers use the same field name for related primary key and foreign key columns to indicate the two columns tie together two tables.
Join
Connecting
Schema of a Relation
Formal term: Relation Less formal term: Table Data processing term: File Schema outline
The
schema of a relation for a table is the relations name and its attributes
Data dictionary
A collection of tables containing the definition, characteristics, structure and description of all data maintained by the RDBMS. Accessed by the database administrator or the objects owner Other information stored:
View
Data dictionary
Fields in the data dictionary are automatically changed whenever an objects structure is changed
Rename
Normalization
process of determining the correct location for each attribute Unnormalized databases can lead to redundant, inconsistent, and anomalous information being stored in tables Normal form
A
Normal forms
Remove repeating data groups Remove functional dependencies Remove transitive dependencies
Boyce/Codd normal form Fourth normal form Fifth normal form Domain/Key normal form
Goal:
Start with a collection of tables (relations) Apply normalization Arrive at an equivalent collection of tables in a higher normal form
Table Relationships
One-to-one
Indicate unnecessary tables Exceptions to the rule
One-to-many
Many-to-many
Difficult to represent Most database designers create a new table to represent many-to-many relationship into one-to-many relationship Intermediate relationship
2.
3.
4.
Primary keys cannot be null. Create a foreign key from the primary key on the one side if the one-to-many relationship Many-to-many relationships are handled by creating an additional table that consists entirely of the parents tables primary keys. One-to-one relationships indicate unnecessary tables in the database. Normally, you should merge the two tables.
Exceptions: if there are too many columns in one table
SELECT
PROJECTION
JOIN
Database Design
Modeling
An
Methods
Draw
Listing potential attributes from an existing document Identify functional dependencies Selecting which attributes belongs to which table Revision (apply normalization)