Database Management (1)
Database Management (1)
MANAGEMENT
By: S. Murray
What is a Database?
Alternate Key Any candidate field that was not used as the primary key.
Candidate Key It is a column or set of columns that can uniquely identify any record in a
table. The candidate key is a super key with no repeated attributes. If there is
only one candidate key, it becomes the primary key, if there are multiple
candidate keys, the designer must designate one as the primary key. Any
candidate key that is not the designated primary key is an alternate key.
Data Type Determines what kind of data can be entered as well as what operations the database can
perform with the data.
Entity A thing or object of importance about which data can be captured. E.g. People, places.
Form A database object that can be used for displaying, editing, searching and entering data.
Foreign Key One or more columns in a table intended to contain only values that match the related
primary key in a referenced table. It is a field in one table and a primary key in another.
Object Any component that makes up a database. Anything which we make from create
command is known as Database Object, i.e. tables, queries, reports, forms.
Database Concepts
Terms Definition
Primary Key A field whose values are unique so it can be used to access each record individually.
Query Asking specific questions about the data in the database. Used to retrieve data from the
database and the user can be selective with how much data that is to be returned.
Report A document produced by data in a database. Usually formatted results from tables and
queries.
Secondary Key A key that has not been selected as the primary key. A table can have can have many
secondary keys.
Table Consists of a collection of records about a specific topic.
◦ Passwords can be set to allow access only to ◦ The database file can become corrupt or
those with permission to use the database. infected by a computer virus. This can lead to
the file not working properly or not at all.
Advantages & Disadvantages of a Database
Advantages Disadvantages
◦ A database file can be automatically linked to ◦ Making a backup copy of the database is
others essential.
◦ Data can be imported and exported to other ◦ There is often a limit to the size of a database
programs. file.
◦ Some databases can be complicated to use
◦ Some databases require much time to be spent
on staff training, which can be costly.
◦ Data stored about people can be incorrect.
Creating a Database
Before creating a database and tables, the user must determine:
◦Field name – identifies the data stored in a field.
◦Filed type – also called data type, which tells the database program
what kind of data goes in the field such as text.
◦Field Length – determines the size of each field in a table.
◦Field description – allows you to describe the purpose of the field.
◦Field properties – includes checks to ensure that the data is valid.
Data Types
Data Types Type of data
Text Letters, numbers and a combination of both. Numbers that don’t require calculations.
Decimal Places Displays a set number of decimal places in Number and Currency fields only.
Input Mask Sets a pattern that determines the input format of data, such as the hyphens in a
telephone number.
Caption Specifies a label for the field that appears in the table and on forms and reports.
Required Specifies that the field cannot be left empty when data is entered into a record.
Allow zero Determines whether or not a field can be complete if it contains no data.
Indexed Speeds up retrieval of data in a field. All primary keys are automatically indexed.
◦ This type of relationship takes place when one ◦ This type of relationship takes place when one
record from the primary table matches another record from the primary table matches many
record the related table. records from the other related table.
Creating Relationships
◦ Open the relationships window in the Database
Tools.
◦ Select the tables from the Show Tables dialogue.
◦ Drag Primary key (from the parent table) and release
over the foreign key (in the child table)
◦ Confirm options
When creating a relationship select:
◦ Enforce referential Integrity
◦ Cascade Update Related Fields
◦ Cascade Delete Related Fields
This ensures that the database maintains its integrity.
Querying a database
Query’s allow for meaningful data to be extracted from a database. Query’s may be used to:
◦ View data in a particular way
◦ To update a database
◦ To delete one or more records from the database
◦ As a source of records for reports
There are several types of queries; two of the most common being Select queries and Action
queries.
An action query is a query that makes changes to or moves many records in just one operation.
The changes made are irreversible. The four types of action queries are – Make table,
Append, Delete, Update
Querying a Database
◦ Go to Query Design area of the ribbon
◦ Create – Queries – Query Design
◦ Activate the Query design work area and add the
table(s) and or queries you need.
◦ Add the fields you want to show
◦ Indicate whether you want your data to be sorted
or grouped (Sort drop down)
◦ Type in the criteria that you want the system to
use to restrict the data.
◦ Run the Query and view the results, edit in the
Datasheet view if necessary.
◦ Save Query
Types of Queries
Make Table – An action query that creates a
Select Query
table from the data stipulated in the query
Action Queries
Update – Makes global changes to a group of
Append – Adds data to an existing table
records in one or more existing tables.
Action Queries
Delete Query - deletes a group of
records from one or more tables
Sorting and Filtering
◦ Sorting and filtering allows you to view data
records in a table in different ways.
◦ Sorting temporarily reorders the data in the
database file.
◦ Filtering selects the specific records the user
wants to be displayed.
Reports
◦ A database report is the formatted result of database queries and contains useful data for
decision-making and analysis.
◦ A report is an effective way to present your data in a printed format, because you have control over
appearance and size of data and headings.
◦ A report lets you specify:
◦ The fields to display.
◦ Which table(s) and or query (ies) must be used to supply the fields required.
◦ The order in which the records should be displayed.
◦ How records should be grouped.
◦ What statistics you want the database to calculate from the records (e.g. number of records, average).
Creating Reports
◦ Activate the report wizard
◦ Select the fields you want on your report
◦ Click ‘Next’
◦ Select Grouping levels for the report (if necessary)
◦ Click ‘Next’
◦ Select fields for sorting (optional)
◦ Click ‘Next’
◦ Retain defaults for the layout/Orientation of the report
(change if necessary)
◦ Click ‘Next’
◦ Type the title of your Report – then click ‘Finish’
◦ Check to ensure that your report is as you desire.
Creating Reports
Grouping Levels Layout and Orientation
Creating Reports
Sorting Title of Report
Creating Forms
◦ A form is a database object that you can use to
enter, edit, or display data from a table or a
query.
To create a form:
◦ Activate the Form wizard
◦ Click ‘Next’
◦ Select the fields you want on your Form
◦ Click ‘Next’
◦ Select layout
◦ Click ‘Next’
◦ Type the title of your Form – then click ‘Finish’
◦ Check to ensure that your form is as you desire.
Forms
Form Layouts Title of Form
References
◦ Campbell, H. (2014). Information technology for CSEC examinations:
Howard Campbell. Macmillan.
◦ Gay, G., & Blades, R. (2019). Oxford information technology for CSEC:
Third Edition.
◦ Microsoft Press. (2002). Microsoft computer dictionary (5th ed.). Microsoft.