IEW:
Independent Project 2-5
Life’s Animal Shelter wants to expand the database created in the Independent Project 1-5 . To ensure consistency, the starting file is provided for you. In this project, you use Design view to create a second table, edit field properties, integrate data integrity rules, and enter data. You also create a relationship between the two tables and enforce referential integrity constraints. Finally, you add data using the relationship between tables.
[Student Learning Outcomes 2.1, 2.2, 2.3, 2.4, 2.6]
File Needed: LifesAnimalShelter-02.accdb (Available from the Start File link.)
Completed Project File Name: [First Name.Last Name]-LifesAnimalShelter-02.accdb
Skills Covered in This Project
Create a table using Design view.
Add fields into a table.
Edit field properties in Design view.
Create an input mask.
Create a validation rule and validation text.
Save a table.
Enter records.
Create a foreign key.
Create a 1:M relationship between tables.
Enforce referential integrity.
View a table in Datasheet view and expand related records.
Open the LifesAnimalShelter-02 database file.
The file will be renamed automatically to include your name. Change the project file name if directed to do so by your instructor, and save it.
Enable content in the security warning.
Create a new table using Table Design .
Add the fields in Table 2-29 into the table and set field properties.
Table 2-29
Field Name
Data Type
Description
Field Size
OwnerID
Short Text
Unique owner ID
4
OwnerLastName
Short Text
Last name
20
OwnerFirstName
Short Text
First name
20
Address
Short Text
Street address
40
City
Short Text
20
State
Short Text
2
ZIP
Short Text
ZIP Code
5
Phone
Short Text
Contact phone number
10
Set OwnerID as the primary key.
Select the State field and type TX in the Default Value .
Save the table as Owners .
Create an input mask for the Phone field.
Select the Phone field.
Use the Phone Number Input Mask .
Don’t make any changes to the mask or placeholder character and select the Without the symbols in the mask, like this radio button.
Finish the Input Mask Wizard .
Save the table.
Create and test a field validation rule.
Select the OwnerID field.
Type Like "#### “ in the Validation Rule .
Type You must enter a 4-digit Owner I D as Validation Text .
Save the table and switch to Datasheet view.
Test the rule by typing 11 in the first row of the OwnerID column.
Move to the OwnerLastName field. The message box should display the validation text message (Figure 2-92) since the OwnerID is not four digits long.
Figure 2-92 Field validation rule error message
Click OK to acknowledge the error.
Delete the contents and type 1111 into the OwnerID field.
Verify that you successfully move to the OwnerLastName field since 1111 meets the validation rule criteria.
Delete this test data record.
Enter the records in Table 2-30 into the Owners table. Life’s Animal Shelter doesn’t have any data about the owners stored electronically so you are unable to import any data. Since the State field has a default value of TX, you can simply accept that value and tab to the next field.
Table 2-30
OwnerID
OwnerLast Name
OwnerFirst Name
Address
City
State
ZIP
Phone
0100
Smith
Albert
11 Lakewood Drive
Abilene
TX
79601
325-614-9333
0101
Weston
Mark
2601 Nonesuch Road
Abilene
TX
79606
325-555-1112
0102
Rivera
Angela
2548 Laney Road
Denton
TX
76208
940-321-8020
0103
Moyer
Silvia
6867 Anglebluff Circle
Dallas
TX
75248
972-380-6188
0104
Wills
Mason
2421 Klondike Drive
Dallas
TX
75228
214-224-5555
Save and close the table.
Determine the foreign key field. Currently, a field is not common across the Owners and Pets tables. A one-to-many relationship exists between the two tables since an owner could adopt many pets, but each pet is only adopted by one owner. The foreign key comes by taking the primary key field from the 1 table and adding it in as an additional field in the M table.
Open the Pets table in Design view.
Add the foreign key field below the Details field using the information in Table 2-31.
Table 2-31
Field Name
Data Type
Description
Field Size
FKOwnerID
Short Text
Must match an OwnerID in the Owners table
4
Save and close the Pets table.
Create a one-to-many relationship between the Owners and Pets tables.
Open the Relationships window and add the two tables.
Enlarge the table objects, if needed, to see all of the fields.
Drag the OwnerID field from the Owners table on top of the FKOwnerID field in the Pets table. Release the pointer. The Edit Relationships dialog box displays.
Select the choices to Enforce Referential Integrity and Cascade Update Related Fields.
Leave the Cascade Delete Related Records check box not selected. The shelter does not want to delete pet records when it deletes information about an owner.
Create the relationship.
Save the changes and close the Relationships window.
Enter the following data into the specified records in the Pets table to reflect which pets have been adopted:
Open the Pets table in Datasheet view.
Type 0100 in the FKOwnerID field for PetID 1.
Type 0103 in the FKOwnerID field for PetID 3 .
Type 0100 in the FKOwnerID field for PetID 12.
Type 0104 in the FKOwnerID field for PetID 14.
Close the Pets table.
View the related data records in the Owners table.
Open the Owners table in Datasheet view.
Click the plus sign to the left of the OwnerID field for Albert Smith, OwnerID 0100. You should see the two pets adopted by Albert.
Close the Owners table.
Close the database.
Upload and save your project file.
Submit project for grading.
please answers these questions below
List the reasons a company like Zillow would need to use a database to run its business and do you think the business could be run without a database?
Please make sure your response is detailed and written in complete sentences with correct spelling and grammar. Looking forward to reading your responses. Please make sure your response references concepts in the chapter.
On next Monday you will be assigned a classmate’s answer to respond to. It will be due next week.