Вы находитесь на странице: 1из 3

Biostatistics

Practical Session DB1

Biostatistics Practical Session DB1 WARNING REMEMBER TO SAVE YOUR WORK! You must deliver it at the

WARNING

REMEMBER TO SAVE YOUR WORK! You must deliver it at the end of Practical Session DB3

Section: 1

Section : 1

Goal:

Creation of a new database and design new tables.

1. First, you have to create a new database. Call it Practice1.mdb

2. Next, create a new table to fill the patients information. Call the table PATIENTS. It must include this fields:

Field Name

Data type

Size

Title

Others

HISTORYNUMBER

Number

Long Integer

   

NAME

Text

40

Surname and Name

Required

ADDRESS

Text

50

Street, number and floor/door

 

CITY

Text

25

   

PHONE

Text

11

   

POSTAL CODE

TEXT

5

   

BORNDATE

Date/Time

 

Day, Month and Year

 

SEX

Text

 

Use lookup wizard & limit to list

 

AMOUNTDUE

Currency

     

You have to assign as primary key the field HISTORYNUMBER.

3. Create a NEW TABLE to record the doctor’s info. Call it DOCTORS. It has to include this fields:

Nombre del campo

Tipo de datos

Tamaño

Titulo

Otras

LICENSENUMBER

Number

Long Integer

   

NAME

Text

30

Surname and Name

Required

SPECIALITY

Text

30

   

You have to assign the field LICENSENUMBER as primary key.

4. Create a NEW TABLE to record CONSULTATION information. Call it CONSULTATIONS. It will consist of these fields:

Nombre del campo

Tipo de datos

Tamaño

Otras

CONSULTATIONNUMBER

Number

Long Integer

 

HISTORYNUMBER

Number

Long Integer

 

LICENSENUMBER

Number

Long Integer

 

DATE

Time/Date

 

Validation: Lower or equal to now()

DIAGNOSTIC

Text

   

MEDICATION

Memo

   

SUBTOTAL

Currency

 

Consultation Amount

BILLED

Yes/No

   

AMOUNTPAID

Currency

 

Amount paid

Biostatistics

Practical Session DB1

CONSULTATIONNUMBER will be the primary key.

Session DB1 CONSULTATIONNUMBER will be the primary key . Section : 2 Goal: Practice using data

Section: 2

Section : 2

Goal:

Practice using data sheets

1. Open the PATIENTS table and fill in 10 records. At least two patients must come from Valencia. Close the table when you are done.

2. Open the DOCTORS table and fill in 10 records.

3. Using the PATIENTS table, try to do this:

a. RESIZE the columns to the size of its contents. (RIGHT BUTTON

COLUMN WIDTH)

b. ORDER by name all the records from column NAME. (RECORDS

SORT or RIGHT BUTTON)

Notice the order effect on the other columns. Try the same with

the other columns.

c. Ask Access to SEARCH a random datum in the table. (edit find) E.g.: try to find a patient from VALENCIA or a patient whose phone number starts with “321” (if there’s any).

d. Create and apply a SELECTION FILTER that:

• Shows only the MALE patients. • Shows only patients from VALENCIA.

e. MOVE the column PHONE to the left of column NAME. Try to move other columns.

f. HIDE columns AMOUNTDUE and SEX. Show them again. Try the same using other columns.

g. FREEZE the column HISTORYNUMBER. Try to move other columns to the left of it. Unfreeze this column.

h. Try to create a NEW RECORD and use a HISTORYNUMBER that already EXISTS at the table. Look at the event when you try it. (the system locks the change because you cannot have to equal values in a column that is a table’s primary key)

Section: 3

Section : 3

Goal:

Stablish relationts among tables and practice with referential integrity.

1. From ACCESS main window find RELATIONSHIPS at the TOOLS.

2. Add the three tables to create relationships among them.

3. Create these relations among the tables:

All relations will be created ENFORCING REFERENTIAL INTEGRITY, with CASCADE UPDATES AND DELETIONS.

tables: All relations will be created ENFORCING REFERENTIAL INTEGRITY , with CASCADE UPDATES AND DELETIONS .

Dentistry

2

Biostatistics

Practical Session DB1

Biostatistics Practical Session DB1 Create a relationship between PATIENTS  HISTORYNUMBER and CONSULTATIONS 

Create a relationship between PATIENTS HISTORYNUMBER and CONSULTATIONS HISTORYNUMBER.

b. Create another relationship between DOCTORS LICENSENUMBER and CONSULTATIONS LICENSENUMBER.

a.

4. Open the CONSULTATIONS table and fill in 10 records.

Remember that, due to the relationship stablished between LICENSENUMBER and HISTORYNUMBER, Access will only let you fill in records using values that previously exist at DOCTORS and PATIENTS tables.

5. Try entering some patients or doctors that do not exist at DOCTORS or PATIENTS in the table CONSULTATIONS and see what happens.

6. Create 2 records at CONSULTATIONS with the same PATIENT historynumber.

7. Close the table CONSULTATIONS.

8. Open the table PATIENTS, look for the record whit the code used at exercise 6. Change the HISTORYNUMBER using a new non-existent number.

9. Close the table PATIENTS.

10. Open the table consultations and check that the two records created at exercise 6 have their HISTORYNUMBER modified. This is what we call a CASCADE UPDATE.

11. Close CONSULTATIONS table.

12. Open the table PATIENTS and look for the record you changed before at exercise 8. Delete it.

13. Close PATIENTS table.

14. Open the CONSULTATIONTS table and check that the records that had the deleted HISTORYNUMBER have been deleted too. This is what we call a CASCADE DELETION.

15. Close the table and COPY the DATABASE to a USB PEN or send it to yourself by e-mail. You will need it at the next practical session.

WHEN YOU HAVE FINISHED, YOU MAY LEAVE THE CLASS!

HAVE A NICE DAY!