Date post: | 30-Dec-2015 |
Category: |
Documents |
Upload: | libby-goff |
View: | 40 times |
Download: | 2 times |
HSC IT Center Training
University of Florida
Creating a Simple Database with Microsoft Access 2007
Health Science Center
IT Center – Training
352-273-5051
HSC IT Center Training
University of Florida
Basic Database Concepts
Table– A set of related records
Name: Barry HarrisCollege: MedicineTel: 392-5555
Name: Barry HarrisCollege: MedicineTel: 392-5555
Name: Barry Harris
Field
Record– A collection of data
about an individual item
– A single item of data common to all records
HSC IT Center Training
University of Florida
An Example of a Table
Records
Fields
Name GatorLink Phone College
Graff rgraff 392-3900 Pharmacy
Harris bharris 392-5555 Medicine
Ipswich zipswich 846-5656 PHHP
HSC IT Center Training
University of Florida
Basic Design Rules Data is broken down into Smallest Logical Parts
PT ID # Home Address
987 123 West Main Street, Gainesville, FL 32601
654 456 South 3rd Road, Apt 12, Newberry, FL 32684
321 846 West Newberry Road, Gainesville, FL 32609
Putting all of the home address in one field may make for convenient data entry, but it makes it very difficult to work with the data. For example, what if I needed to sort by City or Zip Code? Pulling fields together is fairly simple, pulling them apart is very difficult.
You can join fields together in queries, forms and reports.
HSC IT Center Training
University of Florida
Basic Design Rules Unique Field Names
PATIENT TABLE
First Name Last Name
Annie Adams
April Appleton
Arnold Arlington
Bobbie Brown
Butch Bruce
You also want to be aware of the field names across tables. For example several tables may use the Field LastName. When you use those fields in other parts of the database things can become very confusing very quickly. DOCTOR TABLE
First Name Last Name
Sallye Shapiro
Samuel Smith
Sidney Samueson
When these two Last Name fields are pulled into the same Query/Form/Report they will appear with the table name in front of the field name: Patient Table.Last Name
HSC IT Center Training
University of Florida
Basic Design Rules No Calculated or Derived Fields
EmployeeID Num
HourlyRate
StandardHours
StandardPay
Dept IDNum
Dept Name
123 $10.00 40 $390.00 12 Editing
789 $10.00 20 $200.00 12 Edit
Calculations - If we give an employee a raise, we will need to change both the Hourly Rate and the Standard Pay, and we need to make sure our calculations are correct.
Derivations - Since we have the Dept ID, there is no need to include the Dept Name, it can be pulled from the Dept Table. Listing it in both places leads to data entry errors.
Access will let you create calculations in queries, forms and reports.
HSC IT Center Training
University of Florida
Basic Design Rules Unique Records
LastName GatorLink Phone College
Smith rsmith 3-5051 Pharmacy
Smith rsmith 273-5051 COP
Smith rsmith 273-5051 Pharmacy
Thomas bthomas 392-5555 Medicine
Van Winkle sleepyguy 846-5656 PHHP
If you don’t have unique records, your database can’t tell which record you may be referring to.
LastName EmergencyContact
Smith Mary Anne Smith
HSC IT Center Training
University of Florida
Primary KeysLastName GatorLink Phone College
Smith rsmith 273-5051 Pharmacy
Thomas bthomas 392-5555 Medicine
Van Winkle sleepyguy 846-5656 PHHP
To ensure that each record is unique in each table, we can set one field to be a Primary Key field.
A Primary Key is a field that that will contain no duplicates and no blank values.
Looking at the table above, what would be the best Primary Key?
HSC IT Center Training
University of Florida
Primary KeysLastName GL ID Phone College
Smith rsmith 273-5051 Pharmacy
Thomas Bthomas 392-5555 Medicine
Van Winkle sleepyguy 846-5656 PHHP
While each column in this particular data set has unique data, the field that will work best for us is GL ID (GatorLink). Many employees will work for the same college, have the same last name and possibly even share telephone numbers, but each employee should have a unique GatorLink ID.
When there is not a unique field in your data set, you can use an AutoNumber. Access can create incremented or random AutoNumbers for your primary key.
HSC IT Center Training
University of Florida
Basic Design Rules Unique Records
ID LastName GatorLink Phone College
1 Smith rsmith 3-5051 Pharmacy
2 Smith rsmith 273-5051 COP
3 Smith rsmith 273-5051 Pharmacy
4 Thomas bthomas 392-5555 Medicine
5 Van Winkle sleepyguy 846-5656 PHHP
We use the unique primary key as our link between our tables, this helps ensure we connect to the correct record.
Emp ID EmergencyContact
2 Mary Anne Smith
HSC IT Center Training
University of Florida
Name
Address
Phone
Age
Medical Record #
Emergency Contact
Height
Weight
Date of Last Visit
DOB
Medications
SSN
Insurance
Allergies
Gender
Age at First Visit
…
Planning our Patient TableWhat have I got?
HSC IT Center Training
University of Florida
Planning our Patient TableDoes the data belong in this table?
HSC IT Center Training
University of Florida
Date of Last Visit
DOB
SSN
Gender
Age at First Visit
Planning our Patient TableSmallest Logical Parts
HSC IT Center Training
University of Florida
Planning our Patient TableUnique Field Names
HSC IT Center Training
University of Florida
Planning our Patient TableNo Calculated or Derived Fields
HSC IT Center Training
University of Florida
Planning our Patient TablePrimary Key
HSC IT Center Training
University of Florida
Planning our Patient TableFinal Plan
HSC IT Center Training
University of Florida
Let’s Build our Database!