HPK

Microsoft Access - Create a Table

Microsoft Access - Create a Table

With database management systems, you need to create your tables before you can enter data. Microsoft Access makes creating tables a breeze.
Using our blank database from a previous lesson, we are going to create a table called Individual. This table will have 4 columns: IndivdidualId, FirstName, LastName, and DateCreated.

Design View

"Design View" enables you to create your database tables and specify the columns and their data types etc. The following steps demonstrate how to switch to Design View and create a table.
  1. Ensuring you have your blank database open and you're on the following screen (with the "Tables" tab selected), click "New":
    Creating a database table in Access - step 1
  2. Select "Design View" and click "OK":
    Creating a database table in Access - step 2
  3. Fill out the details in the "Field Name" column and the "Data Type" column. Here, we are creating the column names and specifying the type of data that can be entered into them. Restricting the data type for each column is very important and helps maintain data integrity. For example, it can prevent us from accidentally entering an email address into a field for storing the current date. Other options for each column include restricting the length of data (under "Field Size"), setting a default value (this is used if someone leaves the field blank), specifying whether the data is required, and more. Leave these options with their default value for now.
    Creating a database table in Access - step 3
  4. Click the "Save" icon, enter the table name ("Individual"), and click "OK":
    Creating a database table in Access - step 4
  5. When prompted to set a primary key, click "Yes". (A primary key ensures that the data in this column is unique - no two values can be the same. This is important for when you need to select or reference data from this column):
    Creating a database table in Access - step 5

Datasheet View

You have now created a database table called "Individual". You can now switch between "Design View" and "Datasheet View" as you wish. Datasheet View allows you to see any data that has been entered into the table.
  1. From the "View" dropdown icon, click "Datasheet View" (this changes the view from Design View, to Datasheet View):
    Creating a database table in Access - step 6
  2. You should now see something like this:
    Creating a database table in Access - step 7
We have just created a database table. This table doesn't have any data yet, but we have created the columns that are required before any data is entered.
Bagikan ke Facebook

Artikel Terkait