Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Database

Shared collection of logically related data (and a description of


this data), designed to meet the information needs of an
organization.
Database
Shared collection – can be used simultaneously by
many departments and users.
Logically related - comprises the important objects
and the relationships between these objects.
Description of the data – the system catalog (meta-
data) provides description of data to enable data
independence.
DBMS
A software system that enables users to define, create, and
maintain the database and that provides controlled access to
this database.
Database application program
A software program that interacts with the database by issuing
an appropriate request (typically an SQL statement) to the
DBMS.
Views
Allows each user to have his or her own view of the database.

A view is essentially some subset of the database.


Views
Benefits include:
◦ Provide a level of security;
◦ Provide a mechanism to customize the appearance of the
database;
Components of DBMS
Environment
Hardware
◦ Can range from a PC to a network of computers.
Software
◦ DBMS, operating system and also the application
programs.
Data
◦ Used by the organization and a description of this
data called the schema.
Components of DBMS
Environment
Procedures
◦ Instructions and rules that should be applied to the design and use of
the database and DBMS.

People
◦ Includes database designers, DBAs, application programmers, and
end-users.
Advantages of DBMSs
Control of data redundancy
Data consistency :validity, accuracy, usability and integrity
Sharing of data
Improved data integrity
Improved maintenance through data independence.
Disadvantages of DBMSs
Complexity
Cost of DBMS
Cost of conversion
Performance
Higher impact of a failure
Why use Microsoft Access?
Microsoft Access is a "relational" database application. Relational means we can
link together sets of data, we can relate the data.
In Access the data is saved in Tables. As the data in the Tables change, the rest of the
Access database will reflect the newest information (i.e. the Queries, Forms and
Reports).

Queries show the data in a Table format. A Query can pull from multiple Tables and
allow you to limit the records (rows) display by using criteria and showing only the
fields (columns) you want

Forms can be created to provide a "user‐friendly" side to your database. They are
used to view and enter your data in an interactive formatted structure. Forms are also
used to make menus and search.

Reports are created to print out your data in a formatted structure. They allow you to
group and organize your data. They can be used to create Form letters and mailing
labels. Access works beautifully with Word for mail merges, but the Reports tool
allows for the multi‐level summaries.
A query is a way of extracting specific data or information from a database. As you
know tables store all information in database, if you want to view only selected
fields and records in a database, you use query. For example you can create a
query for the students table which will view the students who got 5.

Types of queries in Microsoft Access: There are five types of query in Access.
They are:
• Select queries
• Action queries
• Parameter queries
• Crosstab queries
• SQL queries.
Select Queries
Select query is the simplest and the most common type of query. It retrieves data
from one or more tables depending on what is needed and displays the result in a
datasheet. Select query also use to group records and calculate sums, counts,
averages, and other types of totals.

Action Queries
a specific action depending on what was specified in the query itself is known as
action query. This can include such things as creating new tables, deleting rows
from existing ones and updating records or creating entirely new ones. Action
queries are very popular in data management because they allow for many records
to be changed at one time.
There are four types of action queries:
• Append Queries: An append query add records from one or more tables to the end of
one or more tables. For example, you have some new customers and a database
containing a table of information on those customers. To avoid typing all this
information into your own database, you can append it to your Customers table.

• Update Queries: An update query makes global changes to a group of records in one
or more tables. For example, you can increase employee’s salary by 20 percent for the
people within a certain job category. With an update query, you can change data in
existing tables.

• Delete Queries: A delete query deletes a group of records from one or more tables.
Delete queries always delete entire records, not just selected fields within records. For
example, you could use a delete query to remove products that are discontinued or for
which there are no orders.

• Make-Table Queries: A make-table query creates a new table from all or part of the
data in one or more tables. Make-table queries are helpful for creating a table to export
to other Microsoft Access databases or a history table that contains old records. Making
a backup copy of a table automatically by using a macro or code.
Parameter Queries
Instead of entering predetermined criteria, you want to prompt users when a query
runs; you can create a parameter query. A useful feature of the parameter query is
that it can be saved and used again and again whenever we want to ask the same
question. When you run a parameter query Access displays dialog box prompting
you for the parameter value. You can create a parameter query by enclosing a
question in square brackets ([]). For example, if you want to create a parameter
query that asks users which id you want to use from the Student’s table, you would
type [Which id?] on the Criteria line under the id column. When the query runs,
Access will prompt the user for the answer to your question.

Crosstab Queries
You use crosstab queries to calculate and restructure data for easier analysis of
your data. Crosstab queries calculate a sum, average, count, or other type of total
for data that is grouped by two types of information one downs the left side of the
datasheet and another across the top.
Advanced Queries
Sorting Query
Table Relationships

In a relational database, information about a particular subject is stored in its own


table. The purpose of this is so that you do not need to store redundant data. For
example, if you have a database with information about students and classes you
would want to store the information about classes separately so that you do not
have to enter all the details about a particular class such as time, place, instructor,
credits, etc. over again for every student enrolled in that class.

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 the same type
of field in the other table. The inclusion of this field in the second table is called a
“foreign key”. A foreign key is one or more table fields (columns) that refer to the
primary key field or fields in another table.
Types of Table Relationships

1) One-to-Many:

The most common type of relationship is the one-to-many. In a one to many


relationship a record in Table A can have more than one matching record in Table B,
but a record in table B has at most one matching record in Table A. An
2) One-to-One:
In a one-to-one relationship, a row in Table A can have no more than one matching
row in Table B. A one-to-one relationship is created if both of the related columns
are primary keys. This type of relationship is not common because information
related in this way would usually be included in a single table
3) Many-to-Many:
In a many-to-many relationship, a row in table A may have many matching rows in
table B ,and vice versa.
A many-to-many relationship between tables is only possible by creating a third
table (called a junction table) whose primary key consists of two fields – the keys
from both Tables A and B
Referential Integrity
Referential Integrity refers to rules that you can enforce to prevent the accidental
changing or deletion of data in related tables.

Cascade Update and Cascade Delete


For relationships in which referential integrity is enforced, you can specify whether
you want Microsoft Access to automatically cascade update or cascade delete related
records.

You might also like