Access: creating a database

advertisement
BUS1MIS Management Information Systems
Semester 1, 2012
Access: Creating a Database
Week 6 Lecture 2
In this lecture the key ideas are:
• A broad understanding of a relational database is
important knowledge for business managers.
• A relational database organises data into multiple
related tables.
• An effective relational database minimises data
redundancy.
Also included will be:
• An overview of creating a relational database
in Microsoft Access 2007
At the core of a Management Information System is a
database (or many databases)
The key component of a database is a table.
Customer Table
Field
Customer
ID
Customer
Name
Customer
Address
Customer
Phone
6512
Jones
Bendigo
5444888
7989
Singh
Catlemaine
5442777
9112
Ng
Echuca
5967222
Record
A table stores data about some entity in the real world. For
example, customers, orders, items of stock.
A table has rows and columns like a spreadsheet.
Each column describes an attribute of the entity. For
example, customer name, customer address. An
individual column in a table is called a field.
Each row describes an instance of the entity. For example,
a customer, an order, an item of stock. An individual row in
a table is called a record.
Comparison between a database table and a spreadsheet
A blank spreadsheet is an open book. You can add
whatever you want in whatever structure you want.
A database table has a predefined structure. Each row in
the table has an identical structure.
A business manager needs the knowledge to be confident
that the database underlying an important MIS has been
correctly designed by the IT person responsible.
If a database is not correctly designed the data may be……
• poorly organised and/or
• incomplete and/or
• inaccurate and/or
• duplicated
…. then management will receive poor quality reports and
poor decisions are likely to be made.
What is the correct design for a database?
Let’s try “simple is best” first and put all our data in the
one table.
See the next slide for the example to be used in the lecture
CJC’s Images
Order Form
Order #: 1927
Order Date: 12/5/09
Customer Name: Liam
Customer Address: Brisbane
Item #
Item Name
Qty Ordered
3720
Large Framed
3
2917
Small Unframed
6
1129
Small Framed
1
Let’s design a single table to store this data
Order
#
Order
Date
Cust.
Name
Cust.
Item#
Address
Item Name
Quantit
y
1927
12/5/09
Liam
Brisbane 3720
LFramed
3
1927
12/5/09
Liam
Brisbane 2917
SUnframed
6
1927
12/5/09
Liam
Brisbane 1129
SFramed
1
Assume there are other orders as well
1928
13/5/09
Kirsty
Sydney
1129
SFramed
2
1928
13/5/09
Kirsty
Sydney
1800
LUFramed
15
1929
14/5/09
Liam
Brisbane 3720
LFramed
1
1929
14/5/09
Liam
Brisbane 2917
SUFramed
1
1929
14/5/09
Liam
Brisbane 1129
SFramed
1
1929
14/5/09
Liam
Brisbane 1800
LUFramed
1
If Liam changes address, how many changes need to be made to
the table?
Putting all our data in a single table means we have ended up with
…….
Data Redundancy
…. the scourge of all database design.
How do we avoid data redundancy in our database
design?
Most business databases use a relational database design.
The database consists of multiple, related tables
Any piece of data is only stored ONCE
If we apply a relational database design to the Order Form in the
previous slide we would have 4 related tables.
Cust
Name
Cust
Address
Order
#
Item
#
Quantity
Liam
Brisbane
1927
3720
3
Kirsty
Sydney
1927
2917
6
1927
1129
1
1928
1129
2
Item
#
Item
Name
1129
SFramed
1928
1800
15
1800
LUFramed
1929
3720
1
2917
SUFramed
………
……
…
3720
LFramed
Order
#
Order
Date
Cust
Name
1927
12/5/09
Liam
1928
13/5/09
Kirsty
1929
14/5/09
Liam
If Liam changes address, how many
changes need to be made to the
database?
To maintain the links between the tables we need …
1.A field in each table which uniquely identifies each record (called
a primary key)
2.Some software to maintain the links
The primary key is nearly always a number, as in a Student ID.
The software to create the tables and maintain the links is
known as a Database Management System (DBMS)
We will be using Microsoft Access as a DBMS.
Download