Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Database normalization
Relationships in Access 2007
Create queries
Open a recently used database
Open a database through Microsoft Office Access button
Close a database
Database normalization
Database normalization is the process to organize the data of a data base. It includes the creation of
tables and the establishment of relations among them according to designed rules by eliminating the
incoherent redundancy and dependencies.
Redundancy data waste disk space and create maintenance problems. If there is to change data that
exist in more of a place, they are due to change exactly of the same form in all his locations. A change
in the direction of a client is much easier to implement if the data only store in the table Clients and not
in some other place of the data base.
Microsoft Access 2007 uses the relational model for the database management which is based on the
logic of predicates where the data is represented by mathematical n-ary relations. Each relation is
represented by the composition of fields stored in tables that represent these n-ary relations.
To transform a database in a relational database there are several normalization forms to apply:
4) Create independent tables for sets of values that are applied to several records.
There are two additional normal forms (fourth and fifth) but both are rarely used.
7) Open TutorialDB.
8) Click on Database Tools and select Relationships. Remember that the database must be
normalized before.
Illustration 1: Normalize the database and create relationships between tables and data.
9) Right click on the empty screen and select the Show table menu item.
Illustration 2: Normalize the database and create relationships between tables and data.
11) Arrange tables in the diagram. Then click and holds the AreaId field in Areas table and drag it over
AreaId fields in Fields tables.
Once normalized the data base, it is possible to design queries that take advantage of the relational
model.
Create Queries
Queries are those that truly make the work in a data base. They can make several different functions.
Its function commonest is to recover specific data of the tables. The data that wish to see usually are
distributed by several tables and, thanks to the queries; you can see them in a single data sheet. In
addition, since normally you do not wish to see all the records simultaneously, the queries allow you to
add criteria for "filtering" the data until obtaining the whished records. The queries often serve as origin
of registries for forms and reports.
Some queries are "updatable", which means that it is possible to edit the data of the table’s through
query’s datasheet. If it works with an updateable query, remember that the changes also take place in
the tables, no only in the query’s datasheet. There are two basic types of queries: those of selection
and those of action. A selection query simply recovers the data and causes that it become available
for his use. The results of the query can be seen in the screen, be printed or be copied to the paper
holder. Or can be used like data source for forms or reports.
An action query, as its name indicates, makes a task with the data. The action queries can serve to
create new tables, to add data to existing tables, to update data or to eliminate data.
16) Select the Create tab on Options Tape and select the Query Wizard command.
17) Select the Simple Query wizard Option and press OK button.
18) Select the Files table from Table / Queries list. Then select Filename, Comments and
Directory fields from the Available Fields list.
21) Press the FINISH button. You will see the data.
22) Now, you will create a more refined query. Select the Create option in the Options Tape, and
select the Query design command.
23) Double click on each table name to add it to the query designer.
Notice that the relations between tables are added at time of there is added to the query designer
24) Double click on each Field on File table that you want to show. Skip the TypeId, AreaId and
ThemeId fields.
25) The fields Filename, Comments and Directory will appear at bottom grid. You can deselect the
show option. This option will hide the field but it will still remain in the query for other purposes (for
example, you can count the distinct instances of the file name).
26) Now, add the additional fields (those related to the TypeId, AreaId and ThemeId keys) by
clicking in AreaName from Areas table, TypeName from FileTypes table and Themename from
Themes table.
27) Right click on Query1 name and select the SAVE menu item.
Illustration 15: Save the query.
30) Access 2007 will take each related field from related tables using the relational model data retrieval
theory.
If you try to change any related field (like AreaName, ThemeName or TypeName) all instances of
these fields will be changed. For example if you change the value “SCM” at the ThemeName in the first
row, all instances of this field will be changed automatically in the query and the base table (Themes)
will be changed too.
Illustration 19: Changing a related field will affect all instances of this field and the base table.
31) Now you will create a crosstab query. Select the Simple Query wizard Option and press OK
button.
32) Select the Crosstab Query wizard Option and press OK button.
33) Select the List Files table from Table / Queries list. The Both option must be selected first.
Illustration 21: You can see a design preview.
35) Select the AreaName as row to summarize and press the NEXT button.
37) Select the Count as summarize operation and press the NEXT button.