Planning a Database © EIT, Author Gay Robertson, 2019
The 3 steps to planning … Step one determine the purpose by looking at the brief Step two determine the fields, the fieldnames (no spaces in fieldnames), the field sizes (estimate or work out an average size, by looking at data), determine the data types by looking at the brief Step three determine the primary key field – look at the facts – find the fact that cannot be duplicated
Determine the purpose … Decide the purpose of the database by looking at the brief (the brief is the list of everything that needs to be included in the database and everything that needs to be produced from the database)
Purpose … The purpose of the database is to set up an inventory for the Taradale Cake Shop
Determine the fields, fieldnames and data types Decide what facts you need to keep track of by reading the brief
Fields ….. The facts needed will be your Fields Record these fieldnames in your Plan Plan Plan of Action: Fieldname ItemNo Item Quantity Price Dept Fieldnames should have NO SPACES in them. They can be abbreviated eg Quan for Quantity
Data types ….. Decide what type of data will be stored in each field Look at the data on the form that is filled in now
Look at the data types you will need Short Text (alpha, numeric) Numbers, (numbers used for calculations, so NOT phone numbers) Currency 1 2.5% 32.7
There are other data types also …. Autonumber This allows a unique number to be attached to each record You can set the number to increment eg 1, 2, 3, 4 An Autonumber is often used as a Record ID No
Date / Time This allows you to display a date in the format needed eg 1/11/2017 Or display a time in the format needed eg 22:10
Yes/No or logical data type Hyperlink to the Web
Data types ….. Record the data type for each field in your Plan Plan Fieldname ItemNo Item Quantity Price Dept Data type AutoNo ShortText Number Currency
Field size ……. Field size is important if you have a lot of Short text data type fields in your database By default (or automatically) Access sets Short text data type field size at 255 spaces
Why is field size important? If the field size is too big, then it makes the database work slowly when finding records eg looking for Mr Gascoigne-Brown It can increase the file size of the database and therefore waste your storage space eg if you allow 255 spaces for every persons name, and then you find most names are 5 letters you are wasting 250 spaces IN EVERY RECORD. How does that work? If you have 100 people in your database, each has a record, so 100 * 250 spaces = 25,000 extra storage spaces!
Deciding on your field sizes ….. If you already had your data in front of you you could count how many letters were in the longest name eg Gascoigne-Brown BUT generally, you don’t have all the data in front of you, so you need to use an “average” field size For a first name, average about 20 For a last name, average about 30 For an address eg 19 Elliott St, average about 30 For a suburb eg Taradale, average about 20 For a City eg Palmerston North, average about 30
Determine the primary key ….. Decide if there is a fact that cannot be duplicated – this is known as a unique fact - this will be your primary key Add this to your Plan Now it is complete you can start creating your table Plan Data type AutoNo ShortText Number Currency Fieldname ItemNo Item Quantity Price Dept
Now what did I do to complete my plan???
What you did to complete your Plan …. Step one: you determined the purpose of your database Step two: you determined the fields, fieldnames, data types and field sizes Step three: you determined the primary key
I need to read the brief in the workbook now and see if I can complete a plan!!