Professional Documents
Culture Documents
Database Systems: A Guide To Producing A Fully Functional Rdbms
Database Systems: A Guide To Producing A Fully Functional Rdbms
A guide to
producing a
fully functional
RDBMS
How Can this Presentation
Help Me?
If you work through this presentation use the terminology
quoted and produce all the diagrams and documentation
mentioned throughout this presentation, you will have
succeeded in meeting most of the requirements necessary
to produce a successful report on the analysis, design and
implementation of a Relational Database.
Types of Database
Flat file Database – Single table
Relational Database – Multi table
Flat-file Database – Single table
A telephone directory is an
example of a flat file database
• Redundant Data
Data is repeated and hence stored many times. This
wastes disk space and slows down query time.
• Typographical Errors
Greater likelihood of errors when data is being entered.
Problems with flat-file databases
• Updating Data
Every occurrence of a piece of data will have to be
updated if its value changes
• Modifying Data
If a record is deleted this may destroy all reference to a
particular piece of data
• Redundant Data
The disk space required to store data is reduced and
queries can be performed more quickly.
• Typographical Errors
As data is only entered once the chances of these errors
occurring are greatly reduced..
Relational Database – Multi table
• Updating Data
Data need only be updated once as it would only have
been entered once
• Modifying Data
Problems of the kind mentioned earlier disappear. New
records will simply have their attributes added to the
relevant table
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
- 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
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
Functional Dependency
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.
Star A
Film X
Star B
Film Y
Star C
Important Note:
4633 526 Smiths 12 Dee View, 16/7 Butteries 120 0.20 24.00
Aberdeen
2276 167 Sally's 3 High Street, 17/7 Apple Pie 130 0.15 56.50
Snacks Banchory
Cherry 100 0.18
Pie
Steak Pie 30 0.50
Meringue 20 0.20
Pie
1788 032 Tasty Bite 17 Wood Place, 18/7 Apple Pie 15 0.15 7.50
Insch
Danish 50 0.20
Pastry
Charlie’s Baker Shop
Order Acc. Customer Address Date Item Qty. Item Total
No. No. Price Cost
7823 178 Daisy's Café 27 Bay Drive, 16/7 Bakewell 20 0.15 12.35
Cove Tart
Danish 13 0.20
Pastry
Apple Pie 45 0.15
4633 526 Smiths 12 Dee View, 16/7 Butteries 120 0.20 24.00
Aberdeen
2276 167 Sally's 3 High Street, 17/7 Apple Pie 130 0.15 56.50
Snacks Banchory
Cherry 100 0.18
Pie
Steak Pie 30 0.50
Meringue 20 0.20
Pie
1788 032 Tasty Bite 17 Wood Place, 18/7 Apple Pie 15 0.15 7.50
Insch
Danish 50 0.20
Pastry
Charlie’s Baker Shop
Orders
Items Purchased
Charlie’s Baker Shop
Orders
Items Purchased
Charlie’s Baker Shop
Orders Table:
Order No. can be used to uniquely identify each record and can
therefore be made the primary key.
Orders Table:
Test for
dependency
Test for
dependency
Test for
dependency
Test for
dependency
Test for
dependency
Test for
dependency
Orders Customers
Charlie’s Baker Shop - 3NF Step2
Orders Customers
Normalisation Complete
Normalisation -
Analysis
• Requirements Definition
• Normalisation
• Entity-Relationship Diagrams
• Data Dictionaries
• Functions
Entity - Relationship Diagrams
Relationship – a
description of the
RELATIONSHIP link between two
entities.
Simple Examples
1 1
Blind Person owns Guide Dog
1 M
Doctor treats Patients
Simple Examples
M N
Film has Stars
Charlie’s Baker Shop
Third Normal Form
1 M
Customers places Orders
1
Charlie’s
contains
Baker Shop
M
1 M
Price List has Part Order
Charlie’s Baker Shop
Third Normal Form
Acc.No 1
Customer Charlie’s
contains
Address Baker Shop
M
1 M
Price List has Part Order
*Order No
Item
*Item
Item Price
Quantity
Database Systems
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
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
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
Database Systems-Design Phase
Database Structure and item names
relate to the data model
Unique keys are chosen for all
Database structures
Validity checks represent the data
model
Data item characteristics represent the
data model
Designed structures are appropriate to the
intended implementation method
Every RDBMS has its own set of data
types that it can implement.
[Customers.Acc.No.] 1: M [Orders.Acc.No.]
Table names
Fieldnames and whether indexed or not
Validity checks
Primary/foreign keys
Base Tables – The original table that the query acted upon
Textual
Queries that act on fields of the text data type
Numeric
Queries that act on fields of the numeric data type
Exact
Finds a specific match on a field for particular criteria
e.g. customers with surname ‘Smith’.
Inexact
Looks for values within a range in a particular field
e.g. customers with names beginning with 'S'
Combinations of search criteria
Uses a combination of criteria e.g. All customers who
ordered items costing <£1.50
Different tools have been developed to allow us to query
a relational database through the RDBMS
Graphical Tools
Allow us to select and enter the details for the query graphically
e.g. The tool you are using in Microsoft Access
Structured Query Language [SQL]
A recognised international standard for creating queries for relational
databases e.g.
SELECT DISTINCT [Orders].[Acc.No.],
Sum([Orders].[Total Cost]) AS [SumOfTotal Cost]
FROM [Orders]
GROUP BY [Orders].[Acc.No.];