inf1050- databases in this module you will use microsoft access to create digital databases

29
INF1050- Databases In this module you will use Microsoft Access to create digital databases

Upload: arline-silvia-robbins

Post on 26-Dec-2015

222 views

Category:

Documents


2 download

TRANSCRIPT

INF1050- DatabasesIn this module you will use Microsoft

Access to create digital databases

First Steps

1. Start Menu -> Programs -> Microsoft Office -> Access

2. Click on Blank database. Click OK3. Open the File button in the middle right. This

is where it will be saved. Call it lastname.firstname and save it in your Save Space. Click the Create button

• You should have a screen that looks like this. Make sure that you select the Create tab, which is circled in red.

• Click the Table Design button that is right below the circled area.

• Insert this data into the table as shown. You will also have to change the Field Size number (see arrow pointing to box)

• Change Field Sizes, in descending order, to: 5, 30, 30, 2, 30, 20, 2, 5, 2.

Next Steps

• When you have all of your information, go to File -> Save (not Save As).

• Save your table as ‘Employees’.• It will ask you if you want to create a Primary

Key. Say no.• Close the table

Create a Department Table

• Use the previous steps to create a new table

• Change the Field Size to 2 and 30, in descending order• Save this Table as ‘Departments’.

Open the Employees Table

Enter the Data As Shown

• Make sure all the data is visible (you may need to stretch the columns)

• Save your table• Close your Employees table

Open the Department table

• Include the following data in this table by switching back to the DataSheet view:

Adding a New Category

• Go to the Employee table and change to Design View• Right-click on the Hire Date row• Click on the Insert rows icon on the Table Design

toolbar and put in this new text:Field name = TelephoneData Type = TextField Size = 14Description= Employee Home Telephone Number• Save this change

• Making sure your cursor is in the Telephone row, click below on Input Mask and click on The three black dots

Follow These Steps…

And then hit Finish

Go back to Datasheet view and enter:

Using the Lookup Wizard• Open the Employees table and change to Design View• Right-click and add in a new category at the top, Emp. Category. Click on

Data Type and select Lookup Wizard at the bottom

• Sorry, wrong table in picture

Follow These Steps

Then save

Go back to the Datasheet

• Notice that your 3 pay choices can be selected from drop-down boxes from a menu.• Recreate the boxes as shown• If necessary be sure to stretch out your column so that you can see all the words.

Moving Fields• We will move the Last Name field below the Middle Initial field• Click your mouse in the grey box to the left of the Last Name field• Click and drag it down until the line between Middle Initial and Street

Address is a solid black.

• Let go with the mouse, and it will move below into the order shown here:

Sorting Records

• Go back to the Employees table in Datasheet view• Click on the drop-down box under Last Name and select Sort

A to Z

Relationships Between Tables

• Create two new tables: a Clients table and a Claims table. Do not worry about the descriptions

Define the Primary Key1. Open the Clients table in Design view2. Select the “Client #” record and click your mouse in the grey box area to

the left. It should be highlighted in black3. Click on the Primary Key button. A key symbol should now be on your

Client# Row

Define the Primary Key3. Save this table4. Open the Claims table in Design View5. Select the “#Claims” record and add the primary key icon to it like you had done with the previous table. Save the table.

The Relationship

• Click on the Relationship icon in the Database Tools tab

Add both Clients and Claims

Next StepsClick and drag the Client# into The bottom of the Claims box.

Check these 3 boxes

Then click “Create”. The two boxes will be linked together.

Seeing the Relationship (awwww)

• Hit the Plus + button to open the linked Claim table• Fill in the data you see here for the two tables:

Switch back to the Claims table and this info will now be in there

Congratulations!

You have now learned how to:

• Create tables and fill in data• Create fields• Create a Drop-Down menu using the Wizard• Use Design view and Data view• Show a relationship between two tables

• Please hand your activity into the INF1050 folder when you have completed it

Your Assignment

• You are the owner of a new auto repair shop, Super Mechanics

• You will need to develop a database that keeps track of customers, vehicles, services performed and parts. (It can also be any other sort of business you may be interested in)

• You could also do another business such as a clothing store or pet store

You will need 4 Tables:

1. Customers- include last and first name, phone number, address, province and city

2. Service- repair description, service technician name, date of repair, total cost

3. Parts- parts used, cost of parts, serial number

4. Vehicle- make, model, colour, plate number

• If you are doing a different kind of store, use table 1 but make 3 other tables that fit with the kind of business it would be. Keep the customer table, though.

Next Steps

• You will have to create 2 or more relationships with the tables before you put in any information

• Create 15 entries (customers) for this assignment. You make have to do a bit of research if you are going to list certain products, brands and prices in your database