Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.

Similar presentations


Presentation on theme: "1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management."— Presentation transcript:

1 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Session 4 Data Modeling ITE 252 Database Management

2 2 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A A transactional database must support which of the following activities? a)adding new data b)changing existing data c)deleting data d)all of the above

3 3 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A A transactional database must support which of the following activities? a)adding new data b)changing existing data c)deleting data d)all of the above

4 4 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Your design must ensure that any customer purchases at least $20.00 in merchandise. This is an example of which of the following? a)entity definition b)business rule c)attribute d)relational integrity

5 5 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Your design must ensure that any customer purchases at least $20.00 in merchandise. This is an example of which of the following? a)entity definition b)business rule c)attribute d)relational integrity

6 6 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Entities and attributes are identified during logical design. True or False?

7 7 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Entities and attributes are identified during logical design. True or False?

8 8 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Each table in your database typically represents which of the following? a)an entity b)an attribute c)a relationship d)a data diagram

9 9 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Each table in your database typically represents which of the following? a)an entity b)an attribute c)a relationship d)a data diagram

10 10 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A You are defining an employee entity. Which of the following would you likely use as the identifier (primary key)? a)first name b)last name c)employee ID d)hire date e)none of the above

11 11 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A You are defining an employee entity. Which of the following would you likely use as the identifier (primary key)? a)first name b)last name c)employee ID d)hire date e)none of the above

12 12 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A A foreign key is based on a unique value in the referenced entity. True or False?

13 13 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A A foreign key is based on a unique value in the referenced entity. True or False?

14 14 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Which statement best describes attributes? a)You should have a table for each attribute defined in your model. b)Any attribute can be used as an entity’s identifier. c)Attributes describe entities. d)Attributes are used in object modeling only.

15 15 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Which statement best describes attributes? a)You should have a table for each attribute defined in your model. b)Any attribute can be used as an entity’s identifier. c)Attributes describe entities. d)Attributes are used in object modeling only.

16 16 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Which statement best describes an identifier? a)The identifier must be defined by a single attribute. b)It is seldom necessary to specify an identifier for an entity. c)An identifier must uniquely identify an entity.

17 17 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q & A Which statement best describes an identifier? a)The identifier must be defined by a single attribute. b)It is seldom necessary to specify an identifier for an entity. c)An identifier must uniquely identify an entity.

18 18 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Database Design

19 19 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Modeling Goals Design with understanding that: – All applications written for database are dependent on database structure – If database is altered, applications may need to be altered or rewritten Support business objectives Simple, easy-to-read, easy-to-comprehend structure Scalability

20 20 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Business Rules Business rules: – Processes and flows used in organization’s daily work, including: Organizational policies Calculations and formulas Rules and regulations Database systems should support business rules – Some rules may be better enforced by database design – Others may be better handled through database application

21 21 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Entity-Relationship (E-R) Modeling Entities: – “Things” to track in database Physical objects (people or products) Conceptual entities (loan balances or interest rates)

22 22 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Entity-Relationship (E-R) Modeling Attributes: – Information tracked about entity – Each entity has attributes – For example: Entity: Employees Attributes: Hire Date, Pay Rate, Social Security ID, Employee Number, Home Address – One attribute used as unique identifier or primary key

23 23 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Entity-Relationship (E-R) Modeling Relationships: – When one entity references information from another entity – For example: Time Card entity must reference an Employee entity – Time Card entity is referencing entity – Employee entity is referenced entity – Primary keys ensure referential integrity

24 24 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Entity-Relationship (E-R) Modeling The employee identifier is included with each time card as a foreign key and ensures referential integrity. A foreign key is always based on a unique value in the referenced entity.

25 25 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Basic Database Objects Tables: Store unique instances of entity – Columns (fields) represent attributes – Rows (records) represent individual occurrences of that entity Views: – Customized representations of table information

26 26 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Basic Database Objects

27 27 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Basic Database Objects Index: – Organizes and sorts data – Provides pointer to specific physical location of data on storage media – May be: Primary or secondary Clustered (physically sorted in index order in the table) or nonclustered (indexed only) – Balanced-tree index (b-tree, or binary tree index): Most common type of index in modern databases

28 28 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management B-Tree Index

29 29 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Relationship Types Three basic types: – Binary relationship: Relationship between two types of entities – Unary relationship: Relationship with another occurrence within same entity – Ternary relationship: Relationship directly involving three entity types

30 30 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Relationship Types Cardinality: – Sets maximum number of entities in relationship One-to-one One-to-many Many-to-many Modality: – Sets minimum number of entities in relationship

31 31 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Binary Relationships Simplest type of relationship Majority of relationships in most relational databases are binary relationships Entity can have separate binary relationships with any number of other entities in database

32 32 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Binary Relationships Cardinality – maximum Modality – minimum L to R: A sales person works in exactly one office (minimun of one and a maximum of one office) R to L: An office may be worked in or assigned to a minimum of no sales persons (office is empty)or a maximum of one salesperson.

33 33 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Binary Relationships L to R: A sales person sells to many customers (or no customers – new employee) R to L: Customer is always assigned to exactly one person Crow’s Foot - multiple

34 34 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Binary Relationships L to R: A sales person sells at least one or many products R to L: Each product can be sold by at least one or many of the salespersons

35 35 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Unary Relationships Occurrences of an entity type are associated with other occurrences of same entity type – Relate data in a table to itself For example: – Entity (table) Salesperson – One salesperson may act as a backup or stand-in for another

36 36 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Unary Relationships Each salesperson has a guaranteed backup

37 37 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Unary Relationships L to R: Salesperson is not a sales manager (zero modality ) or is a sales manager with several subordinate sales persons R to L: Salesperson is managed by exactly one other salesperson

38 38 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Unary Relationships Bill of Materials problem. Basic parts make subassemblies; subassemblies make bigger subassemblies

39 39 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Ternary Relationships Involve three different entities Can be considered sets of binary relationships

40 40 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Ternary Relationships Intersection Data – date of the sale & number of units of the product sold Special five sided intersection data box - describes relationship b’twn two entities

41 41 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Many-to-Many Relationships Help minimize wasted space and optimize performance Intersection data: – Data that is part of many-to-many relationship and associated with specific, unique instance of related entities Associative entities: – Entity designed to associate key values from two entities in many-to-many relationship

42 42 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Many-to-Many Relationships

43 43 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Associative Entities The unique identifier of an associative entity is the combination of the unique identifiers of the two entities in the many-to-many relationships. e.g., a combination of Salesperson Number & Product Number Attributes

44 44 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Does Your Brain Hurt Yet?

45 45 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Homework Read Chapter Three, pp. 60-90


Download ppt "1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management."

Similar presentations


Ads by Google