database management systems...what is database normalization? student(batch year, number, name,...
TRANSCRIPT
Database Management
SystemsaProf. Reginald Neil Recario
Institute of Computer Science
University of the Philippines Los Baños
OutlineWe are going to talk about…
Outline
•Data
•Database
•Database Systems
Outline
• Functions and components of a Database Management System
Outline
•Database Normalization
Outline
•Entity Relationship Diagram and Relational Modeling
What is a Data?
What is a Data?
• Facts
• Details of a person (name, home address, etc.)
What is a Database?
What is a Database?
• A collection of logically related data
• Typically visualized as tables
–Column headers
–Rows
What is a Database?Name Degree Program Age
Maria Makiling BS ComputerScience
15
Pedro Penduko BS Statistics 16
Juan Makata BA CommunicationArts
15
What is a Database System?
What is a Database System?
• A database system is simply a database (or databases) with the database management system
What are the functions and components of a Database Management System?
Functions
1.Manipulate data create, retrieve, update and delete
Functions
2.Defining the database metadata
data type, size, and constraints
Functions
3.Process dataperform operations
manipulate data based on an event
Functions
4.Share dataprivileges given to a user
security
Components
A typical DBMS has the following components:
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
responsible for interacting with the user
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
checks correctness of syntaxchecks tables and other objects in the query
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
Simplifies the query for efficient execution
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
Executes the optimized query
ComponentsInterface
Parser
Query optimizer
Execution engine
Storage
Location where dataand metadata are stored
What is Database Normalization?
What is Database Normalization?• Or simply normalization.
• Reduce or remove redundancy
• Ensure integrity
What is Database Normalization?• Normal forms (NF)
• 1NF, 2NF, 3NF, BCNF, etc.
What is Database Normalization?• 1st Normal form (1NF)
–All attributes within a table/relation must be atomic and single-valued
–Each multivalued attribute must be separated together with the key
What is Database Normalization?STUDENT(Studno, Name, Contact no,
Email address)
Assume a student can have more than one contact number and email address.
What is Database Normalization?Decompose table to satisfy 1NF:
STUDENT(Studno, Name)
STUDENT_CONTACT(Studno, Contact no)
STUDENT_EMAILADDR(Studno, Email address)
What is Database Normalization?Depending on context, attribute Name can still
be broken down to “smaller” attributes:
STUDENT(Studno, Last Name, First Name, Middle Name)
What is Database Normalization?• 2nd Normal form (2NF)
–Attributes of a table/relation must all depend on all keys of the relation
–Functional dependency (FD)
• X → Y
–Full functional dependency
What is Database Normalization?STUDENT(Batch year, Number, Name,
Expected year of graduation)
Batch year is the year of entry (e.g. 2017)
We assume expected year of graduation to be four years.
Batch year and the Number combined is the student number (e.g. 2017-12345)
What is Database Normalization?STUDENT(Batch year, Number, Name,
Expected year of graduation)
FDs:
{Batch year, Number} → {Name}
{Batch year} → {Expected year of graduation}
What is Database Normalization?STUDENT(Batch year, Number, Name)
STUDENT_EXPGRAD(Batch year, Expected year of graduation)
What is Database Normalization?• 3rd Normal form (3NF)
–Attributes within the relation must depend only on a key
–No transitive functional dependency
What is Database Normalization?STUDENT(Studno, Name, Units
earned, Standing)
Units Earned is the number of units earned (taken and passed) by the student
Standing refers to whether the student is a freshman, sophomore, junior or senior based on the earned units.
What is Database Normalization?STUDENT(Studno, Name, Units
earned, Standing)
FDs:
{Studno} → {Name, Units earned, Standing}
{Units earned} → {Standing}
What is Database Normalization?STUDENT(Studno, Name, Units
earned)
STUDENT_STANDING(Units earned, Standing)
On Entity Relationship Diagram and Relational Modeling
On Entity Relationship Diagram and Relational Modeling• Models represent a system
–Notations
–Rules
–Behaviors / processes
On Entity Relationship Diagram and Relational ModelingRelational Model
– A relation (or table) is composed of columns and rows
– Columns → Attributes
– Rows → a record / data
On Entity Relationship Diagram and Relational ModelingRelational Model
Name Degree Program Age
Maria Makiling BS Computer Science 15
Pedro Penduko BS Statistics 16
Juan Makata BA Communication Arts 15
On Entity Relationship Diagram and Relational ModelingEntity Relationship Model
–A high-level conceptual model
–Describes the data as entities having attributes and each entity having relationships with other entities
On Entity Relationship Diagram and Relational ModelingEntity Relationship Diagram
– ERD
–Diagrammatic notation
–Chen’s notation and Crow foot notation
On Entity Relationship Diagram and Relational Modeling
On Entity Relationship Diagram and Relational Modeling
On Entity Relationship Diagram and Relational Modeling
On Entity Relationship Diagram and Relational ModelingExample: An employee is assigned to a room in the
company. An employee has a name, birthday,salary grade and an employee number which isunique. A room has a room number, room size,room capacity, and room location. A roomnumber can identify the room. A number ofemployees can be assigned to a room. Anemployee must be assigned to a room but a roomis not required to be assigned with an employee.An employee can be assigned to only one room.
On Entity Relationship Diagram and Relational Modeling
On Entity Relationship Diagram and Relational ModelingExample: An employee is entitled with some form of
benefits. These benefits often extend to dependents.A dependent of an employee is defined as a either aparent with at age of at least 64 years old or a child ofat most 18 years old. A dependent is described byhis/her name, birthday, relationship to the employeeand highest educational attainment. The employee isdescribed by his/her name, employee no, age anddepartment. The employee no is unique. It is possiblefor an employee to have no dependents. A dependentmust always have an employee to depend on. Adependent depends only to one employee.
On Entity Relationship Diagram and Relational Modeling
End.