Microsoft Access - Introductory level
Access Lesson Three
DESCRIPTION:
This lesson teaches how a database can be used to store data in a library database system and introduces the use of primary key.
SPECIFIC OBJECTIVES:
At the end of the lesson students should be able to :
- Create a library database
- Add a table for books
- Add a table for users
- Use primary keys
PREREQUSITE KNOWLEDGE:
Before attempting this lesson you should know :
- The difference between data and information
- How to switch between design and datasheet views
- The different access data types
- How to modify the structure of a table
Microsoft Access - A library database system
3.0 Designing a database
There are a number of questions we must ask ourselves before designing a database. The most importatant question is :
What is the purpose of the database?
Other questions are :
- What questions would you like the database to answer for you
- What reports do you want the database to produce
- Who will use the database
- What training would staff need
- How will the network be set up
3.1 What is a library database?
A library database management system is primarily a computerised collection of books, magazine and periodical data. Library staff maintain records of books and borrowers. By using such a system, library personnel are able to answer queries about the status of books more easily than if a manual system was being used.
Components of the system
A database server with very large secondary storage capacity will store the information which will be accessed by a number of laptop and desktop computers attached via a local area network with printers. Staff responsible for data entry use ergonomically designed keyboards, desks and chairs in well ventilated and well lit rooms.
3.2 Create a new database
- Click on the START button
- Click on PROGRAMS
- Select Microsoft Access
- Choose create a database from scratch
- Provide a File name : dbLibrary
- Specify a location from the options available
When a new database is created from scratch there are no objects in it. We must create a table before we can add data. We must examine the data to determine the structure needed to hold each data item.
Books table details
When we layout the data in tabular format it is easy for us to determine exactly what fields we need for each table. For our library database we will create our first table with eight fields.
| book ID | ISBN | Title | Author | Publisher | Category | Cost | Purchased |
|---|---|---|---|---|---|---|---|
| 1001 | 0-684-81516-8 | Raising a responsible child | Dr. Dinkmeyer & Dr. Mckay | Simon &Schuster | psychology | $125 | 17/12/2021 |
| 1102 | 978-0-141-32491-3 | Diary of a Wimpy Kid | Jeff Kinney | puffinbooks | children | $10 | 06/07/2019 |
| 2001 | 0-688-01490-9 | Robotics | David Knight | Marrow &Co | computer | $45 | 09/11/1996 |
| 2010 | 0-333-25897-5 | Comprension | J. Wheatley | Macmillan | language | $10 | 07/06/2000 |
| 2030 | 981-242-560-8 | Science 1 | T. Lai Hoong | SNP Panpac | science | $200 | 17/06/2010 |
From the tabular data we determine the names and data type of each field as follows :
3.3 Creating a new table : tblBooks
- Book ID - text
- ISDN number - text
- Title - text
- Author - text
- Publisher - text
- Category - text
- Cost - currency
- Purchased - date/time
Members table details
Each member is assigned a unique member ID.
| Member ID | Surname | First | dob | Street | Town | phone | |
|---|---|---|---|---|---|---|---|
| A3300 | Smith | Petal | 23/03/1999 | 7 Paul St | POS | 323-1452 | psmith@topmail.net |
| A0025 | Medford | Timothy | 30/06/2000 | 1 Goat St | Arima | 223-1652 | timtop@tmail.net |
| A3010 | Watson | Dexter | 9/01/2002 | 5 Rose Hill | Morvant | 453-1352 | watson45@gmail.com |
| A4503 | Spencer | Trudy | 23/03/1999 | 2 Third St | Barataria | 463-8352 | trudy25@gmail.com |
| A8502 | Richards | Elvis | 11/06/2000 | 11 Hilltop | San Juan | 653-8352 | erstuff@gmail.com |
| S7100 | Burke | Nancy | 19/07/2002 | 8 Blue Range | Diamond Vale | 253-5352 | burkey@gmail.com |
| S9570 | Kitson | Gary | 19/03/2002 | 10 Plover | Laventille | 534-2372 | gkitson@yahoo.com |
From the tabular data we determine the field names and data type of each field as follows :
3.4 Creating a new table : tblMembers
- Member ID - text
- Surname - text
- First - text- first name
- dob - date/time - date of birth
- Street Address - text
- Town Address - text
- Phone number - text
- email - text
REMEMBER : Common data types
After you select a data type from the drop down list the 'Field Properties' pane appears at the bottom of the window. The data type text is selected by default. The most common data types are listed below.
| Data types | Explanation |
|---|---|
| Text | Stores alphanumeric and symbols and numeric data |
| Memo | Stores lengthy text type data |
| Number | Stores numeric data suitable for calculations |
| Autonumber | Stores a unique number selected by the computer |
| Date/Time | Stores a variety of date and time formats |
| Currency | Used to store currency (money) values |
| Yes/No | Stores Yes/No or True/False or On/Off only |
3.5 Primary Key
A primary key is a selected field or set of fields that uniquely identifies a record in a table. A primary key is not always used but it is often a good idea to use a primary key in a table. :
In the members table the member ID field is to be used as the primary key field.
- Open tblMembers in design view
- Select the Member ID field
- Click on the Primary Key Icon (key) on tool bar
- OR choose Primary Key from the EDIT menu
Primary keys speeds up data storage and retrievel. They also enable a relationship between tables so that they can be joined.
Test Yourself
End of Lesson Three - Creating tables for a Library System
|
The Tutor |
Site Comments to: Webmaster |