Page 42 - AIS access_chang_ingraham
P. 42
40 CHAPTER 3 USING ACCESS TO IMPLEMENT A RELATIONAL DATABASE
2. Create the Customer Table for Cherokee.
In Chapter 2, based on the REA diagram, we created the conceptual model of a data-
base for Cherokee. The table structures are as follows:
Inventory Table (Item #, Inventory Description, Inventory Cost, Purchase #, Sale #)
Cash Table (Account #, Account Type, Balance)
Sale Table (Sale #, Sale Date, Sale Amount, Payment Type, Customer ill, Account #)
Purchase Table (Purchase #, Purchase Date, Purchase Amount, Artist ill)
Cash Disbursement Table (Check #, Disbursement Date, Payment Amount,
Artist ID, Account #)
Artist Table (Artist ill, Artist Name, Artist Address, Artist City,
Artist State,
Artist ZIP Code, Artist Phone #, Artist Email)
Customer Table (Customer ill, Customer Name, Customer Address,
Customer City,
Customer State, Customer ZIP Code, Customer Phone #,
Customer Email)
Purchase-Cash Disbursement Table (Purchase #, Check #)
Check the table structure of the Customer Table. It has the following attributes: ill,
Name, Address, City, State, ZIP Code, phone #, and Email. Type CustomerID as the first
attribute in the Field Name column. When creating a table, it is very important that you check
your work. Before you tab out of the Field Name, make it a habit to check your spelling. Field
Names are created when you establish table structures. Everything you do in a database is
written in the data dictionary. Therefore, a database can increase in size very quickly. On the
practical side, this can create storage problems. However, let's assume that this isn't a prob-
lem and you create a Field Name that you later realize you want to change. You can then go
back and change it but you may want to make sure that it is identical to every other instance
in which it appears (i.e., every other table in which you may have used it as a foreign key).
3. Once you have checked your field name, press enter or the Tab key. Make
CustomerID the primary key by clicking the Primary Key' toolbar button.
As we discussed earlier, a primary key is an attribute that uniquely identifies each
record. By defining a primary key, Access does three things:
• It automatically insures that no two records in that table will have the same
value in the primary key field.
• It keeps records sorted according to the primary key field.
• It speeds up processing.
4. We will set its data type to Text assuming that Cherokee uses a combination of
letters and numbers to identify their customers. A data type of Text can store data consist-
ing of either text or number characters. If you hit the Save button, you will get a pop
up window asking for the table name. Type in Customer Table.

