Professional Documents
Culture Documents
Walkthrough . . . .
j j j j j j j j
Hierarchy of Data Traditional Approach & Drawbacks Database Approach Data Models Emerging Database Trends Entity Relationship Modelling Normalization Overview of SQL
Hierarchy of Data
j Bit -A bit represents a circuit that is either on/off (1/ 0) j Byte - A byte is usually 8 bits, representing a character j Record - A collection of related fields is a record (Ex 05BS-0045 Amit Kumar Singh) j File - A collection of related records is a file (05BS- 3567 Avinash Singh 05BS- 4456 Rajan Khetarpal ) j Databse - A collection of integrated and related files is a database
Traditional Approach
j One or more data files created and used for every
application. Ex : Invoicing program would have files on customers and inventory items being shipped j Possible to have the same data in several files used by different applications.
duplication of data j Lack of Data Integrity resulting from the duplication of data j Program-Data-Dependence
Data developed and organized for one application are incompatible with data from another application
related data so that each data element is stored and maintained only in one location. j Related data is shared by multiple application programs. j Database Management System (DBMS) is required.
which permits data to be stored non-redundantly while making it appear to the user as if the data is well-integrated j Collection of interrelated data j Set of programs to access the data j DBMS contains information about a particular enterprise j DBMS provides an environment that is both convenient and efficient to use
7
Application #2
DBMS
DBMS manages data resources like an operating system manages hardware resources
Application #3
Basic Concepts
j File
A set of related records Name: Barry Harris College: Medicine Tel: 392-5555 Name: Barry Harris College: Medicine Tel: 392-5555 Name: Barry Harris
jRecord
- A collection of Data about an individual item
jField
An Example of a Database
Records
Fields
10
11
logical parts
12
13
coordinate the use of the database j Increased vulnerability due to failure of the DBMS or access to the entire database by an intruder
14
Data Modeling
j Content - What data should be collected? j Access - What data should be given to what
users? j Logical structure - How will the data be organized to make sense to a particular user? j Physical organization - Where will the data actually be located?
15
Physical Level
Levels of Abstraction
j Physical/ Internal level describes how a record
(e.g., customer) is stored. j Logical/Conceptual level: describes data stored in database, and the relationships among the data. type customer = record name : string; street : string; city : integer; end; j External/View level: application programs hide details of data types. Views can also hide information (e.g., salary) for security purposes.
17
Data independence
j A user of a relational database system should be able to
use SQL to query the database without knowing about how precisely data is stored, e.g. SELECT name, address FROM Student WHERE name = Rajan;
j After all, you don't worry much how numbers are stored
18
19
20
Data Models
j A collection of conceptual tool for describing data,
data relationships etc j 3 categories defined j Object Based Logical Model Entity Relationship Model j Record Based Logical Model Relational Model Network Model Hierarchial Model j Physical Models
21
Entity-Relationship Modeling
j Entity object, event or agent about which data are
collected. j Attribute item of data that characterizes an entity j Composite attributes consist of several subattributes j Attributes must be sufficient to uniquely identify every entity in a database j Key attribute has unique value for every entity
22
FIGURE 3.9b
23
Relationships
j Relationship association between entities j Strategy for identifying entity relationships
24
FIGURE 3.11
25
Entity-Relationship Model
j An entity is an object that exists and is
distinguishable from other objects. Example: specific person, place, company, object, event, concept ( often corresponding to a row in a table )
j Entities have attributes..property or characteristic
of an entity type ( often corresponding to a field in a table ) Example: people have names and addresses
26
Entity Sets
j An entity set is a set of entities of the same type that
share the same properties. ( Entity Type . Collection of entities ( often corresponding to a table ) Example: set of all persons, companies, trees, holidays j Entity Instance A single occurrence of an entity type.
j Relationship instance link between entities j Relationship type category of relationshiplink
attribute j Attribute types: Simple and composite attributes. Single-valued and multi-valued attributes
E.g. multivalued attribute: phone-numbers
Derived attributes
Can be computed from other attributes
28
Relationship symbols
Entity symbols
Attribute symbols
E-R Diagrams
Rectangles represent entity sets. Diamonds represent relationship sets. Lines link attributes to entity sets and entity sets to relationship sets. Ellipses represent attributes Double ellipses represent multivalued attributes. Dashed ellipses denote derived attributes. Underline indicates primary key attributes
30
Figure 3-4
Inappropriate entities
System user
System output
Appropriate entities
31
A composite attribute
32
33
34
Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed) Whats wrong with this?
Derived
from date employed and current date
Multivalued:
an employee can have more than one skill
36
37
Relational database
j Most common j Data is organized in a collection of tables (relations) j Rows tuples (records) j Columns attributes (fields)
38
FIGURE 3.10
39
Relational Model
Attributes
40
41
Records are rows Attributes are columns j Tables can be linked j Supports one-to-many, many-to-many, and oneto-one relationships
42
Associations
j Relationships among the entities in the data
structures j Three types One-to-one One-to-many Many-to-many j Relationships set by placing primary key from one table as foreign key in another Creates acceptable redundancy
43
Cardinality of Relationships
j One-to-One Each entity in the relationship will have exactly one related entity j One-to-Many An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity j Many-to-Many Entities on both sides of the relationship can have many related entities on the other side
44
45
46
47
Identifiers (Keys)
j Identifier (Key) - An attribute (or combination of
attributes) that uniquely identifies individual instances of an entity type j Simple Key versus Composite Key
A super/ composite key of an entity set is a set of one or more
Normalization
49
Normalization
j Process of efficiently organizing data in a
database j Goals of normalization: Eliminate redundancy Ensure data dependency makes sense
Advantage : j Complex databases are made simpler j Reduces the amount of space utilized j Ensures data is logically stored.
50
FORMS. j Normal forms are numbered from lowest 1st through 5th. j NFs are table structures with min. redundancy.
51
Contd
j The process of decomposing relations with
anomalies to produce smaller, well-structured relations General rule of thumb: a table should not pertain to more than one entity type
52
Redundant Data
54
without entering student information. j Deletion if we remove Hanns record, we lose information about the existence of a Database class j Modification changing a course instructor forces us to update multiple records
Why do these anomalies exist? Because weve combined multiple themes (entity types) into one relation. This results in duplication, and an unnecessary dependency between the entities
55
j Candidate Key
56
57
multiple rows of a table. j Place these multiple rows in separate table. j Create relationship between new table & predecessor table using FK.
58
59
Steps in Normalization
60
Normalized Data
61
World wide database Market Share 2001 Based on percentage of worldwide new licence revenue from DBMSs
62
Summary Slide
j The Hierarchy of Data j The Traditional Approach to Data Management j Problems with the Traditional Approach to Data j j j j j j j j j j
Management The Database Approach to Data Management Disadvantages of the Database Approach How to Perform Data Analysis Step 1: Define the needed fields Step 2: Select the required entities Step 3: Create a Relational Data model Step 4: Normalize the Data Model Parameters to Consider when Selecting a DBMS Emerging Database Trends Hands-On Microsoft Access 2000
63