Working with databases/Create a database/Table design
Working with databases | |
---|---|
Create a database | Introduction | Table design | Data types | Field properties | Primary keys | Adding information | Records and tables | Key points | Assessment |
Creating a Database
Now we’re going to have a look at creating a database with a single table.
As we have seen, a database contains a number of objects like a table and a query. In order to make it easy for other people to see what is inside your database, you should consider using a prefix in front of the name to distinguish between objects in the database.
For example, in order to distinguish between the table called Customers and a query called Customers we could type:
- TBL_Customers QRY_Customers
Wherever possible try to avoid using spaces in the names of objects in the database and make the name easy to read. For example, if you want to run several words together there are several options:
- current_student_information
- Easy to read because the underscore character separates and spaces the words.
Or...
- CurrentStudentInformation
- Capitalise each new word. This is called camel case.
But not...
- currentstudentinformation
- Too hard to read
Please note: the following tutorial will open in a new window/tab. When you have finished the tutorial, simply close the window/tab and you'll return to this page. Before you go on, please work through the following tutorial:
|
Table design view
The central panel in design view is where you set out the fields to be used in your table. We are going to use this view to enter the facts that we have gathered, and turn them into fields in our table.
This panel is divided up into 4 main areas:
- Field name
- The name of the field. This will appear at the top of the column in the table view. Make sure you use a name that is meaningful and descriptive.
- Data Type
- This will become important to us in a little while. We need to tell the computer what sort of information is being stored. Is it text? A number? A date? Currency, etc.
- Description
- This helps you as the designer of the database, and anyone who might come along after you. Use this section to describe what the field is for.
- Field Properties
- Here we can further fine tune the qualities of the field.
First things first! Let’s enter in fields for our bookshop database.
|