【正文】
eign key enforces the concept of referential integrity in a relational database. The concept of referential integrity not only prevents an invalid department number from being inserted into the EMP table, but it also prevents a row in the DEPT table from being deleted if there are employees still assigned to that department. Foreign Key:A column (or columns) in a table that draws its values from a primary or unique key column in another table. A foreign key assists in ensuring the data integrity of a table. Referential Integrity A method employed by a relational database system that enforces onetomany relationships between tables. Data Modeling 8 Before Scott created the actual tables in the database, he went through a design process known as data modeling. In this process, the developer conceptualizes and documents all the tables for the database. One of the mon methods for modeling a database is called ERA, which stands for entities, relationships, and attributes. The database designer uses an application that can maintain entities, their attributes, and their relationships. In general, an entity corresponds to a table in the database, and the attributes of the entity correspond to columns of the table. Data Modeling:A process of defining the entities, attributes, and relationships between the entities in preparation for creating the physical database. The datamodeling process involves defining the entities, defining the relationships between those entities, and then defining the attributes for each of the entities. Once a cycle is plete, it is repeated as many times as necessary to ensure that the designer is capturing what is important enough to go into the database. Let39。s take a closer look at each step in the datamodeling process. Defining the Entities First, the designer identifies all of the entities within the scope of the database entities are the persons, places, or things that are important to the anization and need to be tracked in the database. Entities will most likely translate neatly to database tables. For example, for the first version of Scott39。s widget pany database, he identifies four entities: employees, departments, salary grades, and bonuses. These will bee the EMP, DEPT, SALGRADE, and BONUS tables. Defining the Relationships Between Entities Once the entities are defined, the designer can proceed with defining how each of the entities is related. Often, the designer will pair each entity with every other entity and ask, Is there a relationship between these two entities? Some relationships are obvious。 some are not. In the widget pany database, there is most likely a relationship between EMP and DEPT, but depending on the business rules, it is unlikely that the DEPT and SALGRADE entities are related. If the business rules were to restrict certain salary grades to certain departments, there would most likely be a new entity that defines the relationship between salary grades and departments. This entity would be known as an associative or 9 intersection table and would contain the valid binations of salary grades and departments. Associative Table:A database table that stores th