Download INTRODUCTION TO COMPUTER APPLICATIONS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
INTRODUCTION TO COMPUTER APPLICATIONS
LAB 7: MICROSOFT ACCESS
DUE DATE: FRIDAY NOVEMBER 5, 2004. 1:00PM
1. Open Microsoft Access and choose ‘File, New’. In the right panel, choose ‘Blank
Database’. Choose the drive where you save the files and name the database
‘rentacar’ and hit ‘Create’
2. From the window that appears, select “Create table in design view”.
3. Fill in the field names, data type and corresponding fields.
Field Name
Data Type
Car ID
Make/Model
License
Size
Rental Rate
Text
Text
Text
Text
Currency
Format
Field Size
3
30
10
1
4. Place the cursor on the ‘Car ID’ field. Select from the Edit Menu, the option
“Primary Key”. Be sure that in the Field properties table, the Indexed box shows
Yes (No Duplicates). (Think about what you just have done).
5. Now you should save this table. From the File Menu, select the ‘Save As’ option,
and name the table “Cars”. Close the table.
6. Create another table called “Rentals” with the following fields. In this table the
‘Rental ID’ field is the primary key. Save the table and close it.
Field Name
Data Type
Rental ID
Car ID
Customer
Date Rented
Days Rented
Autonumber
Text
Text
Date/Time
Number
Format
Field Size
3
35
Medium Date
7. Now we must relate the two tables. The tables are closed, but the database is
open. Open the Tools Menu. Select “Relationships” from the Tool menu. The
Show Table Dialog box appears. Select the Cars table, and click on the Add
button. Repeat the process with the Rentals table. Close the Show Table Dialog
box.
8. To establish the relationship, drag the Car ID field from the Cars table structure
onto the same field of the Rentals table structure that appears on the screen.
Release the mouse and the relationship is going to be established.
9. In the Edit Relationship window select the “Enforce Referential Integrity” and
also the “Cascade Delete Related Records” and “Cascade Update Related
Records”. Click now on the Create buttom. You will see the relationship
established on the screen. Close the “Relationships” table. Select the “Yes” button
when asked if you want to save the relationship.
10. Enter records into the tables of the database. Select the Cars table. Click on the
Open button. Press [Tab] to move between fields, or use the mouse. Do the same
with the Rentals table, but be sure to bypass the Rental ID field because it is an
autonumber, and the value will be placed automatically, without the intervention.
CARS TABLE
Card ID
100
101
102
103
Make/Model
Toyota/Camry
Lincoln/Continental
GM/Saturn
VW/Rabbit
License
Nippon 01
Spy 007
How Cute
I Ran Fast
Size
M
L
C
M
Rental Rate
45.50
55.50
28.00
42.00
RENTALS TABLE
Rental ID
10001
10002
10003
10004
10005
Car ID
101
103
102
101
102
Customer
Perez
Zack
Patel
Hickey
Estrada
Date Rented
24-Sep-04
28-Sep-02
01-Oct-01
15-Oct-04
05-Nov-03
Days Rented
14
10
3
4
6
Remark: If you want the Rental ID to start with 10001 (instead of 1) go to the design
view and enter \10000 in the Format section of the Field properties part, for the Rental ID
field.
11. Now we will create a Query. Click on the Query button, select ‘Create Query in
Design View’. In the Show Table that appears, select Cars, and click on ADD.
Close the Show Table.
12. Drag the asterisk from the Cars table description that appears, into the first field
location, and be sure that the Show location is on. (It will show a checked square).
13. Drag each field name to other field locations. Select Make/Model as the field, put
“=”Toyota/Camry” as the condition for that field. Select Rental Rate as the other
field, and “<45” on the OR condition row. Unchecked the Show boxes for the rest
fields.
14. When done, select RUN from the Query Menu. It will display the records
satisfying the requested criteria.
15. You can save this query with Save As. Name it MyQuery.
16. Now we will try to create another query that contains an additional field.
17. Select ‘Create Query in Design View’. In the Show table that appears, select Cars,
and click on ADD. Select Rentals, and click ADD. Close the Show Table.
18. Drag the asterisk from the Rentals table, into the first field location. In the second
field of the query table, type “Charges” and press Enter. “Exp 1:[Charges]” will
appear. First change “Exp 1” to read “Rental Charges”. Now to build the formula
for the charges, right click and select Build from the menu that appears.
19. In the box of the expression builder, delete the [Charges] part, then click on the
equal sign operator (=). Now go down to Tables, double click it. The two tables,
Cars and Rentals appear. Double click on Cars, to open it, and then double click
on the Rental Rate, to place it on the formula. Click on the asterisk sign (*), for
the product. Now you have to select the Days Rented from the Rentals Table.
Click on OK.
20. Run the Query now, and see the Charges appear. Save the query as Charges.
21. Submit your database by Blackboard.