Designing tables and relationships

Study Part 3 · Topic 2 of 5

Choose the right data types, set a primary key and link tables together.

35 minInteractiveMicrosoft Access
0 activities complete
Data types

Every field has a data type

The data type decides what can be stored in a field and what you can do with it. A phone number is Short Text, not a Number, because you never add phone numbers together and they start with 0.

Choose the best data type

Choose the right group for each item. 8 left to sort

Learner’s surname
Cell phone number
Number of dependants
Date of birth
Course fee
Postal code
Hours attended
Has paid? (tick box)

Access fills in a unique number for each new record. Ideal for a primary key like MemberID.

For notes and comments longer than 255 characters.

Shows a drop-down list (for example the nine provinces) so users can’t misspell entries.

Stores files such as a photo or certified ID copy with the record. Use sparingly: it makes the database large.

Create a table in Design View
1

Create the table

Create > Table Design.

2

Add fields

Type each field name (no spaces, e.g. FirstName) and choose its data type.

3

Set field properties

In the lower pane set Field Size, Format, Required and Default Value.

4

Set the primary key

Select the ID field and click Primary Key ().

5

Save

Save the table with a clear name such as Members, then switch to Datasheet View to enter records.

Relationships

Linking tables

Explore the relationships
Explored 0 of 5
PK MemberID
FirstName
LastName
Province
Phone
Members
PK EnrolmentID
MemberID
CourseID
StartDate
Result
Enrolments
PK CourseID
CourseName
Hours
Fee
Courses
1
∞
∞
1
A member can have many enrolments; a course can have many enrolments.
Tap a numbered pin to learn what that part does.
Knowledge check

Why should a phone number be stored as Short Text and not Number?

Knowledge check

A field in one table that refers to the primary key in another table is a…

Key takeaways

  • Choose data types by what the data is and how it is used.
  • Every table needs a primary key.
  • One-to-many relationships link tables and avoid repeated data.