Download cao.............................................................................. and more Exercises Computer Vision in PDF only on Docsity!
Module 2 Data
Modeling
Entity Relationship Model : Types of Attributes, Relationship, Structural Constraints
Relational Model, Relational model Constraints –
Mapping ER model to a relational schema –
Integrity constraints
Database Design
- Design of schema from the enterprise requirements
- (^) Stages
- (^) High level data model – interaction with
domain experts and users
- Specification of user requirements
- (^) Conceptual design phase
- (^) Conceptual Schema (Functional requirements – operations on data)
- (^) Logical design phase
- Meta-data
- (^) Physical design phase
- (^) Choice of storage devices, indexing Requirements Gathering Conceptual Design Logical Design Physical Design Implementation Modelling ER Diagrams, Normalisation System Specific Data base schema File organization & Internal Storage Structures Meetings, Prototyping, Observation, Reverse Engineering, Survey Documents Views, Relations Tables – Attributes- Data types Physical Schema
Conceptual System Design contd.. Pitfall 1: Redundancy College Details
Conceptual System Design contd.. Pitfall 2: Incompleteness
ER Diagram - Entity sets
- (^) A database can be modeled as:
- (^) a collection of entities,
- (^) relationships among entities.
- (^) An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant
- (^) Entities have attributes Example: people have names and addresses - (^) An entity set is a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays
Entity Sets customer and loan customer-id customer- customer- customer- loan- amount name street city number ENTITY SETS
ENTITIES
ENTITIES
Entity sets, Attributes in ER Diagram CUSTOMER_ID CUSTOMER_NAME CUSTOMER_STREET CUSTOMER_CITY
CUSTOMER
LOAN_NUMBER
AMOUNT
LOAN
Relationship sets
- (^) Relationship
- (^) Exist between entities (>2 entities)
- (^) E.g Crick is advisor of Tanaka
- (^) Relationship Set
- (^) Set of relationships of same type
- (^) Here - Advisor is a relationship set
- (^) Multiple relationship sets are possible between entity sets - (^) Advisor, teaching_assistant are possible between entity sets instructor and student
Example – Advisor relationship set
- (^) How many entity sets? 2
- (^) How many entities? 6+
- (^) How many relationship instances? 7
- (^) Size of the relationship set- 7
Relationship set in an ER Diagram
- (^) Relationship set – Diamond
- (^) Entity sets has to be accompanied by attributes when it appears first time in a ER diagram
- (^) A relationship set appears only once in an ER diagram
Attributes in a relationship set and Multiple relationship sets
- (^) Descriptive attributes
- (^) Symbol – undivided rectangle
- (^) For more than 1 grade – the descriptive attribute will be multivalued ‘grades’
Attribute Types
- (^) Simple and Composite
- Composite – divided into parts (name – first
name, middle name, last name)
- (^) Single and multivalued
- (^) Single valued for an entity (Roll number of a
particular employee)
- (^) Multi valued (Phone number of a particular
employee)
- (^) Derived
- (^) Value Null for an attribute indicates NA
(not applicable) or missing
- (^) ID – Cannot be null Multivalued Derived
Total and Partial Participation
- (^) Total Participation
- (^) The participation of an entity set E in a relationship set R is said to be total if every entity in E must participate in at least one relationship in R.
- (^) Every student must have an advisor (indicated by double line) – Total participation
- (^) Instructor may not advise any student (single line) – Partial Participation
Cardinality limits on relationship sets
- (^) Indicates the number of times each entity participates in relationships in A relationship set in the form l..h (l-lower limit, h – upper limit). * - no limit
- (^) Instructor can take any number of students
- (^) Student can have exactly one instructor