Professional Documents
Culture Documents
Overview
Overview
Data Model:
A set of concepts to describe the structure of a database, and certain constraints that the database should obey
Database Schema: The description of a database. Includes descriptions of the database structure and the constraints that should hold on the database. Schema Diagram: A diagrammatic display of (some aspects of) a database schema. Schema Construct: A component of the schema or an object within the schema, e.g., STUDENT, COURSE. Database Instance: The actual data stored in a database at a particular moment in time. Also called database state (or occurrence).
DBMS by Er. K.S.Dhindsa
Example ER Diagram
Database Design
External View
Pilot
(Order Entry)
Engineer
(A/C Receivable)
Passenger
(Inventory)
General Design
(Comprehensive Data Model)
Blueprint
(Database Schema)
Aircraft (Database)
DBMS by Er. K.S.Dhindsa
Entities
Person, place, object, event, or concept about which the organization wishes to collect and maintain data Nouns are used to describe entities Examples: Employee, Student, Nurse City, State, Country Sale, Registration, Account Entity Type versus Entity Instance
Types of Entities
Strong Entity: can exist independently EMPLOYEE
Weak Entity: cannot exist without the owner entity (with which it has an identifying relationship) Has a primary key that is derived from the owner entity in the relationship
EMPLOYEE
DEPENDENT
has
DBMS by Er. K.S.Dhindsa
Attributes
Properties or characteristics of entities (or relationships) Provide the actual data that describe entities (or relationships)
EMPLOYEE
Unique Attributes
Candidate keys are ALL attributes that uniquely define an instance of an entity
A primary key is the candidate key that is chosen as the most unique of them all!
Composite Attributes
Attributes that are not atomic (or simple), i.e., those attributes that can (and need to) be broken down further
EMPLOYEE
Multi-valued Attributes
S_Code S_Name
DBMS by Er. K.S.Dhindsa
Derived Attributes
Those attributes whose values can be calculated from the values of other attributes (either in the database or in the system) Value is not stored in the database (since it does not take up any space) E.g., Age can be calculated, where date-of-birth is stored
Relationships
Refer to the associations (or links) between entities Use verbs to describe the links May have attributes (in some cases) Are directional
STUDENT
Lives in
DORMITORY
EMPLOYEE
Works in
STORE
DBMS by Er. K.S.Dhindsa
Associative Entities
A (many-to-many) relationship that is better represented as an entity because it: contains attributes from the entities it links and has its own attributes
CUSTOMER
Orders
PRODUCT
CUSTOMER
ORDER
PRODUCT
DBMS by Er. K.S.Dhindsa
ERD represents the conceptual database as viewed by end user Main Components Entities In E-R models an entity refers to the entity set. An entity is represented by a rectangle containing the entitys name.
Attributes Attributes are represented by ovals and are connected to the entity with a line. Each oval contains the name of the attribute it represents. Attributes have a domain -- the attributes set of possible values. Attributes may share a domain. Relationships
DBMS by Er. K.S.Dhindsa
Key attributes are also underlined in frequently used table structure shorthand
Ideally composed of only a single attribute Possible to use a composite key: Primary key composed of more than one attribute
Facilitates database design Express logical properties of mini-world of interest within enterprise - Universe of Discourse Conceptual level model Not limited to any particular DBMS E-R diagrams used as design tools A semantic model captures meanings
A simple attribute cannot be subdivided. Examples: Age, Sex, and Marital status A composite attribute can be further subdivided to yield additional attributes.
Examples:
ADDRESS Street, City, State, Zip PHONE NUMBER Area code, Exchange number
A derived attribute may be calculated (derived) from other attributes Need not be physically stored within the database Can be derived by using an algorithm
Example: AGE can be derived from the data of birth and the current date.
Cardinality Cardinality expresses the specific number of entity occurrences associated with one occurrence of the related entity. The minimum and maximum number of entity occurrences
Mandatory Relationships Optional Relationships Many-to-Many Relationships One-to-Many Relationships One-to-One Relationships Recursive Relationships
Mandatory, Many-to-Many
INSTRUCTOR
STUDENT
INSTRUCTOR
STUDENT
Optional, Many-to-Many
DEPARTMENT
STUDENT
DEPARTMENT
STUDENT
Optional/Mandatory, Many-to-Many
INSTRUCTOR
SKILL
INSTRUCTOR
SKILL
Optional/Mandatory, One-to-Many
PRODUCT
VENDOR
PRODUCT
VENDOR
Mandatory, One-to-One
AUTOMOBILE
ENGINE
AUTOMOBILE
ENGINE
Recursive
EMPLOYEE
supervises
is supervised by
Mandatory Relationships Optional Relationships Many-to-Many Relationships One-to-Many Relationships One-to-One Relationships Recursive Relationships
SUMMARY