Uploaded by Lindiwe Mulombwa

2.3 Database

advertisement
2.3
Database
WHAT IS A DATABASE
A DATABASE is a structured collection of
data that allows people to extract
information in a way that meets their
needs. The data can include text,
numbers, pictures: anything that can be
stored in a computer.
Databases are very useful in preventing
data problems occurring because:
1. data is only stored once – no data
duplication
2. if any changes or additions are made
it only has to be done once – the data
is consistent.
3. the same data is used by everyone.
What are databases used for?
To store information about people, for
example:
1. patients in a hospital
2. students at a school.
3. To store information about things, for
example:
• cars to be sold, books in a library, hotel
bookings and results of races.
2.3
The structure of a database
Inside a
database, data
is stored in
TABLES, which
consists of
many
RECORDS and
each record
consists of
several FIELDS.
Records and Fields
• A field is more than
just a column: it’s
a way of organizing
information by the
type of data it is.
• Every piece of
information within
a field is of the
same type.
For example, every entry in a field called
‚First Name‛ would be a name, and every
entry in field called ‚Street Address‛ would be
an address.
Record
a record is more than just a row-- it’s a unit of
information. Every cell in a given row is part of
that row’s record.
Primary Key
• In order to be sure that each
record can be found easily and to
prevent more than one copy of
the same record being kept, each
record includes a PRIMARY KEY
field.
• Each primary key field in the table
is unique.
The primary key can be a
field that is already used,
provided it is unique, for
example the ISBN in the
book table
Identifying The Objects On The
Design Window
Databases in Access 2010 are composed
of four objects:
Tables,
Queries, (Query by example)
Forms,
Reports.
Together, these objects allow you to:
1. Enter
2.Store,
3.analyze,
4.compile your data as you wish.
1. Tables
In Access, all data is stored in tables,
which put tables at the heart of any
database.
Tables are organized into:
 vertical columns
and horizontal rows.
2. Form
Forms are used for:
1. Entering,
2. Modifying, and
3. Viewing records.
3. Queries/Query
Queries are a way of searching for and compiling
data from one or more tables.
Running a query is like asking a detailed question
of your database.
When you build a query in Access, you are
defining specific search conditions to find exactly
the data you want.
4. Reports
Reports offer you the
ability to present
your data in print.
Reports are useful,
because they allow you
to present components
of your database in an
easy-to-read format.
Practical Use of
Database
As a Cambridge IGCSE Computer Science student
you need to be able to do the
following:
• define a single-table database from given data
storage requirements
• choose a suitable primary key for a database table
• perform a query-by-example from given search
criteria.
Defining a database
To create the Grade 11 database, open Access, select
the Blank database
template.
Steps
1. Blank database and type the filename Grade 11 and
click the Create button.
2. Creating the Grade 11 database Select the table design view
3. Name the table Grade 11.
4. Set up the fields to match the data
collection form and include the primary
key. Each field will require a
meaningful name and a data type must
be selected.
5. Access also has other data types
that will be useful: Date/Time and
Currency.
Access allows validation checks to be built in
for each field, for example the gender field:
Query-By-Example (QBE)
Download