RDBMS
RDBMS
RDBMS
A guide to
producing a
fully functional
RDBMS
Contents
Theory and terminology
The Analysis Phase
Requirements Definition
Normalisation
Some Terminology
Data
Elements of a database
Table
Types of Database
Flat file Database Single table
Relational Database Multi table
Typographical Errors
Greater likelihood of errors when data is being entered.
Characteristics of a
relational database
Data is stored in a set of tables
Tables are joined by relational links
Reduces duplication of data in database
- Normalisation
Allows greater flexibility and efficiency
Foreign key
- Microsoft Access
- Oracle
- Lotus Approach
Database Systems
Analysis Phase
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
Database Systems
Analysis
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
Requirements Definition
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.
Requirements Definition
Salesperson
Number
3462
Salesperson
Name
Walters
Sales
Area
West
3593
Dryne
East
Customer
Number
18765
18830
19242
18841
18899
19565
Customer
Name
Delta Systems
A.Levy & Sons
Rainer & Co.
R.W.Flood Inc.
Seward Systems
Stodola's Inc.
Warehouse
Number
4
3
3
2
2
1
Warehouse
Location
Fargo
Bismark
Bismark
Superior
Superior
Plymouth
Sales
Amount
13540
10600
9700
11560
2590
8800
Database Systems
Analysis
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
Functional Dependency
Functional dependency means that there must be only a oneto-one dependency for each attribute mapped from a
primary key to that attribute.
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
Entity Relationships
One-to-one
A blind person owns a guide
dog which is exclusively
theirs.
J. Smith
Rover
B. Jones
Pippa
A. Gray
Patch
Entity Relationships
One-to-many
A doctor may have many
patients, but a patient is
assigned to only one doctor.
Grant
Dr Ache
Allan
Mark
Dr Payne
Jane
Amy
Entity Relationships
Many-to-many
A film may have many stars
and each star may act in
many films.
Film X
Star A
Star B
Film Y
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
Normalisation
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.
Acc.
No.
178
Customer
Address
Date
Item
Daisy's Caf
27 Bay Drive,
Cove
16/7
Bakewell
Tart
Danish
Pastry
Apple Pie
Qty.
Item
Total
Price
Cost
20
0.15 12.35
13
0.20
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
Steak Pie
100
0.18
30
0.50
Meringue
Pie
20
0.20
Apple Pie
15
0.15
Danish
Pastry
50
0.20
1788
032
Tasty Bite
17 Wood Place,
Insch
18/7
7.50
Acc.
No.
178
Customer
Address
Date
Item
Daisy's Caf
27 Bay Drive,
Cove
16/7
Bakewell
Tart
Danish
Pastry
Apple Pie
Qty.
Item
Total
Price
Cost
20
0.15 12.35
13
0.20
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
Steak Pie
100
0.18
30
0.50
Meringue
Pie
20
0.20
Apple Pie
15
0.15
Danish
Pastry
50
0.20
1788
032
Tasty Bite
17 Wood Place,
Insch
18/7
7.50
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Order
No.
7823
7823
7823
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Item
Price
20
0.15
13
0.20
45
0.15
Orders
Qty.
Items Purchased
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Order
No.
7823
7823
7823
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Item
Price
20
0.15
13
0.20
45
0.15
Orders
Qty.
Items Purchased
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
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)
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Qty.
Item
Price
20
0.15
13
0.20
45
0.15
Items
Purchased
Orders
(Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Items
Purchased
(*Order No.
Item
Quantity
Item Price
Orders
(Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Items
Purchased
(*Order No.
Item
Quantity
Item Price)
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Order
No.
7823
7823
7823
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Primary Key
Qty.
Item
Price
20
0.15
13
0.20
45
0.15
Attribute
Order
No.
7823
7823
7823
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Qty.
Item
Price
20
0.15
13
0.20
45
0.15
Primary Key
Attribute
Functionally Dependent?
Order No
Item
Quantity
YES
Order
No.
7823
7823
7823
Item
4633
Butteries
120
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Qty.
Item
Price
20
0.15
13
0.20
45
0.15
Primary Key
Attribute
Functionally Dependent?
Order No
Item
Quantity
YES
Order No
Item
Item Price
NO
Item
4633
Butteries
120
0.20
0.20
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
0.15
0.18
0.50
0.20
0.15
0.18
0.50
0.20
1788
1788
Apple Pie
Danish Pastry
15
50
0.15
0.20
0.15
0.20
Bakewell Tart
Danish Pastry
Apple Pie
Qty.
Item
Price
20
0.15
13
0.20
45
0.15
Item
Price
0.15
0.20
0.15
Item
4633
Butteries
120
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
1788
1788
Apple Pie
Danish Pastry
15
50
Bakewell Tart
Danish Pastry
Apple Pie
Part Order
Qty.
20
13
45
Item
Price
0.15
0.15
0.20
0.18
0.20
0.20
0.50
Price List
Item
4633
Butteries
120
2276
2276
2276
2276
Apple Pie
Cherry Pie
Steak Pie
Meringue Pie
130
100
30
20
1788
1788
Apple Pie
Danish Pastry
15
50
Bakewell Tart
Danish Pastry
Apple Pie
Qty.
20
13
45
Part Order
Primary Key: Order No.
and *Item
Item
Apple Pie
Bakewell Tart
Butteries
Cherry Pie
Danish Pastry
Meringue Pie
Steak Pie
Item
Price
0.15
0.15
0.20
0.18
0.20
0.20
0.50
Price List
Primary Key: Item
Orders
(Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Price List
(Item
Item Price)
Part Order
(*Order No.
*Item
Quantity)
Orders
(Order No.
Acc. No.
Customer
Address
Date
Total Cost)
Price List
(Item
Item Price)
Part Order
(*Order No.
*Item
Quantity)
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order No.
YES:
Acc.No.
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order No.
Acc.No.
YES:
Order No.
Customer
YES
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order No.
Acc.No.
YES:
Order No.
Customer
YES
Order No.
Address
YES
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order No.
Acc.No.
YES:
Order No.
Customer
YES
Order No.
Address
YES
Order No.
Date
NO
Order
No.
7823
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
56.50
032
3 High Street,
Banchory
17 Wood Place,
Insch
17/7
1788
Sally's
Snacks
Tasty Bite
18/7
7.50
Trasnsitive Dependency
Order No.
Acc.No.
Order No.
Customer
YES
Order No.
Address
YES
Order No.
Date
NO
Order No.
Total Cost
NO
Acc.
No.
178
Customer
Address
Date
Daisy's Caf
27 Bay Drive,
Cove
16/7
Total
Cost
12.35
4633
526
Smiths
12 Dee View,
Aberdeen
16/7
24.00
2276
167
Sally's
Snacks
3 High Street,
Banchory
17/7
56.50
1788
032
Tasty Bite
17 Wood Place,
Insch
18/7
7.50
Acc.
No.
178
Customer
Address
Daisy's Caf
27 Bay Drive,
Cove
526
Smiths
12 Dee View,
Aberdeen
167
Sally's
Snacks
3 High Street,
Banchory
032
Tasty Bite
17 Wood Place,
Insch
Orders
Order
No.
7823
Date
16/7
Total
Cost
12.35
4633
16/7
24.00
2276
17/7
56.50
1788
18/7
7.50
Customers
Acc.
No.
178
Customer
Address
Daisy's Caf
27 Bay Drive,
Cove
526
Smiths
12 Dee View,
Aberdeen
167
Sally's
Snacks
3 High Street,
Banchory
032
Tasty Bite
17 Wood Place,
Insch
Customers
Order
No.
7823
Acc.
No.
178
Date
16/7
Total
Cost
12.35
4633
526
16/7
24.00
2276
167
17/7
56.50
1788
032
18/7
7.50
Primary Key:
Order No.
Acc.
No.
178
Customer
Address
Daisy's Caf
27 Bay Drive,
Cove
526
Smiths
12 Dee View,
Aberdeen
167
Sally's
Snacks
3 High Street,
Banchory
032
Tasty Bite
17 Wood Place,
Insch
Primary Key:
Acc.No.
Price List
(Acc. No.
Customer
Address)
(Item
Item Price)
Orders
(Order No.
*Acc. No.
Date
Total Cost)
Part Order
(*Order No.
*Item
Quantity)
Normalisation Complete
Database Systems
Analysis
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
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
Entity a collection
of data [table]
ATTRIBUTE
KEY ATTRIBUTE
RELATIONSHIP
Relationship a
description of the
link between two
entities.
Simple Examples
1. A blind person owns a guide dog
Blind Person
owns
Guide Dog
Doctor
treats
Patients
Simple Examples
3. A film may have many stars and
each star may be in many films.
Film
has
Stars
Price List
(Acc. No.
Customer
Address)
(Item
Item Price)
Orders
(Order No.
*Acc. No.
Date
Total Cost)
Part Order
(*Order No.
*Item
Quantity)
entities.
Customers
places
Orders
Charlies
Baker Shop
contains
M
Price List
has
Part Order
Price List
(Acc. No.
Customer
Address)
(Item
Item Price)
Orders
(Order No.
*Acc. No.
Date
Total Cost)
Part Order
(*Order No.
*Item
Quantity)
Order No
*Acc. No
Total Cost
each entity
Customers
places
Acc.No
Address
Price List
Item
Item Price
Charlies
Baker Shop
Customer
has
Orders
Date
contains
M
Part Order
*Order No
*Item
Quantity
Database Systems
Analysis
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
Data Dictionary
A data dictionary is a database about a
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.
Attribute
Order No
Acc.No
Date
Total Cost
Customers
Price List
Part Order
Description
Unique Identifier. Numbers in the range 199999 required
Unique Identifier. Numbers in the range 199999 required
Short Form dd/mm/yy
Acc.No
Customer
Address
Item
Item Price
Order No
Item
Quantity
Database Systems
Analysis
Requirements Definition
Normalisation
Entity-Relationship Diagrams
Data Dictionaries
Functions
Functions
A function is anything that acts on the
data in a database system and is classified
as input, process or output.
Input
An input is a function that places new data in the
system such as creating, updating or deleting data
Process
An automated function within the database system
e.g. automatic update of an attribute, checking the
particular value of an attribute, changing or
calculating new values from the data
Functions
Output
A function that produces data from the
database system e.g. a report, letter or
summary of the data
Beyond these Operational functions modern
computerised database systems can provide a wide
range of Strategic and Tactical information which
can assist with planning and organising e.g. queries
and ordered lists can provide the Company with
invaluable marketing information
Price List
Part
Order
Input
Process
Output
List all orders
List all customers
with outstanding
orders
Automatically
update total cost
of an order
Indexes
The keys chosen for the database structures are
the same as those identified in the data model.
These remember were established during the
normalisation process
PRESENCE
Checks to see if a value is present or not. E.g. if a field
value must be set, a presence check would be carried out
on it.
RANGE
Checks to see if a value entered is within a prescribed
range.
RESTRICTED CHOICE
This would ensure that the user only entered data that
corresponded to a list of pre-set values e.g. N S E or W
: Orders
Type
Size
Order No
Autonumber
Acc. No
Customer
Address1
Address2
Address3
Postcode
Date
Total Cost
Number
Text
Text
Text
Text
Text
Date/Time
Currency
Validation
Req'd
Index
Size
Yes
Auto
35
50
50
50
8
Auto
Auto
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes (Unique)
Primary Key
No
No
No
No
No
No
No
No
>=10.00
Format
XX9?_9XX
Short Date
99.99
Relationships
State the relationships that will be
implemented using the RDBMS. These
should be the same as for the E-R
diagram.
However, in the design phase we show the
relationships between the primary and
foreign key fields in each table.
Price List
(Acc. No.
Customer
Address)
(Item
Item Price)
Orders
(Order No.
*Acc. No.
Date
Total Cost)
Part Order
(*Order No.
*Item
Quantity)
[Customers.Acc.No.]
1: M
[Orders.Acc.No.]
[Orders.Order No]
1: M
[Price List.Item]
1: M
[Part Order.Item]
Database Systems
Implementation Phase
Database Systems
Implementation Phase
Table names
Fieldnames and whether indexed or not
Validity checks
Primary/foreign keys
Database Systems
Implementation Phase
EDIT
SORT
INSERT
DELETE
Database Systems
Implementation Phase
Base Tables
Styles of Query
Textual
Numeric
Exact
Inexact
Graphical Tools
Allow us to select and enter the details for the query graphically
e.g. The tool you are using in Microsoft Access
Database Systems
Implementation Phase
Reports
A report is like a query in that it can summarise
the data in the database. However reports are
used to produce printed output [ Hard Copy]
e.g. The user may require a listing of all
customers and their addresses from the database
N.B. When producing reports using MS Access
it is possible to perform some basic statistical
analysis on the data if the data type is numeric
Database Systems
Implementation Phase
Database Systems
Implementation Phase