0% found this document useful (0 votes)
7 views25 pages

Database Management (Primary - Keys, Relationships - Forms - Queries)

The document outlines key objectives and processes for managing databases, including establishing primary keys, creating forms, and generating reports. It explains the importance of relationships between tables, the creation of queries with calculated fields, and the use of statistical features in reports. Additionally, it provides step-by-step instructions for creating primary keys, relationships, forms, queries, and reports in a database system.

Uploaded by

lmfaooooooos3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views25 pages

Database Management (Primary - Keys, Relationships - Forms - Queries)

The document outlines key objectives and processes for managing databases, including establishing primary keys, creating forms, and generating reports. It explains the importance of relationships between tables, the creation of queries with calculated fields, and the use of statistical features in reports. Additionally, it provides step-by-step instructions for creating primary keys, relationships, forms, queries, and reports in a database system.

Uploaded by

lmfaooooooos3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Database

Management
Objectives
• Establishing Primary Keys in Database • Create Reports
• Establish relationships: show the joins • Use of report wizard

Jens Martensson
between tables (one-to-one and • Use of sorting and grouping
one-to-many) • Use of statistical and summary features (count,
sum and average
• Create and manipulate Forms • Generate report to screen, printer and file
• Use of form wizard • Rename Report title
• Select suitable fields and use of sub-form
• Create Queries
• More than one criterion
• Use of select
• Use of calculated field
• Use of two or more fields involving the use of
2
relational and logical operator
Jens Martensson
Establishing
Primary Key
3
Primary Key
• A primary key is a field whose values are unique so they can be used
to identify a particular record in a table.

Jens Martensson
• A foreign key appears in a table where it doesn’t really belong but
allows two tables to be linked.

4
Primary Key
How to create a primary key?

1. Navigate to “Design View” for a specific

Jens Martensson
table.
2. Select the field and click the “Primary
Key” command.You can also right-click a
specific field and make it the primary key.

5
Jens Martensson
Establishing
Relationships
6
Relationships in Database
What’s a relationship ?

• A relationship in Access helps you combine data from two different tables. Each

Jens Martensson
relationship consists of fields in two tables with corresponding data.

• In our scenario, we have a customer ID which belongs to the customer’s table.


The customer ID is also in the vehicles table. Each record in the Vehicles table is
attached to a customer ID that corresponds to a record in the Customer Table
with the same customer ID.

7
Relationships in Database
• Relationships allows the database system to • One to One Relationship:
automatically retrieve the data from • Is when one record in the first table matches
multiple tables to answer our queries (a zero or one record in the second table.
method of retrieve information from a • For example, one customer is only renting one
database) vehicle.

Jens Martensson
• One to Many Relationship:
Types of Relationships: • Is when one record in the first table may match
many records in the second table.
• For example, one customer can rented many
• One-to-one Relationship vehicles.
• One-to-many Relationship
NB: It is possible to create a many-to-many
relationship.This is when many records in the
first table match may records in the second
table.This type of relationship must be avoided
because it may allow your database to not
8
function properly.
Relationships in Database
How to create a relationship ?

1. Navigate to the “Database Tools” tab on

Jens Martensson
the ribbon.
2. Select the “Relationship” command.
3. On the Relationships Design tab, in the
Relationships group, click “Add Tables”
4. Select the tables and then click “ADD”
5. Drag a field (typically the primary key)
from one table to the common field (the
foreign key) in the other table.

9
Jens Martensson
Create and
Manipulate
Forms
10
Forms
• A form is a user-friendly interface to a database system. Forms can
be used for inputting data or simply viewing data in a user-friendly
way.

Jens Martensson
• Simple forms are based on a single table but complex forms that are
based on two tables are particularly useful when viewing large
amounts of data.

• Database developers have complete control over the contents of a


form and how it is laid out.
11
Jens Martensson
12
Forms
How to create a form?

1. Select the table you want to create the

Jens Martensson
form for.
2. Navigate to the “Create” tab and then
select the “Form Wizard” command.
3. Move all the fields onto the “Selected
Fields” section.
4. Accept all other defaults until the wizard
closes.
5. To view the form. Click on the form and
then select the view option you require.
13
Forms
Sub-forms How to create a sub-form?

• A sub-form will be a form that links to the 1. Select the tables that would be inclusive in

Jens Martensson
main form for a particular database. the form.
• For example, we would have a customer table 2. Ensure that you moved all fields
that has all the persons who rented a car. The associated with both tables to the
Vehicle table will contain information if a
particular customer rented multiple vehicles.
“Selected Fields” category.
• A sub-form would allow you to view this 3. Accept all other defaults until the wizard
information. closes.
4. Save if prompted to do so.

14
Jens Martensson
Create Queries
15
Queries
What are queries?

• Queries are one of the most useful features of a database system.

Jens Martensson
Queries answer the questions that user pose.

• In other words, a query can either be a request for data results from
your database or for action on the data, or for both.

• A query can give you an answer to a simple question, perform


calculations, combine data from different tables, add, change or delete
data from a database. 16
Jens Martensson
17
Queries
How to create a query?

1. Navigate to the “Create” tab and select

Jens Martensson
the “Query Design” command.
2. Add the table or tables and then the fields
you want to appear in the query by
clicking in the next free field and choosing
the field from the drop-down menu.
3. In the Criteria row and add your criteria.
4. To run the query, look for “Run” or the
run symbol.
5. The results of the query will be displayed.
18
Queries
Calculated Fields in Queries

• A calculated field is a field that derives its value by performing a function on

Jens Martensson
values from other table fields.

• Calculated fields are easy to add to a query.


• Type the formula in a free field during the query design
• For example: Days_Rented : [Date Returned] – [Day Rented]
• Days_Rented is a calculated field in the query that will calculate how many days a car was
rented.

19
Jens Martensson
Create Reports
20
Reports
• Reports offer a way to view, format, and summarize the information
in your Microsoft Access database.

Jens Martensson
• A report is a database object that comes in handy when you want to
present the information in your database for any of the following
uses:
• Display or distribute a summary of data
• Archive snapshots of the data
• Provide details about individual records
• Create labels
21
Jens Martensson
22
Reports
How to create a report?

1. Navigate to the “Create” tab and select

Jens Martensson
the “Report Wizard” command.
2. Add the tables or queries, and then the
fields that you want to appear in the
report.
3. Select any grouping that you want to be
applied to the report.
4. Select any sorting and any summary
options that you want to be applied to
the report
5. When the wizard finishes, the report is 23
displayed.
Reports
• Once the report is generated, you can sort • If you wish to rename the title of your
the information in ascending or descending report, simply double-click the title name
order. and make the necessary changes.

Jens Martensson
• You can use summary features such as:
• SUM
• COUNT
• AVERAGE

• This is can be done within the “Design” tab


under the “Report Layout Tools”.You would
navigate to “Grouping & Totals” group.

24
Jens Martensson
25

You might also like