• Data – A collection of raw facts and figures
• Information – Final product created from the raw data
after processing
• Database – A collection of related information
organised in a structured way to allow easy retrieval of
any one item
Some Terminology
Database Management System [DBMS]
• DBMS
A computer program or collection of computer programs that
provides the necessary tools to create and manipulate the data in a
database
• RDBMS
Relational Database Management Systems are used to create and
manipulate relational databases e.g.
- Microsoft Access
- Oracle
- SQL Server
Database Systems -
Construct a data model of an existing,
non computerised system
THE ANALYSIS PHASE
Analysis Phase
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
When we normalise any type of database system we need to
know what the data in the system means. Therefore we
either have to talk to the people who use the existing system
or we have to be supplied with very detailed information
about how the system works and the data stored within it.
The following slide shows an example of some current data.
Below this are listed some questions that help establish the
requirements of the new system.
Can you think of anything else the analyst might ask?
Salesperson
Number
Salesperson
Name
Sales
Area
Customer
Number
Customer
Name
Warehouse
Number
Warehouse
Location
Sales
Amount
3462 Walters West 18765
18830
19242
Delta Systems
A.Levy & Sons
Rainer & Co.
4
3
3
Fargo
Bismark
Bismark
13540
10600
9700
3593 Dryne East 18841
18899
19565
R.W.Flood Inc.
Seward Systems
Stodola's Inc.
2
2
1
Superior
Superior
Plymouth
11560
2590
8800
• Does each salesperson have their own sales area?
• Does each customer deal with only one salesperson ?
• Does each customer only receive goods from one warehouse?
The answer to these questions will influence how we structure
the database system.
The answer to these questions and others make up the
Requirements Definition
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
Functional dependency means that there must be only a one-to-one
dependency for each attribute mapped from a primary key to that
attribute.
For example, the engine number of a car [Primary Key] can only have
engine capacity as an attribute of that key creating Functional
Dependency
BUT
A particular engine capacity can be associated with the engine numbers
of many makes of car. This does not give rise to Functional
Dependency
It defines a relationship in which the existence of one entity/attribute is
entirely dependent on the existence of another (one-to-one).
Order Number is the primary key.
The value for each attribute of SALES,
except Item Price, depends upon the value
of the primary key.
All attributes of SALES, except Item Price,
are Functionally Dependent on the
primary key
Item Price is Functionally Dependent on the
the attribute Item
Relationships
Having established a definition for the term Functional
Dependency we now need to explore the different types of
relationships that can exist between attributes in different entities:
There are 3 types of relationships that can exist:
• One to One Relationships
• One to Many Relationships
• Many to Many Relationships
Now lets take a closer look at each of these on the next slides
One-to-one
A blind person owns a guide dog
which is exclusively theirs.
J. Smith
B. Jones
A. Gray
Rover
Pippa
Patch
One-to-many
A doctor may have many
patients, but a patient is assigned
to only one doctor.
Dr Ache
Dr Payne
Grant
Allan
Mark
Jane
Amy
Many-to-many
A film may have many stars and
each star may act in many films.
Film X
Film Y
Star A
Star B
Star C
Important Note:
An RDBMS system cannot produce a robust solution if two
or more of the entities have a many to many relationship
To overcome this problem it is necessary to introduce
another entity thus creating One to Many relationships
between itself and the offending entities
This can become a common occurrence when you are
working with larger and more complex database systems
Now you should have the tools and understanding you require
in order to normalise the data in order that a solution can be
produced using an RDBMS [Relational Database Management
System]
Please take your time when working through the next part of
this presentation and revisit it again and again until you are
completely comfortable with the concepts involved
Normalisation of the data is perhaps the single most
important aspect of developing a robust solution to any
database problem!
Normalisation is a 'fancy' term for a
set of rules, designed to make sure that
a database is organised in the best way
possible
This allows the data to be processed more
efficiently and any query to be processed.
These rules depend on relationships being
established between the entities to create a
functional dependency between them.
Finding and grouping together all the entities and
their attributes.
Removing repeating groups of data.
This is another way of saying that there is no point
in storing a persons' name and details etc. in many
different places within a database.
Providing unique keys for each entity in the
database system.
You need to have a way of making sure that when
you delete 'Paul Smith' from the Transactions entity
that it is the correct person.
First Normal Form
1NF is the first level of normalisation. An entity
(table) is in First Normal form if it contains no
repeating attributes (fields) or groups of attributes.
Second Normal Form
An entity is in 2NF if no attribute (not part of the
primary key) is dependent on only part of the
primary key. This only applies to entities with
concatenated primary keys.
Third Normal Form
An entity is in 3NF if all attributes are entirely
dependent on the primary key and not on any
attribute that is not part of the primary key.
 Remove repeating (multiple) groups within the primary
