The entity-relationship model (or ERE model) is a way of graphically representing the logical relationships of entitles (or objects) In order to create a database. Entity type Is a collection of entity Instances sharing scalar properties Strong Entity Vs. Weak Entity An entity set that does not have sufficient attributes to form a primary key is termed as a weak entity set. An entity set that has a primary key is termed as strong entity set.

A weak entity Is existence dependent. That Is the existence of a weak entity depends on the existence of a Identifying entity set.The discriminator (or partial key) Is used o identify other attributes of a weak entity set. The primary key of a weak entity set is formed by primary key of identifying entity set and the discriminator of weak entity set. The existence of a weak entity is indicated by a double rectangle in the ERE diagram.

We underline the discriminator of a weak entity set with a dashed line in the ERE diagram. Recursive Entity A recursive entity is one in which a relation can exist between occurrences of the same entity set.This occurs in a unary relationship. Composite Entities If a Many to Many relationship exist we must create a bridge entity to convert It Into 1 o Many. Bridge entity composed of the primary keys of each of the entitles to be connected. The bridge entity is known as a composite entity.

A composite entity is represented by a diamond shape with in a rectangle in an ERE Diagram. Types of Relationships Unary Relationship ENTITY TYPE linked with itself, also called recursive relationship.Counterexample, where STUDENT is linked with STUDENT Binary relationships Binary relationship Is the one that links two entitles sets e. G.

STUDENT-CLASS. Relationships can be formally described In an ordered pair form Ternary Relationships Ternary relationship is the one that involves three entities e. G. STUDENT-CLASS-FACULTY N-ray Relationships relationships in data model are binary or at most ternary but we could define relationship set linking any number of entity sets I.

E. -ray relationship Many-to-many relationships A relationship that is multi-valued in both directions is a many-to-many relationship. An employee can work on more than one project, and a project can have more than one employee. The questions "What does Dolores Quintal work nor, and "Who works on project FIFO? " both yield multiple answers. A many-to-many relationship can be expressed in a table with a column for each entity ("employees" and "projects"), as shown in the following example.One-to-one relationships One-to-one relationships are single-valued in both directions.

A manager manages one department; a department has only one manager. The questions, "Who is the both have single answers. The relationship can be assigned to either the DEPARTMENT table or the EMPLOYEE table. Because all departments have managers, but not all employees are managers, it is most logical to add the manager to the DEPARTMENT table, as shown in the following example.

Integrity constraints are used to ensure accuracy and consistency of data in a relational database. Citation needed] Data integrity is handled in a relational database through the concept of referential integrity. There are many types of integrity constraints that play a role in referential integrity. Entity Integrity[edit] For more details on this topic, see Entity integrity.

The entity integrity constraint states that no primary key value can be null. This is because the primary key value is used to identify individual tepees in a relation. Having null value for the primary key implies that we cannot identify some pulps.This also specifies that there may not be any duplicate entries in primary key column key word Referential Integrity[edit] For more details on this topic, see Referential integrity. The referential integrity constraint is specified between two relations and is used to maintain the consistency among tepees in the two relations.

Informally, the referential integrity constraint states that a duple in one relation that refers to another relation must refer to an existing duple in that relation. It is a rule that maintain consistency among the rows of the two relations.Domain Integrity[edit] The domain integrity states that every element from a relation should respect the type and restrictions of its corresponding attribute. A type can have a variable length which needs to be respected. Restrictions could be the range of values that the element can have, the default value if none is provided, and if the element can be NULL.

User Defined Integrity[edit] A business rule is a statement that defines or constrains some aspect of the business. It is intended to assert business structure or to control or influence the behavior of the business.