preface: data at a veterinary clinic - abu s. arif - mis 107 · web viewvet database: lab manual...

30
Vet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office, or medical building for the treatment of non-human animals. The patients are mostly the pet animals who are very dear to their Owners. That is why it is very important to keep a track of the pet’s information as well as the owner’s information for further assistance. 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 Name of table Customers Field (Primary Key) Customer ID Field Customer’s Name Field Contact no. Field Address Field Occupation Pet Information The pets are the patient. Information about the pets/patients can be kept in another table to reduce redundancies. The basic information about an animal includes type, breed, birthdate, and gender. We will consider creating a separate table with the pet’s information. Name of table Pets Field (Primary Key) Pets ID Field Pet’s Name Field Type Of Animal Field Breed Field Gender Visits/Transaction Keeping a history about previous visits of the pet can provide the clinic with information to improve the service level. We will consider adding a third table that contains with information like the date and time of the visit(s), services rendered, amount paid, and notes. Name of table Visits Field (Primary Key) Visits ID Field Date & Time Vet Database: Lab Manual

Upload: others

Post on 17-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Vet Database: Lab ManualPreface: Data at a Veterinary ClinicA veterinary clinic is a hospital, doctor's office, or medical building for the treatment of non-human animals. The patients are mostly the pet animals who are very dear to their Owners. That is why it is very important to keep a track of the pet’s information as well as the owner’s information for further assistance.

OrganizationOwner/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

Name of table CustomersField (Primary Key) Customer IDField Customer’s NameField Contact no.Field AddressField Occupation

Pet InformationThe pets are the patient. Information about the pets/patients can be kept in another table to reduce redundancies. The basic information about an animal includes type, breed, birthdate, and gender. We will consider creating a separate table with the pet’s information.

Name of table PetsField (Primary Key) Pets IDField Pet’s NameField Type Of AnimalField BreedField Gender

Visits/TransactionKeeping a history about previous visits of the pet can provide the clinic with information to improve the service level. We will consider adding a third table that contains with information like the date and time of the visit(s), services rendered, amount paid, and notes.

Name of table VisitsField (Primary Key) Visits IDField Date & TimeField Service Rendered

The Customer table is used from the prebuilt table of MS Access The Pets Table is created by importing an Excel file containing the information of Pets The Visits Table is created using MS Access

Vet Database: Lab Manual

Page 2: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Tasks to PerformTask 1: Creating a Blank Database

Select Blank Database Type Project Name (example: MyPetProject) Click on Create

Figure: Creating Blank Database

Task 2: Using Customer Table from the Prebuilt Tables in MS AccessThe table is created using Application Parts. A table named “Contacts” is used which is close to what is needed for the Customer Table.( Some minor changes are added for the Table)

Vet Database: Lab Manual

Page 3: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Figure: Selecting Prebuilt Table

Rename the Table To rename the table from “Contacts” to “Customers”, Right- click on the table name (Contacts) and

Select “Rename”. Type new table name that is “Customers” and press Enter twice.

Figure: Using Rename option Figure: Chaning the name and opening the table

Vet Database: Lab Manual

Page 4: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Renaming the field To Change the Field Name Right-click on that name and select “Rename Field” Type the New Field Name as “CustomerID” and press Enter

Figure: Using Rename Field Option Figure: Renaming the Field as CustomerID

Right click on the table to Save and then close the table

Figure: Saving and closing the Customer Table

Vet Database: Lab Manual

Page 5: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Task 3: Importing the Pets Table from Excel to MS Access At first an Excel file is created (named Pets) containing the fields and data.

Fig: Excel file data

On MS Access, go to “External Data” then Select “Excel” from the Import and Link tool box

Fig: External Data Import tool

A new dialogue box will pop-up. Browse the location of the Excel File and click OK.

Vet Database: Lab Manual

Page 6: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Location identification of the Excel file

Another Window will pop-up and check your data if it matches with the Excel file data and click on Next>

