| DataBases and Access |
|
Objectives |
| Discussion |
DataBases
Example of database with one table

Example of database with two tables

This Course Introduces Database
| Demonstration |
In this demo we will create a simple database in MS Access. We will use this database for the rest of this unit. Please keep in mind that we are just providing a very simple introduction to databases. If you are going to create applications that require a database you may need to spend considerable time designing the database. Database design is a course all by itself. Also, although we will be using an MS Access database, the concepts apply to all types of databases.
1. Open Microsoft Access. Select File...New...Blank Database.
2. Name your database "Contacts". Now we are going to add a table. Select Create Table in Design View. Then add the fields so that your table looks like:

3. Now we will make a primary key. A primary key is the field that uniquely identifies a record. Most tables will have a primary key. We will make the ID field the primary key. To create a primary key, select a field by clicking next to it. Then click on the "key" icon in the toolbar. Make the ID field the primary key.
4. Save your table. Give it the name "Contacts" and close the table. Now you should have a window that looks like:

5. Select the Contacts table and Open it using the Open button in the toolbar. Add a few new records. Notice that each record must have a different ID since the ID is the primary key. You will use this database later in this unit.
| Exercises |
1. What is a primary key?
2. Add a few records to your Contacts database. Try to give the same ID to more than one record. Then try to create records with all fields except the ID the same as another record. Explain what is happening.
3. Create a new database to keep track of your grades for all of your classes. Your database should keep track of the following information: class, assignment, possible score, actual score, date, type
4. In the Discussion above an example of a database with two tables was provided. Create this database in Access.
5. What is "Normalization"? Look it up in Help.
| Links & Help |