Presentation is loading. Please wait.

Presentation is loading. Please wait.

IST 318 Database Administration

Similar presentations


Presentation on theme: "IST 318 Database Administration"— Presentation transcript:

1 IST 318 Database Administration
Lecture 4 Data Modeling

2 Topics Entities Relationship Attributes and keys Normalization

3 Data Modeling Data modeling is trying to answer the WHAT questions
What data items are needed? What are the relationships between these items? Data modeling is critical in database design Starting from collecting data requirements Providing a conceptual model of entities & relationships essential for communication and understanding A blueprint to build the physical database

4 Benefits of a Sound Data Model
Minimum data redundancy Maximum data integrity Better data sharing Increased consistency More timely access to data: performance Better data usability: overall Additional benefits New usages Data mining  find out patterns hidden in normal data

5 Three Rules to Follow Don’t think process; think structure
Don’t think physical; think conceptual Focus on requirement from business perspective Avoid getting down to details such as storage issues and DBMS constraints Don’t think process; think structure The main point is to answer what need to be stored and what is the right way to represent the interrelationships Not when and how they are used Don’t think navigation; think relationship Focus on compiling the dictionary, don’t worry about in how many different ways it can be used Several constraints have been used for data integrity purposes: Primary key: means not null and unique. Not null: a valid pet_type value is needed for any record. check (pet_sex_flag_mf in (‘M’, ‘F’)): only the two specific values (M and F) are allowed The data type char is selected for pet_sex_flag_mf, since its length is fix to 1.

6 Entities and Entity Occurrences
Entity (also known as entity set) Similar to the concept of class Real-world or conceptual concepts that can be described via a number of attributes A template of entities of the same kind Examples: employee, department, location Entity occurrences (a simple entities) Similar to the concept of object Instances of certain types (or entity sets) Examples: Craig Mullin, Administrative, location #1

7 Attributes An attribute is a characteristic of an entity
An attribute does one of the three things Identifies: uniquely identify a record Candidate key Becomes primary key when chosen Should be immutable Relates: link to an occurrence in another entity Foreign key Describes: depicts or express a characteristic of an entity occurrence The salary attribute of the employee entity

8 Keys Candidate keys Primary keys Foreign keys
Sometimes it’s possible that more than sets of attributes can uniquely identify an occurrence of an entity Example: Both SSN and StudentId in the entity STUDENT (StudentId,LastName,FirstName,SSN, ...) Primary keys The one chosen from a set of candidate keys Foreign keys Identify a relationship between entity occurrences in two entities

9 Relationships Defines how different entities relate to each other
The keys define a relationship: PK-FK Naming Relationships Example: between COURSE and INSTRUCTOR Entities are nouns/noun phrases Relationships are verbs/verb phrases COURSE INSTRUCTOR is-taught-by

10 Cardinality and Optionality
The number of occurrences that can exist between a pair of entities Each end of a relationship has a cardinality Also known as degree Typical cardinality terms: one, many Optionality Whether relationships are mandatory or optional Each end of a relationship has a optionality characteristic

11 An Example In the employed-by relationship
The STORE can have 0, 1, or many EMPLOYEEs If an EXPLOYEE exists, a relationship to a STORE is mandatory EMPLOYEE STORE Employed by

12 Three Levels Logical data model Physical data model
Conceptual data model Depict a high-level, business-oriented view of information Logical data model Offers a comprehensive formal structure that serves as a blueprint for business data Physical data model Transfers the logical data model into a physical implementation using a specific DBMS

13 Normalization

14 Normalization – first normal form
form eliminates repeating groups and nonatomic data from an entity

15 Normalization – second normal form
Second normal form ensures that all the attributes of each entity are dependent

16 Normalization – third normal form
Third normal form ensures that no relationships between attributes exist within an entity


Download ppt "IST 318 Database Administration"

Similar presentations


Ads by Google