Vet Database: Lab Manual

Page 7: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Configuring Pets Table

Check the button to make the first Row as Column Headings and click Next >

Figure : Creating Column Headings

The next window gives an option to change or rename the field and column data. If everything is correct click on Next>

Vet Database: Lab Manual

Page 8: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Figure: Configuring Pets table

The Next window enables to choose primary key. Click on “let Access select the primary key” and click Next>

Fig: Primary Key Selection in Pets Table Change the table name to “Pets” and click on “Finish” and on the next window click “close”.

Vet Database: Lab Manual

Page 9: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: End of Pets Table configuration

Now, to change the field name from the table using “Design View” , Right click on the table “Pets” and Select Design View.

Vet Database: Lab Manual

Page 10: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Changing Field name of the Pets Table

Now change the field name from ID to PetID

Fig: Changing field name

Vet Database: Lab Manual

Page 11: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

The PetID is already Selected as the Primary Key. But it is important to add another field named “CustomerID” as it works as the foreign key of this table. To do so, Right click on the field named “PetName” and select Insert Rows.

Fig: Adding additional field name

Write “CustomerID” on the new Row inserted and select “Number” as the Data Type.

Fig: Selecting Data Type

Then Close and Save the table as shown earlier.

Task 3: creating table on MS Access using Table DesignGo to “Create” from the menu bar and Select “Table Design”. A blank table will be created.

Vet Database: Lab Manual

Page 12: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Creating the 3rd table

Fill up the Field and Data Type as shown below.

Fig : Table information

To make VisitID as the Primary key, select the VisitID and click on the Primary Key button.

A key sign will be shown on the left side of VisitID

Vet Database: Lab Manual

Page 13: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Selecting Primary Key

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.

Fig: Change in Table 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).

Vet Database: Lab Manual

Page 14: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Primary Key and Foreign Key

Task 4: Building Relationship between Primary Key and Foreign Key

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.

Fig: Configuring Relationships

Vet Database: Lab Manual

Page 15: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Relationships

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.

Vet Database: Lab Manual

Page 16: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Information of 3 tables created in the Relationships tool

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.

Fig: Relationship of Foreign Key configuration

Vet Database: Lab Manual

Page 17: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: First Foreign Key configuration shown using relationships

Now repeat the same procedure to connect the foreign key PetID with the Primary key PetID.

Fig: Final view after configuring Relationships

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.

Task 5: Field Properties

To prevent Data entry error we can use the “back door” into code.

Right click on the Visits and choose Design View.

Vet Database: Lab Manual

Page 18: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Design view

Now you can add default value,caption and decimal places in the table which will appear in the form.

Fig: Configuring Table

Save and close the table and open Pets Table by right clicking and selecting Design view as well.

Vet Database: Lab Manual

Page 19: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Now select the TypeOfAnimal field and select “Lookup Wizard” to add type of animals.

Fig: Lookup Wizard

Select the Option “I will type in the values I want” to add the animal types manually and click on next.

Fig: Lookup Wizard configuration Now fill in the column by typing different names. Don’t use the Enter button to go to the next

row, press tab to write name on the next row. Click on next when you are done writing on the column.

Vet Database: Lab Manual

Page 20: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Lookup Wizard Configuration

If you don’t have anything to edit like the table name then click on finish.

Fig: Lookup Wizard Configuration

Save and close the Pets table. Deleting Field

Right click on the field you want to delete and click on “delete fied”

Vet Database: Lab Manual

Page 21: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Deleting Field

Task 6: Creating AForm

To create a form, select the Customer Table then go to Create Tab and Select Form and it will create a form.

Figure: Form tool

If you don’t have anything to change in the form then right click on the form name and save it.

Vet Database: Lab Manual

Page 22: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Creating Form

Adding Information of Customers and Pets in Database

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.

Vet Database: Lab Manual

Page 23: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Filling up Form

Now Add some more Customers from the following table to get a clear idea about a Database

