Академический Документы
Профессиональный Документы
Культура Документы
- The conceptual data model will be transformed into a relational database design
- Entities, attributes, relationships and UID will be transferred into objects in a
relational database
- An entity is not a table, and an attribute is not a column
- SELECT statement
- SQL allows you to access the whole table or just parts of the table, depending on
what comes after SELECT and what is specified in the WHERE clause
4. Primary Key
- PK = a column or set of column that uniquely identifies each row in a table
- PK= a constraint which ensures that the column contains no null values and
unique identifies each row of the table
- It is possible to create a table without a PK, but it is not recommended, each
table should have a PK and a PK must be unique
6. Foreign Key
- FK = a column or combinations of columns, in one table that contains values that
match the PK value in another table
- FK= a column or set of column that refers to a PK in the same table or in another
table
- If a PK is composed of one or more foreign key, the FK value cannot be null
7. Column Integrity
- A column must contain only values that are consistent with the defined data
format of the column
- Row= an entry in a table, consisting of values for each appropriate column
- Column= an implementation of an attribute or relationship in a table
3. Terminology Mapping
- Map = to associate the elements of an ERD (entities, attributes, relationships)
with database elements (tables, attributes, foreign keys)
- An entity becomes a table
- An instance becomes a row
- An attribute becomes a column
- A primary unique identifiers cecomes a primary key
- A secondary unique identifier becomes a unique key
- A relationship is transformed into a foreign key column and a foreign key
constraint
- Analysis and design are phases of the system development life cycle
- Data modeling is done in the analysis phase
- Column names : special characters and spaces are replaced with underscores
6. Table Short Names
- Are not mandatory, simply useful
- A unique short name for every table is useful in the naming of FK column
- For entity names of more than one word:
o First character of the first word
o First character of the second word
o Last character of the last word
- For entity names of one word but more than one syllable:
o First character of the first syllable
o First character of the second syllable
o Last character of the last syllable
- For entity names of one syllable but more than one character:
o First character
o Second character
o Last character
4. Enforcing Optionality
-
8. Cascade Barred Relationships
- = a series of relationships implying that the UID of each entity in the chain is
carried down to the entity on the next level
- The suggested convention is to never use more than two table prefixes
-
10. Mapping One-To- One Relationships
- When transforming a 1:1 relationship you create a foreign key and a unique key
- If the relationship is mandatory on one side, the FK is created in the
corresponding table
-
12. Enforcing One-To- Many
- If the relationship is mandatory at both ends, you have the same limitation in the
database as 1:M relationship that is mandatory at the one end. You need to write
additional code to enforce it
- Mandatory 1:1 relationships are rare. In most cases will be modeled as a single
table, without a need for 1:1 Relationship
-
13. Mapping arcs
- The entity that has the arc will map to a table that contains FK from the tables on
then “one” end of the relationship
- Even if the relationships on the arc are mandatory on the many side, the resulting
FK have to be optional ( because one of them will always be blank)