Let’s say we have a very simple database. It’s a company that has users of rented machinery that occasional need servicing. To perform the service first an appointment is set and assigned to a tech.
In this simple database we have 3 tables – Customer Table, Tech Table, and Appointment Table.
Example Database |
---|
Table Name |
exmCustomer |
exmTech |
exmAppointment |
Appointment Table | |
---|---|
Field Name | Data Type |
ApptID | AutoNumber |
ApptCustID | Integer |
ApptTechID | Integer |
ApptDateTime | Date/Time |
Tech Table | |
---|---|
Field Name | Data Type |
TechID | AutoNumber |
TechName | Text |
TechPhone | Text |
Customer Table | |
---|---|
Field Name | Data Type |
CustID | AutoNumber |
CustName | Text |
CustPhone | Text |
To keep it simple the only data we are tracking are the customer name and phone, the tech name and phone, and the appointment date and time.
The rest of the data are IDs to match up the records relationally. Each row has a unique integer ID called the primary key assigned to it by the database when the record is created. You are guaranteed not to have duplicate record primary key IDs. The appointment table instead of including the customer and tech names and phones directly in the fields refers to customer and tech records through their primary key ID that was assigned to them in their respective tables. This is the meaning of a relational database.
You can see the relationships in the graphic to the right. These are called one-to-many relationship. There are other kinds of relationships.