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

Database Basics and Reports Using Microsoft Access

By Rafael Parra, June 2008


Email: eduardopa@gmail.com
Telephone: 661-378-6943

January 6, 2009 1
Database Basics and Reports Using Microsoft Access

Microsoft Access is a powerful program to create and manage your


databases. It has many built in features to assist you in constructing and
viewing your information.

Microsoft Access is a Relational Database Management System


(RDBMS), and it includes all the functionality needed to add,
modify or delete data from the database, ask questions (or queries)
about the data stored in the database and produce reports
summarizing selected contents.

Four of the major components of Access that most database users


will encounter are: tables, queries, forms and reports.

January 6, 2009 2
Database Basics and Reports Using Microsoft Access

The Relational Database Model

Created in 1969 by Edgar Codd (Engineer From IBM).


The relational model for database management is based on a
theory set to create a consistent, logical representation of
information.
Maximize Consistency, Minimize Redundancy
More: http://c2.com/cgi/wiki?RelationalModel

In the relational model the data is


separated in tables and connected
through relationships.

January 6, 2009 3
Database Basics and Reports Using Microsoft Access

Consistency and Redundancy

January 6, 2009 4
Database Basics and Reports Using Microsoft Access

Starting Microsoft Access

January 6, 2009 5
Database Basics and Reports Using Microsoft Access

Creating New, and Opening Existing Databases


Open the Sample Database

January 6, 2009 6
Database Basics and Reports Using Microsoft Access

Hierarchy that Microsoft Access uses in breaking down a database.

Database File: This is your main file that encompasses the entire
database and that is saved to your hard-drive or floppy disk.
Example) StudentDatabase.mdb
Table: A table is a collection of data about a specific topic. There can
be multiple tables in a database.
Example #1) Students
Example #2) Teachers
Field: Fields are the different categories within a Table. Tables
usually contain multiple fields.
Example #1) Student LastName
Example #2) Student FirstName
Datatypes: Datatypes are the properties of each field. A field only
has 1 datatype.
FieldName) Student LastName
Datatype) Text

January 6, 2009 7
Database Basics and Reports Using Microsoft Access

Tables
Tables comprise the fundamental building blocks of any database. If you're familiar
with Excel spreadsheets, you'll find database tables extremely similar.
A table is a collection of data about a specific topic, such as students or contacts.
Using a separate table for each topic means that you store that data only once,
which makes your database more efficient, and reduces data-entry errors.
In a well design table you will always find a primary key or Unique Identifier.
•A primary key does not allow Null values and must always have a unique value.
•A primary key is used to relate a table to foreign keys in other tables.
Primary Key Field

Record

January 6, 2009 8
Database Basics and Reports Using Microsoft Access

Tables in Design View

January 6, 2009 9
Database Basics and Reports Using Microsoft Access

Importing a Table from Excel (using Automation)

Copy paste also works!!


January 6, 2009 10
Database Basics and Reports Using Microsoft Access

Advanced Table Features w/Microsoft Access


Assigning a field a specific set of characters
Example) Making a Social Security Number only allows 9 characters.
1. Switch to Design View
2. Select the field you want to alter
3. At the bottom select the General Tab
4. Select Field Size
5. Enter the number of characters you want this field to have

January 6, 2009 11
Database Basics and Reports Using Microsoft Access

Advanced Table Features w/Microsoft Access


Masks: Formatting a field to look a specific way
Example) Formatting Phone Number w/ Area Code (xxx) xxx-xxxx
• Switch to Design View
• Select the field you want to format
• At the bottom select the General Tab
• Select Input Mask Box and click on the ... button at the right.
• Select Phone Number option

January 6, 2009 12
Database Basics and Reports Using Microsoft Access

Advanced Table Features w/Microsoft Access


Selecting a value from a dropdown box with a set of values.
Switch to Design View
Select the field you want to alter (City)
At the bottom select the Lookup Tab
In the Display Control box, select Combo Box
Under Row Source Type, select Value List
Under Row Source, enter the values how you want them displayed, separated by a
comma. (Auburn, Bay City, Flint, Midland, Saginaw)

January 6, 2009 13
Database Basics and Reports Using Microsoft Access

Relationships

A relationship works by matching data in key columns, usually columns


with the same name in both tables. In most cases, the relationship
matches the primary key from one table, which provides a unique identifier
for each row, with an entry in the foreign key in the other table.

January 6, 2009 14
Database Basics and Reports Using Microsoft Access

Viewing and Creating Relationships in Access

3. Right click the database window.


4. Click on the Relationships menu
5. To create a relationship you need a primary key and a foreign key.

January 6, 2009 15
Database Basics and Reports Using Microsoft Access

Appendix:

1. The Normalization Process


If you have worked with databases for a while you chances are, you have run into
the concept of normalization.
Normalization is the process of efficiently organizing data in a database.
There are two goals of the normalization process:
Eliminating redundant data (for example, storing the same data in more than one
table)
Ensuring data dependencies make sense (only storing related data in a table).
Both of these are worthy goals as they reduce the amount of space a database
consumes and ensure that data is logically stored.

January 6, 2009 16
Database Basics and Reports Using Microsoft Access

2. Basic Normalization Forms:

First Normal Form (1NF)


First normal form (1NF) sets the very basic rules for an organized database:
Eliminate duplicative columns from the same table.
Create separate tables for each group of related data and identify each row with a
unique column or set of columns (the primary key).

Second Normal Form (2NF)


Second normal form (2NF) further addresses the concept of removing duplicative
data:
Meet all the requirements of the first normal form.
Remove subsets of data that apply to multiple rows of a table and place them in
separate tables.
Create relationships between these new tables and their predecessors through the
use of foreign keys.

Third Normal Form (3NF)


Third normal form (3NF) goes one large step further:
Meet all the requirements of the second normal form.
Remove columns that are not dependent upon the primary key.
January 6, 2009 17

Вам также может понравиться