entities (tables) so that each record (row) within the entity
is the same length.
 Repeating groups then become new entities, linked
together by a one-to-many relationship.
 Relationships are created by including a primary key from
one entity as a foreign key in another entity
Order
No.
Acc.
No.
Customer Address Date Item Qty. Item
Price
Total
Cost
7823 178 Daisy's Café 27 Bay Drive,
Cove
16/7 Bakewell
Tart
20 0.15 12.35
Danish
Pastry
13 0.20
Apple Pie 45 0.15
4633 526 Smiths 12 Dee View,
Aberdeen
16/7 Butteries 120 0.20 24.00
2276 167 Sally's
Snacks
3 High Street,
Banchory
17/7 Apple Pie 130 0.15 56.50
Cherry
Pie
100 0.18
Steak Pie 30 0.50
Meringue
Pie
20 0.20
1788 032 Tasty Bite 17 Wood Place,
Insch
18/7 Apple Pie 15 0.15 7.50
Danish
Pastry
50 0.20
Order
No.
Acc.
No.
Customer Address Date Item Qty. Item
Price
Total
Cost
7823 178 Daisy's Café 27 Bay Drive,
Cove
16/7 Bakewell
Tart
20 0.15 12.35
Danish
Pastry
13 0.20
Apple Pie 45 0.15
4633 526 Smiths 12 Dee View,
Aberdeen
16/7 Butteries 120 0.20 24.00
2276 167 Sally's
Snacks
3 High Street,
Banchory
17/7 Apple Pie 130 0.15 56.50
Cherry
Pie
100 0.18
Steak Pie 30 0.50
Meringue
Pie
20 0.20
1788 032 Tasty Bite 17 Wood Place,
Insch
18/7 Apple Pie 15 0.15 7.50
Danish
Pastry
50 0.20
Items Purchased
Orders
Items Purchased
Orders
Order No. can be used to uniquely identify each record and can
therefore be made the primary key.
Orders (Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Orders Table:
Items Purchased Table:
No one attribute can be used to
uniquely identify a record.
Order No. and Item together can
uniquely identify a record.
Concatenated key is required
Items (*Order No.
Purchased Item
Quantity
Item Price)
Items (*Order No.
Purchased Item
Quantity
Item Price
Orders (Order No.
Acc. No.
Customer
Address
Date
Total Cost)
First Normal Form
1NF is the first level of normalisation. An entity
(table) is in First Normal form if it contains no
repeating attributes (fields) or groups of attributes.
Second Normal Form
An entity is in 2NF if no attribute (not part of the
primary key) is dependent on only part of the
primary key. This only applies to entries with
concatenated primary keys.
Third Normal Form
An entity is in 3NF if all attributes are entirely
dependent on the primary key and not on any
attribute that is not part of the primary key.
 Test for dependency by testing each particular attribute in
turn to check that it can be uniquely identified by making
use of all the primary key. This test need not be completed
unless you have at least one table which requires a
concatenated Primary Key
 Remove all partially dependent attributes to a new
entity.
N.B. – A concatenated key occurs when you need two fields
together in order to uniquely identify a record
Items (*Order No.
Purchased Item
Quantity
Item Price)
Orders (Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Because this entity has a single attribute as the primary key
there can be no partial dependencies and therefore the entity
is already in 2NF.
Orders Table:
Primary Key Attribute Functionally Dependent?
Items Purchased Table:
Primary key is Order No. and Item
Test for dependency by testing each
particular attribute.
Primary Key Attribute Functionally Dependent?
Order No Quantity YES
Item Quantity is functionally dependent
on Order No. and Item.
Items Purchased Table:
Primary key is Order No. and Item
Test for dependency by testing each
particular attribute.
Primary Key Attribute Functionally Dependent?
Order No Item Price NO
Item Item price is functionally dependent
Item, but not on Order No. and Item
Order No Quantity YES
Item Quantity is functionally dependent
on Order No. and Item.
Items Purchased Table:
Primary key is Order No. and Item
Test for dependency by testing each
particular attribute.
Remove any partially dependent attributes to a new entity
Part Order Price List
Remove any partially dependent attributes to a new entity
Part Order
Create a relationship between the tables
Primary Key: ItemPrimary Key: Order No.
and *Item
and assign Primary Keys
Price List
Price List (Item
Item Price)
Orders (Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Part Order (*Order No.
*Item
Quantity)
First Normal Form
1NF is the first level of normalisation. An entity
(table) is in First Normal form if it contains no
repeating attributes (fields) or groups of attributes.
Second Normal Form
An entity is in 2NF if no attribute (not part of the
primary key) is dependent on only part of the
primary key. This only applies to entries with
concatenated primary keys.
Third Normal Form
An entity is in 3NF if all attributes are entirely
dependent on the primary key and not on any
attribute that is not part of the primary key.
 Test each attribute in turn to check for dependency on the
primary key.
 Remove all transitive dependencies to a new entity.
 A transitive dependency is where an attribute is dependent
on another attribute (or attributes) that is (are) NOT the
primary key
Price List (Item
Item Price)
Orders (Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Part Order (*Order No.
*Item
Quantity)
Test for
dependency
Primary Key Attribute Trasnsitive Dependency
Primary Key Attribute Trasnsitive Dependency
Order No. Acc.No. YES: Acc.No can be found if we know either
Customer or Address
Test for
dependency
Primary Key Attribute Trasnsitive Dependency
Order No. Acc.No. YES: Customer can be found if we know either
Acc.No. or Address
Order No. Customer YES Customer can be found if we know either
Acc.No. or Address
Test for
dependency
Primary Key Attribute Trasnsitive Dependency
Order No. Acc.No. YES: Customer can be found if we know either
Acc.No. or Address
Order No. Customer YES Acc.No. can be found if we know either
Customer or Address
Order No. Address YES Address can be found if we know either
Customer or Acc.No
Test for
dependency
Primary Key Attribute Trasnsitive Dependency
Order No. Acc.No. YES: Customer can be found if we know either
Acc.No. or Address
Order No. Customer YES Acc.No. can be found if we know either
Customer or Address
Order No. Address YES Address can be found if we know either
Customer or Acc.No
Order No. Date NO Dependent on Order No.
Test for
dependency
Primary Key Attribute Trasnsitive Dependency
Order No. Acc.No. YES: Customer can be found if we know either
Acc.No. or Address
Order No. Customer YES Acc.No. can be found if we know either
Customer or Address
Order No. Address YES Address can be found if we know either
Customer or Acc.No
Order No. Date NO Dependent on Order No.
Order No. Total Cost NO Dependent on Order No.
Test for
dependency
Remove transitive dependencies to a new entity
Orders Customers
Remove transitive dependencies to a new entity
Create a relationship between the tables
Orders Customers
and assign Primary Keys
Primary Key:
Order No.
Primary Key:
Acc.No.
Normalisation Complete
Orders (Order No.
*Acc. No.
Date
Total Cost)
Price List (Item
Item Price)
Part Order (*Order No.
*Item
Quantity)
Customers (Acc. No.
Customer
Address)
Normalisation -
1. Remove repeating groups to create a new entity
2. Create a relationship using one of the attributes that are
left [Usually the primary key]
3.‘Check out’ entities with concatenated keys. If any
attribute is not fully dependent on both parts of the primary
key remove it to create a new entity.
4. Create a relationship using one of the attributes that are
left [Usually the primary key]
5.‘Check out’ every entity. If any attribute is dependent on
any attribute other than the primary key, remove it into a
new entity.
6. Create a relationship using one of the attributes
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
E-R diagrams show the structure of the data to be
modelled.
They are a convenient method for representing the
relationships, entities and attributes in a system.
This is done by illustrating a system with a diagram to
produce a detailed specification for each entity and the
attributes within them.
Entity – a collection
of data [table]
Attribute – a data item
in an entity
[field]
ENTITY
ATTRIBUTE
Relationship – a
description of the link
between two entities.
Key Attribute – a data item
which makes up the
primary key or part of it.
KEY ATTRIBUTE
RELATIONSHIP
Simple Examples
1. A blind person owns a guide dog
Guide DogBlind Person owns
PatientsDoctor treats
1 M
1 1
2. A doctor treats many patients
Simple Examples
3. A film may have many stars and
each star may be in many films.
StarsFilm has
M N
Orders (Order No.
*Acc. No.
Date
Total Cost)
Price List (Item
Item Price)
Part Order (*Order No.
*Item
Quantity)
Customers (Acc. No.
Customer
Address)
Charlie’s
Baker Shop
Price List has
1 M
1 M
1
M
1. Determine the relationships between the
entities.
contains
Part Order
placesCustomers Orders
Orders (Order No.
*Acc. No.
Date
Total Cost)
Price List (Item
Item Price)
Part Order (*Order No.
*Item
Quantity)
Customers (Acc. No.
Customer
Address)
2. List the attributes alongside
each entity
Order No
*Acc. No
Date
Total Cost
Address
Customer
Acc.No
*Order No
*Item
Quantity
Price List has
placesCustomers Orders
1 M
1 M
1
M
contains
Part Order
Item
Item Price
Charlie’s
Baker Shop
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
Data Dictionary
• A data dictionary is a database about a
database and is often called metadata [data about data]
• It is created at the analysis stage to provide a record of
the attributes and their properties:
- Data type
- Required [or not] I.e. Can this field be left
blank ?
- Range
- Format
• When the database is up and running it acts as a useful
reference
Data Types
Text
A text attribute only stores letters from the standard 26
character alphabet
Number
Used to hold numeric data. Remember to show the range of
numbers to be stored [ Use common sense]
Text and Number
Used for alphanumeric data e.g. An address that may
contain a house number and street name.
Data Types
Date
Dates can be laid out using various formats. Two
common formats are short (dd/mm/yy) or
(dd/mm/yyyy) and long (month day, year)
Time
Various formats can be used here. A time of day, a
duration, 24-Hr clock, am/pm etc.
Boolean
These are binary values only having two states.
True/false, yes/no or off/on.
Data Types
The data types and formats used at this stage
will be general and will be mapped on to those
available in the RDBMS [Relational Database
Management System] in the design phase.
Data Dictionary for Charlie’s Baker
Shop
Entity Attribute Description
Order No Unique Identifier. Numbers in the range 1-
99999 required
Acc.No Unique Identifier. Numbers in the range 1-
99999 required
Date Short Form dd/mm/yy
Orders
Total Cost Cost of total order; Value up to £9999.99
required.
Acc.No Unique Identifier. See Orders entity
Customer Company Name required; text only
Customers
Address All address details for customer incl postcode
required. Text & Numbers
Item Unique Identifier. Numbers in the range 1-
9999required
Price List
Item Price Cost of item; Value up to £99.99 required
Order No Unique Identifier. See Orders entity
Item Unique Identifier. See Item entity
Part Order
Quantity Numbers in the range 1-999 required

Database management system

  • 2.
    • Data –A collection of raw facts and figures • Information – Final product created from the raw data after processing • Database – A collection of related information organised in a structured way to allow easy retrieval of any one item Some Terminology
  • 3.
    Database Management System[DBMS] • DBMS A computer program or collection of computer programs that provides the necessary tools to create and manipulate the data in a database • RDBMS Relational Database Management Systems are used to create and manipulate relational databases e.g. - Microsoft Access - Oracle - SQL Server
  • 4.
    Database Systems - Constructa data model of an existing, non computerised system THE ANALYSIS PHASE
  • 5.
    Analysis Phase • RequirementsDefinition • Normalisation • Entity-Relationship Diagrams • Data Dictionaries • Functions
  • 6.
    Analysis • Requirements Definition •Normalisation • Entity-Relationship Diagrams • Data Dictionaries • Functions
  • 7.
    When we normaliseany type of database system we need to know what the data in the system means. Therefore we either have to talk to the people who use the existing system or we have to be supplied with very detailed information about how the system works and the data stored within it. The following slide shows an example of some current data. Below this are listed some questions that help establish the requirements of the new system. Can you think of anything else the analyst might ask?
  • 8.
    Salesperson Number Salesperson Name Sales Area Customer Number Customer Name Warehouse Number Warehouse Location Sales Amount 3462 Walters West18765 18830 19242 Delta Systems A.Levy & Sons Rainer & Co. 4 3 3 Fargo Bismark Bismark 13540 10600 9700 3593 Dryne East 18841 18899 19565 R.W.Flood Inc. Seward Systems Stodola's Inc. 2 2 1 Superior Superior Plymouth 11560 2590 8800 • Does each salesperson have their own sales area? • Does each customer deal with only one salesperson ? • Does each customer only receive goods from one warehouse? The answer to these questions will influence how we structure the database system. The answer to these questions and others make up the Requirements Definition
  • 9.
    Analysis • Requirements Definition •Normalisation • Entity-Relationship Diagrams • Data Dictionaries • Functions
  • 10.
    Functional dependency meansthat there must be only a one-to-one dependency for each attribute mapped from a primary key to that attribute. For example, the engine number of a car [Primary Key] can only have engine capacity as an attribute of that key creating Functional Dependency BUT A particular engine capacity can be associated with the engine numbers of many makes of car. This does not give rise to Functional Dependency It defines a relationship in which the existence of one entity/attribute is entirely dependent on the existence of another (one-to-one).
  • 11.
    Order Number isthe primary key. The value for each attribute of SALES, except Item Price, depends upon the value of the primary key. All attributes of SALES, except Item Price, are Functionally Dependent on the primary key Item Price is Functionally Dependent on the the attribute Item
  • 12.
    Relationships Having established adefinition for the term Functional Dependency we now need to explore the different types of relationships that can exist between attributes in different entities: There are 3 types of relationships that can exist: • One to One Relationships • One to Many Relationships • Many to Many Relationships Now lets take a closer look at each of these on the next slides
  • 13.
    One-to-one A blind personowns a guide dog which is exclusively theirs. J. Smith B. Jones A. Gray Rover Pippa Patch
  • 14.
    One-to-many A doctor mayhave many patients, but a patient is assigned to only one doctor. Dr Ache Dr Payne Grant Allan Mark Jane Amy
  • 15.
    Many-to-many A film mayhave many stars and each star may act in many films. Film X Film Y Star A Star B Star C
  • 16.
    Important Note: An RDBMSsystem cannot produce a robust solution if two or more of the entities have a many to many relationship To overcome this problem it is necessary to introduce another entity thus creating One to Many relationships between itself and the offending entities This can become a common occurrence when you are working with larger and more complex database systems
  • 17.
    Now you shouldhave the tools and understanding you require in order to normalise the data in order that a solution can be produced using an RDBMS [Relational Database Management System] Please take your time when working through the next part of this presentation and revisit it again and again until you are completely comfortable with the concepts involved Normalisation of the data is perhaps the single most important aspect of developing a robust solution to any database problem!
  • 18.
    Normalisation is a'fancy' term for a set of rules, designed to make sure that a database is organised in the best way possible This allows the data to be processed more efficiently and any query to be processed. These rules depend on relationships being established between the entities to create a functional dependency between them.
  • 19.
    Finding and groupingtogether all the entities and their attributes. Removing repeating groups of data. This is another way of saying that there is no point in storing a persons' name and details etc. in many different places within a database. Providing unique keys for each entity in the database system. You need to have a way of making sure that when you delete 'Paul Smith' from the Transactions entity that it is the correct person.
  • 20.
    First Normal Form 1NFis the first level of normalisation. An entity (table) is in First Normal form if it contains no repeating attributes (fields) or groups of attributes. Second Normal Form An entity is in 2NF if no attribute (not part of the primary key) is dependent on only part of the primary key. This only applies to entities with concatenated primary keys. Third Normal Form An entity is in 3NF if all attributes are entirely dependent on the primary key and not on any attribute that is not part of the primary key.
  • 21.
     Remove repeating(multiple) groups within the primary entities (tables) so that each record (row) within the entity is the same length.  Repeating groups then become new entities, linked together by a one-to-many relationship.  Relationships are created by including a primary key from one entity as a foreign key in another entity
  • 22.
    Order No. Acc. No. Customer Address DateItem Qty. Item Price Total Cost 7823 178 Daisy's Café 27 Bay Drive, Cove 16/7 Bakewell Tart 20 0.15 12.35 Danish Pastry 13 0.20 Apple Pie 45 0.15 4633 526 Smiths 12 Dee View, Aberdeen 16/7 Butteries 120 0.20 24.00 2276 167 Sally's Snacks 3 High Street, Banchory 17/7 Apple Pie 130 0.15 56.50 Cherry Pie 100 0.18 Steak Pie 30 0.50 Meringue Pie 20 0.20 1788 032 Tasty Bite 17 Wood Place, Insch 18/7 Apple Pie 15 0.15 7.50 Danish Pastry 50 0.20
  • 23.
    Order No. Acc. No. Customer Address DateItem Qty. Item Price Total Cost 7823 178 Daisy's Café 27 Bay Drive, Cove 16/7 Bakewell Tart 20 0.15 12.35 Danish Pastry 13 0.20 Apple Pie 45 0.15 4633 526 Smiths 12 Dee View, Aberdeen 16/7 Butteries 120 0.20 24.00 2276 167 Sally's Snacks 3 High Street, Banchory 17/7 Apple Pie 130 0.15 56.50 Cherry Pie 100 0.18 Steak Pie 30 0.50 Meringue Pie 20 0.20 1788 032 Tasty Bite 17 Wood Place, Insch 18/7 Apple Pie 15 0.15 7.50 Danish Pastry 50 0.20
  • 24.
  • 25.
  • 26.
    Order No. canbe used to uniquely identify each record and can therefore be made the primary key. Orders (Order No. Acc. No. Customer Address Date Total Cost) Orders Table:
  • 27.
    Items Purchased Table: Noone attribute can be used to uniquely identify a record. Order No. and Item together can uniquely identify a record. Concatenated key is required Items (*Order No. Purchased Item Quantity Item Price)
  • 28.
    Items (*Order No. PurchasedItem Quantity Item Price Orders (Order No. Acc. No. Customer Address Date Total Cost)
  • 29.
    First Normal Form 1NFis the first level of normalisation. An entity (table) is in First Normal form if it contains no repeating attributes (fields) or groups of attributes. Second Normal Form An entity is in 2NF if no attribute (not part of the primary key) is dependent on only part of the primary key. This only applies to entries with concatenated primary keys. Third Normal Form An entity is in 3NF if all attributes are entirely dependent on the primary key and not on any attribute that is not part of the primary key.
  • 30.
     Test fordependency by testing each particular attribute in turn to check that it can be uniquely identified by making use of all the primary key. This test need not be completed unless you have at least one table which requires a concatenated Primary Key  Remove all partially dependent attributes to a new entity. N.B. – A concatenated key occurs when you need two fields together in order to uniquely identify a record
  • 31.
    Items (*Order No. PurchasedItem Quantity Item Price) Orders (Order No. Acc. No. Customer Address Date Total Cost)
  • 32.
    Because this entityhas a single attribute as the primary key there can be no partial dependencies and therefore the entity is already in 2NF. Orders Table:
  • 33.
    Primary Key AttributeFunctionally Dependent? Items Purchased Table: Primary key is Order No. and Item Test for dependency by testing each particular attribute.
  • 34.
    Primary Key AttributeFunctionally Dependent? Order No Quantity YES Item Quantity is functionally dependent on Order No. and Item. Items Purchased Table: Primary key is Order No. and Item Test for dependency by testing each particular attribute.
  • 35.
    Primary Key AttributeFunctionally Dependent? Order No Item Price NO Item Item price is functionally dependent Item, but not on Order No. and Item Order No Quantity YES Item Quantity is functionally dependent on Order No. and Item. Items Purchased Table: Primary key is Order No. and Item Test for dependency by testing each particular attribute.
  • 36.
    Remove any partiallydependent attributes to a new entity
  • 37.
    Part Order PriceList Remove any partially dependent attributes to a new entity
  • 38.
    Part Order Create arelationship between the tables Primary Key: ItemPrimary Key: Order No. and *Item and assign Primary Keys Price List
  • 39.
    Price List (Item ItemPrice) Orders (Order No. Acc. No. Customer Address Date Total Cost) Part Order (*Order No. *Item Quantity)
  • 40.
    First Normal Form 1NFis the first level of normalisation. An entity (table) is in First Normal form if it contains no repeating attributes (fields) or groups of attributes. Second Normal Form An entity is in 2NF if no attribute (not part of the primary key) is dependent on only part of the primary key. This only applies to entries with concatenated primary keys. Third Normal Form An entity is in 3NF if all attributes are entirely dependent on the primary key and not on any attribute that is not part of the primary key.
  • 41.
     Test eachattribute in turn to check for dependency on the primary key.  Remove all transitive dependencies to a new entity.  A transitive dependency is where an attribute is dependent on another attribute (or attributes) that is (are) NOT the primary key
  • 42.
    Price List (Item ItemPrice) Orders (Order No. Acc. No. Customer Address Date Total Cost) Part Order (*Order No. *Item Quantity)
  • 43.
    Test for dependency Primary KeyAttribute Trasnsitive Dependency
  • 44.
    Primary Key AttributeTrasnsitive Dependency Order No. Acc.No. YES: Acc.No can be found if we know either Customer or Address Test for dependency
  • 45.
    Primary Key AttributeTrasnsitive Dependency Order No. Acc.No. YES: Customer can be found if we know either Acc.No. or Address Order No. Customer YES Customer can be found if we know either Acc.No. or Address Test for dependency
  • 46.
    Primary Key AttributeTrasnsitive Dependency Order No. Acc.No. YES: Customer can be found if we know either Acc.No. or Address Order No. Customer YES Acc.No. can be found if we know either Customer or Address Order No. Address YES Address can be found if we know either Customer or Acc.No Test for dependency
  • 47.
    Primary Key AttributeTrasnsitive Dependency Order No. Acc.No. YES: Customer can be found if we know either Acc.No. or Address Order No. Customer YES Acc.No. can be found if we know either Customer or Address Order No. Address YES Address can be found if we know either Customer or Acc.No Order No. Date NO Dependent on Order No. Test for dependency
  • 48.
    Primary Key AttributeTrasnsitive Dependency Order No. Acc.No. YES: Customer can be found if we know either Acc.No. or Address Order No. Customer YES Acc.No. can be found if we know either Customer or Address Order No. Address YES Address can be found if we know either Customer or Acc.No Order No. Date NO Dependent on Order No. Order No. Total Cost NO Dependent on Order No. Test for dependency
  • 49.
  • 50.
    Orders Customers Remove transitivedependencies to a new entity
  • 51.
    Create a relationshipbetween the tables Orders Customers and assign Primary Keys Primary Key: Order No. Primary Key: Acc.No.
  • 52.
    Normalisation Complete Orders (OrderNo. *Acc. No. Date Total Cost) Price List (Item Item Price) Part Order (*Order No. *Item Quantity) Customers (Acc. No. Customer Address)
  • 53.
    Normalisation - 1. Removerepeating groups to create a new entity 2. Create a relationship using one of the attributes that are left [Usually the primary key] 3.‘Check out’ entities with concatenated keys. If any attribute is not fully dependent on both parts of the primary key remove it to create a new entity. 4. Create a relationship using one of the attributes that are left [Usually the primary key] 5.‘Check out’ every entity. If any attribute is dependent on any attribute other than the primary key, remove it into a new entity. 6. Create a relationship using one of the attributes
  • 54.
    Analysis • Requirements Definition •Normalisation • Entity-Relationship Diagrams • Data Dictionaries • Functions
  • 55.
    E-R diagrams showthe structure of the data to be modelled. They are a convenient method for representing the relationships, entities and attributes in a system. This is done by illustrating a system with a diagram to produce a detailed specification for each entity and the attributes within them.
  • 56.
    Entity – acollection of data [table] Attribute – a data item in an entity [field] ENTITY ATTRIBUTE
  • 57.
    Relationship – a descriptionof the link between two entities. Key Attribute – a data item which makes up the primary key or part of it. KEY ATTRIBUTE RELATIONSHIP
  • 58.
    Simple Examples 1. Ablind person owns a guide dog Guide DogBlind Person owns PatientsDoctor treats 1 M 1 1 2. A doctor treats many patients
  • 59.
    Simple Examples 3. Afilm may have many stars and each star may be in many films. StarsFilm has M N
  • 60.
    Orders (Order No. *Acc.No. Date Total Cost) Price List (Item Item Price) Part Order (*Order No. *Item Quantity) Customers (Acc. No. Customer Address)
  • 61.
    Charlie’s Baker Shop Price Listhas 1 M 1 M 1 M 1. Determine the relationships between the entities. contains Part Order placesCustomers Orders
  • 62.
    Orders (Order No. *Acc.No. Date Total Cost) Price List (Item Item Price) Part Order (*Order No. *Item Quantity) Customers (Acc. No. Customer Address)
  • 63.
    2. List theattributes alongside each entity Order No *Acc. No Date Total Cost Address Customer Acc.No *Order No *Item Quantity Price List has placesCustomers Orders 1 M 1 M 1 M contains Part Order Item Item Price Charlie’s Baker Shop
  • 64.
    Analysis • Requirements Definition •Normalisation • Entity-Relationship Diagrams • Data Dictionaries • Functions
  • 65.
    Data Dictionary • Adata dictionary is a database about a database and is often called metadata [data about data] • It is created at the analysis stage to provide a record of the attributes and their properties: - Data type - Required [or not] I.e. Can this field be left blank ? - Range - Format • When the database is up and running it acts as a useful reference
  • 66.
    Data Types Text A textattribute only stores letters from the standard 26 character alphabet Number Used to hold numeric data. Remember to show the range of numbers to be stored [ Use common sense] Text and Number Used for alphanumeric data e.g. An address that may contain a house number and street name.
  • 67.
    Data Types Date Dates canbe laid out using various formats. Two common formats are short (dd/mm/yy) or (dd/mm/yyyy) and long (month day, year) Time Various formats can be used here. A time of day, a duration, 24-Hr clock, am/pm etc. Boolean These are binary values only having two states. True/false, yes/no or off/on.
  • 68.
    Data Types The datatypes and formats used at this stage will be general and will be mapped on to those available in the RDBMS [Relational Database Management System] in the design phase.
  • 69.
    Data Dictionary forCharlie’s Baker Shop Entity Attribute Description Order No Unique Identifier. Numbers in the range 1- 99999 required Acc.No Unique Identifier. Numbers in the range 1- 99999 required Date Short Form dd/mm/yy Orders Total Cost Cost of total order; Value up to £9999.99 required. Acc.No Unique Identifier. See Orders entity Customer Company Name required; text only Customers Address All address details for customer incl postcode required. Text & Numbers Item Unique Identifier. Numbers in the range 1- 9999required Price List Item Price Cost of item; Value up to £99.99 required Order No Unique Identifier. See Orders entity Item Unique Identifier. See Item entity Part Order Quantity Numbers in the range 1-999 required

Editor's Notes

  • #8 Copy Note
  • #9 Copy Note
  • #11 Copy Note
  • #12 Transactions table for video shop Transaction No is primary key Value for each attribute changes as Primary key changes All attributes of transaction can be said to be functionally dependent upon the primary key
  • #14 Copy
  • #15 Copy
  • #16 Copy
  • #19 Copy
  • #20 Copy by stage
  • #21 Copy by stage
  • #22 Copy by stage
  • #23 Table for a video bakers shop - describe attributes For 1NF we require fixed length records
  • #24 We can see that Order No. 7823 has repeating (multiple) entries for Item, Quantity & Item Price, and so on...
  • #25 Remove repeating groups Form new entities (tables)
  • #26 To complete 1NF we need to create the relationship between the tables - this is achieved by repeating the Order No. field in each table.
  • #27 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #28 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #29 Tables in 1NF
  • #30 Copy by stage
  • #31 Copy by stage
  • #32 Tables in 1NF
  • #33 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #34 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #35 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #36 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #37 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #38 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #39 Items purchased - no one attribute can be used to uniquely identify a single record. If we choose Order No. there is no unique association If we choose Item. there is no unique association etc We must therefore create a CONCATENATED KEY - so what do we need to find each record in the entity? We can use Order No. AND Item to uniquely identify each record
  • #40 Tables in 1NF
  • #41 Copy by stage
  • #42 Copy by stage
  • #43 Tables in 1NF
  • #44 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #45 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #46 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #47 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #48 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #49 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #50 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #51 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #52 Assign primary key to each table Orders - Order No uniquely identifies each record.
  • #53 Tables in 1NF
  • #56 Copy by stage
  • #57 Copy by stage
  • #58 Copy by stage
  • #61 Tables in 1NF
  • #63 Tables in 1NF