GETTING FAMILIAR WITH TERMS
- ER MODEL : The entity relationship data model on a perception of a real world that consists of a collection of basic objects called entities and of relationships among them. This represents the logical structure of an database.
- ENTITIES : An entity is a thing in the real world that is distinguishable from all other objects.
- ATTRIBUTES : An entity is represented by a s et of attributes. These are descriptive properties possessed by each member of the entity set.
- RELATIONSHIP SETS : A relationship set is a set of relationships of the same type.
- CONSTRAINTS : An E-R enterprise schema may define certain constraints to which the database must conform.
- ENTITY SETS : A superkey is a set of one or more attributes that taken collectively,allow us to identify uniquely an entity in an entity set.
- N-ARY RELATIONSHIPS : Generally the relationships are binary, sometimes the database has more than one entity, so they have tertiary or n-ary relationships. This particular model is a tertiary relationship (three entity sets).
- MAPPING CARDINALITIES :
- ONE-TO-ONE : Every entity in each of the two entity set are at most related to one entity each.
- ONE-TO-MANY: An entity in customer is associated with a number of entities in order.But Any entity in order can have at most one entity in customer.
- MANY-TO-ONE: An entity in set A is associated with at most one entity in B. But Any entity in B can be associated with a number of entities in A.
- MANY-TO-MANY: An entity in product can be associated with a number of entities in order and vice versa is also true.
- RECTANGLES – Entity sets ( CUSTOMER, PRODUCT, ORDER)
- ELLIPSES -Attributes (C-ID,FIRSTNAME,LASTNA Entities and Attributes Entity: an object that is involved in the enterprise and that be distinguished from other objects. (not shown in the ER diagram–is an instance) Can be person, place, event, object, concept in the real world Can be physical object or abstraction Ex: “John”, “CSE305” Entity Type: set of similar objects or a category of entities; they are well defined A rectangle represents an entity set Ex: students, courses We often just say “entity” and mean “entity type” Attribute: describes one aspect of an entity type; usually [and best when] single valued and indivisible (atomic) Represented by oval on E-R diagram Ex: name, maximum enrollment May be multi-valued – use double oval on E-R diagram May be composite – attribute has further structure; also use oval for composite attribute, with ovals for components connected to it by lines May be derived – a virtual attribute, one that is computable from existing data in the database, use dashed oval. This helps reduce redundancy
Entity Types An entity type is named and is described by set of attributes Student: Id, Name, Address, Hobbies Domain: possible values of an attribute. Note that the value for an attribute can be a set or list of values, sometimes called “multi-valued” attributes This is in contrast to the pure relational model which requires atomic values E.g., (111111, John, 123 Main St, (stamps, coins)) Key: subset of attributes that uniquely identifies an entity (candidate key) Entity Schema: The meta-information of entity type name, attributes (and associated domain), key constraints Entity Types tend to correspond to nouns; attributes are also nouns albeit descriptions of the parts of entities May have null values for some entity attribute instances – no mapping to domain for those instances
Keys Superkey: an attribute or set of attributes that uniquely identifies an entity–there can be many of these Composite key: a key requiring more than one attribute Candidate key: a superkey such that no proper subset of its attributes is also a superkey (minimal superkey – has no unnecessary attributes) PrimaryTkey: the candidate key chosen to be used for identifying entities and accessing records. Unless otherwise noted “key” means “primary key” Alternate key: a candidate key not used for primary key Secondary key: attribute or set of attributes commonly used for accessing records, but not necessarily unique Foreign key: term used in relational databases (but not in the E-R model) for an attribute that is the primary key of another table and is used to establish a relationship with that table where it appears as an attribute also. So a foreign key value occurs in the table and again in the other table. This conflicts with the idea that a value is stored only once; the idea that a fact is stored once is not undermined.