0% found this document useful (0 votes)
11 views52 pages

Part 1 - Concept of Database Database

MS Access is a database program that allows users to create and manage databases, organizing information into tables, records, and fields. It offers advantages such as reduced data redundancy and improved data access, but also has limitations including complexity and high initial costs. Key database concepts include entities, attributes, primary keys, and data types, which are essential for structuring and managing data effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views52 pages

Part 1 - Concept of Database Database

MS Access is a database program that allows users to create and manage databases, organizing information into tables, records, and fields. It offers advantages such as reduced data redundancy and improved data access, but also has limitations including complexity and high initial costs. Key database concepts include entities, attributes, primary keys, and data types, which are essential for structuring and managing data effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 52

Database

Ms. Brown
MS Access as a database
program
►MS Access is a program that allows you
to create and manage databases.
A database is a place where you
can store information related to a
specific topic.
⚫Why Do we Need a
Database?
What is a Database?
⚫A database is a program that allows
you to store information related to a
specific topic in an organized way.
What is a Database Cont.?

⚫For example: a cellular phone, your


contact’s name and phone number
are stored in a table called Contacts.
⚫Data is organized into fields and
records. The key field contains an item
of data that is unique to each record in
the table.
ADVANTAGES vs LIMITATIONS

⚫Reduced data redundancy (increase speed of


accessing data);
⚫Reduced updating errors and increased
consistency (present multiple views of the
same data);
⚫Greater data integrity and independence
from applications programs (standardization);
ADVANTAGES vs LIMITATIONS Cont.

⚫Improved data access to users through use


of host and query languages (ad hoc
queries);
⚫Improved data security;
⚫Reduced data entry, storage, and retrieval
costs; and
⚫Facilitated development of new applications
Disadvantages of databases:
⚫Database systems are complex, difficult, and
time-consuming to design;
⚫Substantial hardware and software start-up
costs;
⚫Damage to database affects virtually all
applications programs;
Disadvantages of databases
Cont.
⚫Extensive conversion costs in moving from a
file-based system to a database system; and
⚫Initial training required for all programmers
and users.
Terms associated with
Database
⚫Record:
A record is a collection of related information
on a person or topic; e.g. Record No1 – Office
Staff, Record No 2 – Maintenance Staff,
Record No 3 - Security Staff….A record is
typed in a row. A record contains several
fields.
Terms associated with Database
Cont.
⚫Field
A field is a piece or category of
information on a person or topic; e.g.
Name, Address, Date of Birth..
Terms associated with Database
Cont.
⚫Table
A table is a database object that you use
to store data about a particular subject,
such as customers, employees or
products. It is a list of rows and columns
similar to those in spreadsheet.
A database

is made up of Tables

Records make up tables

Fields make up records


Database Terminologies To
Note.
• Entity
• Tuple (row)
• Attribute (field)
• Primary key
• Secondary key
• Composite key
• Foreign key
Entity
⚫An Entity is an item in the real world
that is represented in a database.

For example: a house or a car, an event


such as a house sale or car service, or a
concept such as a customer transaction
or order.
Attribute/Feild
⚫The individual properties of an entity
are called its attributes. An attribute is
represented by a field in a database.

For example: an entity house could have


the attributes ‘address’ and ‘year
built’.
Tuple/Row
⚫A tuple is a set of field names or a row
in the table.
The Primary Key
⚫A primary key is a field in a table which is
unique and enables you to identify every
record in that table.
Candidate Key
⚫A candidate key is a field that could possible
act as the primary key for the table.
Secondary Keys/ Alternative
Key
⚫Secondary keys is a candidate key that has not
been selected as the primary key.

For example: if the employee ID and employer


registration number are the candidate keys in a
table called ‘Employees’ and you choose Employer
ID as your primary key, then the employee
registration will become the secondary key.
Composite Key
⚫A composite key is a primary key that consist
of two or more fields together to form a
primary key.
⚫For example: a table called ‘Phone Directory’
has fields contain the phone number and
telephone country code of the phones used for
persons working for an international
Foreign Key
⚫A foreign key is a field (or fields)
that points to the primary key of
another table.
Data Type
⚫A data type is a field property that indicates
the kind of data that the field stores.
Data are stored in fields which make up
records. Each piece of data could be of any of
the following type:
⚫text
⚫alphanumeric
⚫numeric
⚫logical (Boolean)
⚫currency
⚫date/time
Data type Settings
Setting Type of data
Text Text or combination of text and numbers, as well as numbers that does
not require calculations, such as phone numbers

Memo Lengthy text or combinations of text and numbers


Number Numeric data used in mathematical calculation
Date/Time Data and Time values
Currency Currency values and numeric data used in mathematical calculations
involving data with one to four decimal places

Auto Number A unique sequential number assigned by Access whenever a new record
is added to a table.

Yes/No Yes and No values and fields that contain only one of two values
(Yes/No, True/False or On/Off).

Hyperlink Text or combination of text and numbers stored as text and used as a
link to another object or location.
Data type Settings Cont.
Setting Data Type
Alphanumeric Alphanumeric data can consist of a combination
of numbers, letters and symbols.