Customers Table Pets Table Visits Table1. First Name: Mark

Last Name: RobinsonContact# +123456City: LondonCountry : UK

Name: SnoopyTypeOfAnimal: DogBreed: MixedDateOfBirth: 06/04/2011Gender: M

Visit Date: 02/01/2014Total Amount: 30Invoiced: yes

2. First Name: KhodezaLast Name: BegumContact# +143011City: LondonCountry : UK

Name: BilluTypeOfAnimal: CatBreed: PersianDateOfBirth: 10/12/2013Gender: F

Visit Date: 03/01/2014Total Amount: 30Invoiced: yes

Vet Database: Lab Manual

Page 24: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

3. First Name: KimLast Name: BrownContact# +000111City: LondonCountry : UK

Name: TommyTypeOfAnimal: DogBreed: MixedDateOfBirth: 04/09/2011Gender: M

Visit Date: 03/01/2014Total Amount: 30Invoiced: yes

4. First Name: BruceLast Name: MorkContact# +000111City: LondonCountry : UK

Name: SammyTypeOfAnimal: DogBreed: MixedDateOfBirth: 24/09/2010Gender: M

Visit Date: 03/01/2014Total Amount: 30Invoiced: yes

5. First Name: LauraLast Name: BrownContact# +000222City: LondonCountry : UK

Name: DinkyTypeOfAnimal: CatBreed: MixedDateOfBirth: 05/10/2008Gender: F

Visit Date: 04/01/2014Total Amount: 30Invoiced: yes

6. First Name: FarhanaLast Name: HaqueContact# +000333City: LondonCountry : UK

Name: ScoobyTypeOfAnimal: DogBreed: MixedDateOfBirth: 04/09/2010Gender: M

Visit Date: 04/01/2014Total Amount: 30Invoiced: yes

7. First Name: KimLast Name: BrownContact# +000111City: LondonCountry : UK

Name: ChappyacTypeOfAnimal: DogBreed: MixedDateOfBirth: 04/09/2010Gender: M

Visit Date: 03/01/2014Total Amount: 30Invoiced: yes

8. First Name: SalamLast Name: AlamContact#+000555City: LondonCountry: Uk

Name: CruzerTypeofAnimal: DogBreed: MixedDateOfBirth: 23/12/2009Gender: M

Visit Date: 04/01/2014Total Amount: 30Invoiced: yes

9. First Name: JackLast Name: CruzeContact#+000666City: LondonCountry: Uk

Name: SamTypeofAnimal: DogBreed: MixedDateOfBirth: 12/12/2012Gender: M

Visit Date: 04/01/2014Total Amount: 30Invoiced: yes

10. First Name: MaryLast Name: KomContact#+000777City: LondonCountry: Uk

Name: TonyTypeofAnimal: DogBreed: MixedDateOfBirth: 11/11/2011Gender: M

Visit Date: 04/01/2014Total Amount: 30Invoiced: yes

Task 7: Query Design

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.

Click on Query Wizard

Vet Database: Lab Manual

Page 25: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Query Wizard tool

A new window will pop up. Select Simple Query Wizard Click Ok

Fig: Type of Query Wizard Selection

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.

Vet Database: Lab Manual

Page 26: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Query for Pets Table

To select field name, select the field name and click on the arrow sign, press next and proceed

Fig: Selection of Fields for the Query

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.

Vet Database: Lab Manual

Page 27: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Query Wizard Configuration

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

Vet Database: Lab Manual

Page 28: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Query configuration

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.

Vet Database: Lab Manual

Page 29: Preface: Data at a Veterinary Clinic - Abu S. Arif - MIS 107 · Web viewVet Database: Lab Manual Preface: Data at a Veterinary Clinic A veterinary clinic is a hospital, doctor's office,

Fig: Adding Criteria

You will be now able to see the list of the dogs in the created database

Fig: Query

Vet Database: Lab Manual