Download presentation
Presentation is loading. Please wait.
Published byKatherine Andra Collins Modified over 9 years ago
1
Microsoft Access – Tutorial 2 Designing Databases In this tutorial, we will create a new database create a new table import tables from an existing database copy records from another database into your new table maintain, modify and update the new table to specific data requirements
2
Microsoft Access – Tutorial 2 Guidelines for Designing Databases identify all fields necessary to produce the required information determine each table’s Primary Key can be a naturally unique field such as a credit card or SIN # can be two or more fields called a composite key ex. student # and course code a field that is added specifically to be the primary key ex. EmployerID
3
Microsoft Access – Tutorial 2 Guidelines for Designing Databases include a common field in related tables use a common field to connect one table logically to another table ex. the EmployerID for the Employer and Positions tables remember that when a primary key is used as the common key in another table (as in the example above), it is called a foreign key avoid Data Redundancy do not store the same data in more than one table, except as keys in the examples above wastes storage space and can cause inconsistencies see figure 2-3 on page AC37 for an example illustration
4
Microsoft Access – Tutorial 2 Guidelines for Designing Databases determine the properties of each field identify the properties or characteristics of each field so that the DBMS knows how to store, display and process the field values examples field’s name, maximum number of characters or digits description valid values
5
Microsoft Access – Tutorial 2 Guidelines for Setting Field Properties you must name each field, table and other object in an Access database choose names that best describe the purpose or contents name rules: up to 64 characters long cannot contain period (.), exclamation mark (!), accent grave or square brackets ( [ ] ) can’t start with a space valid values
6
Microsoft Access – Tutorial 2 Guidelines for Setting Field Properties name conventions (not strict rules): capitalize the first letter of each word in the name ex. PositionTitle avoid extremely long names use standard abbreviations ex. number = Num; amount = Amt; quantity = Qty avoid spaces or special characters these can be used when setting the Caption for the name
7
Microsoft Access – Tutorial 2 Setting Field Data Types each field must have a data type assigned this determines what field values can be entered and what other properties the field will have there are ten data types available which include text number date/time currency yes/no hyperlink a full list with explanations can be found in figure 2-4 on page AC39 of your book
8
Microsoft Access – Tutorial 2 Setting Field Sizes you can also set the field sizes for the maximum storage of text, number and autonumber fileds text has a default size of 50 characters, but can be set from 0 to 255 characters set the Field Size property based on the largest value you expect to store in that field doing this can speed up performance of the database a full list with explanations can be found on page AC40 of your book
9
Microsoft Access – Tutorial 2 Setting Field Captions field captions specify how a field will appear in datasheets, forms, reports and other database objects normally the field name is used, but it may be awkward or confusing ex. HoursPerWeek could be captioned hours/week a full list of examples can be found in figure 2-5 on page AC40 of your book
10
Microsoft Access – Tutorial 2 Creating a new database click the new button on the database toolbar or File>New select Blank Database and save a new database called Northeast click the New button in the database window and select Design View Enter field names, data types, descriptions and properties from this view we will start with the primary key PositionID give it the name PositionID with a Data Type of text and the (optional) description Primary Key
11
Microsoft Access – Tutorial 2 Setting Field Properties look at the General Properties for this field change the field size to 4 as Position IDs consist of 4 characters give it the caption Position ID next add the PositionTitle field with a size of 30 characters and the caption Position Title next add the EmployerID field with a size of 5 characters and the caption Employer ID give this a description of Foreign Key (WHY?)
12
Microsoft Access – Tutorial 2 Setting Field Properties next add the Wage field this filed has a data type of Currency give this a description of Rate per hour for this field, we will set the decimal places to two this field should not have a default value, so remove the default value of 0 from this field
13
Microsoft Access – Tutorial 2 Setting Field Properties next add the HoursPerWeek field this filed has a data type of number give this a description of Work hours per week to save data space and improve performance change the Field Size from Long Integer to Integer as it stores the number in a smaller size (2 bytes) give the field a caption of Hours/Week delete the default value do the same for the field Openings with a caption of Number of Openings next add the seventh ReferredBy (text) field with a size of 30 characters and a caption of Referred By
14
Microsoft Access – Tutorial 2 Setting Field Properties the eight and ninth field are date/time fields with the names StartDate and EndDate put Month/day/year in the description fields format these with the mm/dd/yyyy style give them logical captions
15
Microsoft Access – Tutorial 2 Specify the Primary key specify Position ID as the primary key click on the row selector (left side) to select the row click the Primary Key button on the Table Design toolbar save your work and name the table Position look at the figures on pages AC50 and AC51 to check your work
16
Microsoft Access – Tutorial 2 Adding Records click the view button (top left) for the Datasheet View add the two records in figure 2-16 on page AC53 Deleting Fields click the view button (top left) again to return to the Design View select the ReferredBy field right-click and delete the entire row
17
Microsoft Access – Tutorial 2 Moving Fields select the Openings field click and drag the field so that it is the last field on the bottom Adding Fields select the StartDate field right-click and select Insert Rows add a new field called Experience this will be a yes/no Data Type caption this Experience required make the default value no
18
Microsoft Access – Tutorial 2 Changing Field Properties select the Openings field change the Format to Standard so that the $ will not appear Update change to field properties you can update the change above to forms and reports that use this field click the Property Update Options (lightning bolt) symbol and update save your table and add the record in figure 2-28 on page AC64
19
Microsoft Access – Tutorial 2 Obtaining Data from other databases open the database file NEJobs and then the table Available Positions copy the records and paste them below the three records you already have you must select row 4 to do so import the Employer and NAICS tables click file>Get External Data>Import locate the Seasonal Database and import the two tables practice with the Case Problems at the end of Tutorial 2!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.