Professional Documents
Culture Documents
Vet Database: Lab Manual: Preface: Data at A Veterinary Clinic
Vet Database: Lab Manual: Preface: Data at A Veterinary Clinic
Organization
Owner/Customer Information
The owner of a pet is the customer of the Vet. Clinic. The owner bears the responsibility of a pet, therefore, owner
details is of great importance like his/her name, occupation, phone number, and related information. We might
consider to have the owners’ information in a separate table to reduce redundancies.
A table is a set of columns and rows. Each column is called a field. The fields included in the above mentioned tables
are given below
Figure: Using Rename option Figure: Chaning the name and opening the table
Figure: Using Rename Field Option Figure: Renaming the Field as CustomerID
Right click on the table to Save and then close the table
On MS Access, go to “External Data” then Select “Excel” from the Import and Link tool box
A new dialogue box will pop-up. Browse the location of the Excel File and click OK.
Another Window will pop-up and check your data if it matches with the Excel file data and click on
Next>
Check the button to make the first Row as Column Headings and click Next >
The next window gives an option to change or rename the field and column data. If everything is
correct click on Next>
The Next window enables to choose primary key. Click on “let Access select the primary key” and
click Next>
Now, to change the field name from the table using “Design View” , Right click on the table “Pets” and
Select Design View.
Write “CustomerID” on the new Row inserted and select “Number” as the Data Type.
To make VisitID as the Primary key, select the VisitID and click on the Primary Key button.
Then to Save the table right click on the Table1 and click save. Change the name of the table to Visits.
Close the table after changing the name.
Now we Have 3 Tables and 3 Primary Keys (CustomerID,PetID and VisitsID) and 2 Foreign Keys.
You can identify the foreign keys by the field names. (They have an ID and named after a Table).
To link the Foreign Keys with the primary Keys, Relationship tool is used.
Go to Database Tools and select Relationships and a table will pop up.
Now to select the 3 tables (Customers, Pets & Visits) highlight them all by using the (click and hold)
Shift Keyand click on the 2nd and 3rd tables (Pets & Visits) and click Add.The Relationships Table now
will show 3 tables.
Now click the primary key CustomerID (from the 1st table) and drag it to the foreign key named
CustomerID on the Pets table. Then the Edit Relationship Window opens.
Check (tick mark) the Enforce Referential Integrity box and click on Create.
Now repeat the same procedure to connect the foreign key PetID with the Primary key PetID.
Access reads relationships from one to many. To add a new pet, first add a customer. To add a visit, first you
need to add a customer then add a pet and then you can fill the visit table.
Now you can add default value,caption and decimal places in the table which will appear in the form.
Save and close the table and open Pets Table by right clicking and selecting Design view as well.
Select the Option “I will type in the values I want” to add the animal types manually and click on
next.
If you don’t have anything to edit like the table name then click on finish.
To create a form, select the Customer Table then go to Create Tab and Select Form and it will
create a form.
If you don’t have anything to change in the form then right click on the form name and save it.
At first the form named Customer is filled up with a new customer name and other information.
If you scroll down the Pet table is found.
Then the Pet table is filled up and on the top left corner of the pet table there is a plus sign (“+”)
which is linked to the Visits table.
Now Add some more Customers from the following table to get a clear idea about a Database
It is always difficult to fetch information from a complex and large database. Query Wizard tool helps to
fetch information in a much easier way.
A new window will pop up. Select Simple Query Wizard Click Ok
Select the Table Name and the Field Names you want in your Query. For Example, if you want to
find number of dogs, you must add the field named “TypeOfTable”.Here three fields are
selected, CustomerID, PetName and TypeOfAnimal.
To select field name, select the field name and click on the arrow sign, press next and proceed
Give a suitable query name and select the option “Modify the query design” . Click on Finish and
the design view of the Query will be shown.
If you click on the View tab it will show you the result of your query. You can go back to your
design view by clicking on it again
Query basically means the question you want to ask to find a particular set of information.
Here the query is designed to find the list of dogs as patients in this clinic.
You will be now able to see the list of the dogs in the created database
Fig: Query