Logical Boolean To connect various pieces of information to find


exactly what you're looking for. They connect
your search words together to either narrow or
broaden your set of results.

Example:
second creation (title) AND Wilmut and Campbell
(author) AND 2000 (year)
Activity
⚫Create a new database file name Mailing List
⚫Set the primary key
⚫ID Data Type – Auto Numbers
⚫Save
⚫Close
CREATING A DATABASE
In order to launch/start database, do the
following:

START 🡪 All
Programs 🡪
Microsoft
Office 🡪 MS
Access 2003
Class Activity
⚫Create and save a new table named
Customer in the mailing List database using
the field properties below.
Field Name Field Type Field Size

Customer NO Text 5

First Name Text 12

Last Name Text 15

Address Text 20

Credit Limit Currency

Country Text 20
Enter the following information below in your database
Last name First name Customer Address Post code Credit limit
No
Hussey Earl 95501 21 King Street Kingston 20,000.00

Douglas Akeem 95503 1 Itsy Road Kingston 10 40,000.00

Castille Jasmine 95507 15 Elgin Road Kingston 17 65,000.00

Hosein Arturo 95504 25 Weaver Kingston 19 50,000.00


Close
Ventura Mike 95505 18 Keats Kingston 2 55,000.00
Crescent
Ridout Lesline 95506 80 Queens Kingston 3 60,000.00
Street
khan Rayadon 95509 99 Harbour Kingston 6 85,000.00
Glade
Murphy Sageena 95502 25 North Kingston 8 35,000.00
Avenue
Wilson Kate 95508 30 Monk Newcastle P.O 70,000.00
Street
Homework
Challenge!

Try to answer these questions:


⚫What is a database?
⚫What type of software program is Microsoft Excel?
⚫What type of software program is Microsoft Access?
⚫What are at least two differences between Access and
Excel?
Activity
⚫Add to your table Date and Time
⚫Enter a Telephone Number as a field in your
database.

⚫Populate your database.


Field Description

⚫A field description describes what is in


a field. This description is displayed in
the status bar when you select this field
on the form.
Field Size
⚫Field size determine the amount of
information (in characters) a field can
store. In access there are default field
sizes and a maximum limit for each data
type. The default field size of a text
data type is 50 characters.
Field Size Cont.

⚫For numbers data type, the field size


can be set as byte, integer, long
integer, single, double or decimal.
The default setting for numbers is long
integer.
Field Size Cont.
Data type Meaning

Byte Used to store integer values between 0 and 255 without decimal
places.
Integer Used to store integer values between -32,768 to 32,767 without
decimal places.
Long Integer Used to store integer values between approximately -2 million
and + 2 million without decimal places.

Decimal Stores numbers from -9.999…*1027 to +9.999…*1027 without


decimal places.
Single Stores numbers from -3.4 *10 38 to +3.4 *1038 with decimal
places.
double Stores numbers from -1.797 * 10308 to .797 *10308 with decimal
place.
Table Structures

⚫A table structure is a plan that sets the


names, data types and field sizes of a
field in a table.
⚫Entering data into a table
⚫Modifying records in a table
⚫Deleting from a table
Activity
⚫ A access, create a database named ‘Storm’ to store details
for the hurricane season 2017. in the database, create table
named Hurricanes’ with the following structure.
Field type Data type Field Description
size
Storm Name Text 20 Name of the storm
Origin Text 20 Place of origin of the
storm
Date of origin Date/Time Date storm was form
Category Number Long integer Category of the
storm (1 to 5)
Major Yes/No Whether the storm
Hurricane became major
hurricane or not.
⚫Enter the following records in the table.
Storm Origin Date of Categor Major
Name origin y Hurricane
Bertha Coast of 03/07/08 3 Yes
Africa
Dolly Caribbean 20/07/08 2 No
Sea
Gustav Windward 25/08/08 4 Yes
Islands
Hanna Leeward 28/05/07 2 No
Island
Kyle Caribbean 29/09/07 2 No
Sea
How to modify the table
structure
You might want to modify the structure of a
table for various reasons, such as:

⚫Add a new field


⚫Delete a field
⚫Change the field type/size/description of an
existing field.
Check Your Progress
1) (a) Modify the structure of the database table
‘Hurricane’ that you created earlier to
indicate a ‘Fatality’ with a Yes/No value as
the last field.
(b) Enter the following data in the Fatality field.
Storm Name Fatality
Bertha No
Dolly No
Gustav Yes
Hanna Yes
Kyle No

(c) Modify the structure of the database again to include a field


description for the field ‘Fatality’. The field description should
be
whether storm leads to death.
Sorting Database
⚫Sorting means putting records together in a
meaningful order such as ascending order (A-
Z or smallest to largest) or descending order
(Z-A largest to smallest. Sort can be don’t in a
table, using one field or more than one field.
Activity
⚫Open Exercise 1 and sort both First Name and
Last Name in descending order.
Linking Tables.
⚫A rational database can handle more than
one table at the same time.

You might also like