From Paper to Digital: How Databases Organize Data
Learn the core concepts of database design (tables, records, fields, data types, and relationships) that underlie every digital data management system.
Lesson notes
Read through the key concepts before you try the challenge.
Real-World Scenario
Tables, Records, and Fields
The fundamental building blocks of any database are tables, records, and fields: understanding these three concepts unlocks all the rest of database theory:
- A table is a collection of related data organized in rows and columns, like a spreadsheet, but with strict rules about what data goes in each column. A 'Customers' table contains one entry per customer. An 'Appointments' table contains one entry per appointment. Each table stores one type of entity consistently, and all rows in the table have the same structure.
- A record is one complete entry in a table, one row. In the Customers table, a record is all the information for one customer: their ID, name, phone number, address, and lead source. In the Appointments table, a record is one appointment: the appointment ID, the customer it belongs to, the estimator, the date, and the visit type.
- A field is one piece of information in a record, one column. In the Customers table, fields include: CustomerID, FirstName, LastName, DateOfBirth, Phone, AccountNo. Each field has a name (which tells you what information it holds) and a data type (which tells the database what kind of data is allowed in that field).
- Data types define what kind of data can go in a field: Text (for names and addresses), Number (for IDs and quantities), Date/Time (for dates of birth and appointment dates), Currency (for payment amounts), and Yes/No (for true/false values like 'Is active customer?'). Using the correct data type is critical: storing dates as text makes date calculations impossible. Storing numbers as text prevents arithmetic. Data type decisions made at the table design stage affect everything the database can do.
Primary Keys and Unique Identification
Every table needs a way to uniquely identify each record: this is the role of the primary key:
- A primary key is a field (or combination of fields) whose value is unique for every record in the table: no two records can have the same primary key value, and the primary key field cannot be empty (null). In the Customers table, the CustomerID field serves as the primary key. Even if two customers are named Maria Rodriguez with the same date of birth, their CustomerIDs are different.
- Auto-number (AutoNumber) primary keys are generated automatically by the database: each new record gets the next sequential number (1, 2, 3...) without any user input. This is the most common and reliable approach for primary keys in construction office databases because it completely removes the risk of duplicate or missing key values.
- Natural keys vs. surrogate keys: a natural key uses a real-world identifier that is naturally unique (like a phone number or an email address). A surrogate key is a system-generated identifier with no real-world meaning (like an auto-number CustomerID). In customer databases, auto-number surrogate keys are preferred for primary keys. Phone numbers and emails change, and two people can share them. The surrogate key is stable.
Relationships Between Tables
The real power of a database over a single spreadsheet is the ability to relate tables to each other: answering questions that span multiple data categories:
- A relationship connects records in one table to records in another using a shared field, typically the primary key of one table appearing as a field (called the foreign key) in another table. In the Appointments table, the CustomerID field is a foreign key that refers to the CustomerID primary key in the Customers table. This link means every appointment record knows which customer it belongs to.
- One-to-many is the most common relationship type: one customer can have many appointments, but each appointment belongs to exactly one customer. The 'one' side has the primary key (Customers.CustomerID), and the 'many' side has the foreign key (Appointments.CustomerID). This relationship structure prevents data redundancy: customer contact information is stored once in the Customers table, not repeated in every appointment record.
- Referential integrity is a database rule that enforces valid relationships: it prevents you from creating an appointment record that refers to a customer ID that does not exist in the Customers table, and prevents you from deleting a customer who has existing appointment records. This rule keeps data consistent and prevents 'orphaned' records (appointments with no valid customer).
Responsible Use
AI Assist
Knowledge Check
In a construction office database, the Appointments table has a CustomerID field that refers to the Customers table. What is the CustomerID in the Appointments table called?
Practice simulation
Practice what this lesson taught in a working copy of the app. Tasks appear under the window.
Practice simulation
Tour the customer database
Harborline Builders moved its paper customer charts into Access. Before the front desk starts using it, you check that the Customers table is sorted, keyed, typed correctly, and linked to Appointments the way a well-built database should be.
Loading the simulation...
Challenge
Apply what you've learned in this lesson.
Design a database structure for Harborline Builders on paper before building it in a computer system.
- On paper or in Word, design three tables for Harborline Builders: Customers, Appointments, and Estimators. For each table, list all fields, their data types, and identify the primary key.
- Draw the relationships between the three tables with arrows showing which field connects to which. Label each relationship as 'one-to-many' and note which side is 'one' and which is 'many.'
- Identify one potential data quality problem your design prevents (compared to storing all data in a single spreadsheet) and explain why the relational structure prevents it.
- Write a brief justification (2–3 sentences) for why you chose auto-number vs. natural key for each table's primary key.
Finished this lesson?
Progress is saved in this browser only, so you can pick up where you left off.