Creating Tables and Database

Lesson 2: Creating Microsoft Access Tables

Tables are the foundation of an Access database. Access stores data in tables. This lesson teaches you how to create a table, add fields to a table, assign data types to fields, and set field properties.

Understanding Tables

A table is a set of columns and rows. Each column is called a field. Within a table, each field must be given a name and no two fields can have the same name. Each value in a field represents a single category of data. For example, a table might have three fields: Last Name, First Name, and Phone Number. The table consists of three columns: one for last name, one for first name, and one for phone number. In every row of the table, the Last Name field contains the last name, the First Name field contains the first name, and the Phone Number field contains the phone number. Each row in a table is called a record.
Table

You can view an Access database as a collection of related tables. For example, in a database that contains tables for Employees, Students, and Courses, the Employees table lists the employees, the Students table lists students, and the Courses table lists the courses students can take.All of the data in a table should refer to the same subject. For example, all of the data in the Employees table should refer to employees, all of the data in the Students table should refer to students, and all of the data in the Courses table should refer to courses.
After Access creates a blank database, it opens in Datasheet view and makes available the tools you need to create a table. Datasheet view displays a table as a set of columns and rows. When you view a blank database for the first time in Datasheet view, you see a column named ID. This column is by default the primary key field.
primary key is a field or combination of fields that uniquely identify each record in a table. No two records in a table should have the same values in every field. For example, the following should not occur in a table.
Last NameFirst NameCity
SmithJohnJonestown
SmithJohnJonestown
In the real world, it is possible to have two people from the same city with the same first and last name. In cases like this, you can use the ID field as the primary key field and use it to make each record unique. The ID field has a data type of AutoNumber; as a result, Access automatically creates a unique number for each record in the database. The resulting table will look like the one shown here.
IDLast NameFirst NameCity
1SmithJohnJonestown
2SmithJohnJonestown
Access provides several methods for creating a table. One method is to use the Rename option with the Add New Field column label to give each column the field name you want it to have and then to type or paste your data into the table. Field names can include letters, numbers, and spaces and can be up to 64 characters long. When choosing a field name, try to keep it short.
When you save your table for the first time, Access gives you the opportunity to name your table. Each table name must be unique; hence, two tables in the same database cannot have the same name. The table name should describe the data in the table; can consist of letters, numbers, and spaces; and can be up to 64 characters long. When choosing a table name, try to keep it short.
You can save a table by clicking the Save button on the Quick Access toolbar or by right-clicking the Tables tab and then choosing Save from the menu that appears.

To add fields to a table:

Rename Field
  1. Click the Add New Field column label.
  2. Activate the Datasheet tab.
  3. Click Rename in the Fields & Columns group.
  4. Type the field name.
  5. Press Enter. Access creates the field.
  6. Type the next field name. Access creates the field. Continue until you have created all of the fields in your table.
  7. Press Enter without entering a field name to end your entries.
Or
  1. Right-click the Add New Field column label. A menu appears.
  2. Click Rename Column.
  3. Type the field name.
  4. Press Enter. Access creates the field.
  5. Type the next field name. Access creates the field. Continue until you have created all of the fields in your table.

Name and Save a Table

After you create a table, you must name and save it.

To name and save a table:

Name and Save Table
  1. Click the Save button on the Quick Access toolbar. The Save As dialog box appears.
  2. Type the name you want to give your table.
  3. Click OK. Access names your table.