You are on page 1of 26

CST121

DATABASE
MANAGEMENT
Lecture outline
• Introduction to Microsoft Access

• Types of databases

• Creating databases tables

2
Introduction to Database
• A database is an organized collection of structured information or data, typically stored
electronically in a computer system.

• Database store a large variety of data such as usernames, email addresses, encrypted
password, virtually any data.
• A database is usually controlled by a database management system (DBMS).
• Database Management Systems is a software that is used to manage database.

• Database management systems are software that handles the storage, retrieval and updating
of data.
3
Types of databases
• Flat file database

• Non-relational database &

• Relational database

• Flat file database: Is a simple database in which similar strings of data are stored as
records in a table

• They are generally in plain-text form, where each line holds only one record.

• Each field record are separated with delimiters such as commas and tabs

• Flat files are simple, flexible and records follow a uniform format 4
Types of databases (Cont.)
• There are no structures for indexing or recognizing relationships between records.

• Example of a flat file is a name and address list with the fields Name, Address, and Phone
Number e.g. Microsoft Excel.

• A list of names, addresses and phone numbers written by hand on a sheet of paper is a flat-
file database.

• Non-Relational Databases can be used to store image meta data. This is because these
images does not require large structures or it requires minimal structures and can be stored
as a key value pair.
5
Types of databases (Cont.)
• Some examples of NoSQL database management systems are MongoDB, Couchbase,
Amazon DynamoDB etc.

• Relational Database makes use of multiple tables and relations. This is a language that
makes it possible to easily manage data.
• Relational databases may have three separate tables (use cases)
• Customer’s Information
• Billing Information
• Images that the users have uploaded.

6
Types of databases (Cont.)
• With a relational database, one SQL command can pull out other information
about a product or an individual, this can not be achieved using a Non-
Relational database

• Examples of Relational database management systems are: PostgreSQL, MySQL


etc.
• Database management system (DBMS) is a software used for creating,
modifying, accessing and presenting the data in a database.

7
Advantages of Computer Database over Flat files
• Massive Storage: the largest computer database can fit on a hard disk, but a
paper database might take a roomful of file cabinets

• Fast Retrieval: Searching for a record in a computer database is fast and easy.

• Reporting: Report help to understand and analyse data, such as showing a list
of customers who earn a certain amount of money Or individuals who come
from a particular state of origin

8
Importance of Database
• Data integrity:This ensures the correctness of data especially when changes are made.

• Security: This ensures that access to the data is restricted to those that actually have the
right to access the database

• Share ability: It makes information readily available to other users who require it.

• Data redundancy: Using a database ensures that there is little or no data duplication.

9
Basic Database Concepts
• Table: Consist of a set of related records.

• Record: This is a collection of data about an individual item.

• Field: A single item of data common to all records Name: Peter Johnson
10
Basic Database Concepts (Cont.)
Fields

Records

11
Microsoft Access
• Microsoft Access performs the following basic tasks.
• Creates tables and their relationships.
• Enters and modifies data
• Creates query to retrieve information.
• Creates forms and reports.

• Access 2007 and above databases end with .accdb file extension – for example,
sales.accdb

• Databases made in older versions of Access have the file extension .mdb
12
Starting Microsoft Access
• Load the application: select blank database, save it in a folder or select from the
list of templates from the Internet.

13
Exploring the Microsoft Access Window

14
Microsoft Access
• Tables: Tables are used for data entry and edit. In a table, each record is displayed as
a row and each field is displayed as a column.
• Queries: You use queries to extract records that meet specific selection criteria e.g.
all students in 100 level. When you run a query, the results are arranged in columns
and rows like a table.
• Forms: You can use forms to provide an alternative to tables for data entry and
viewing records.
• Report: They can be used to produce various printed outputs from data in your
database. 15
Working with Tables
• A table is made up of fields and records.
• Tables can be created using two basic methods:
• Data sheet view.
• Design view.

• In Datasheet view, a table is similar in appearance to an Excel worksheet in that


data is stored in rows (records) and columns (fields).
• The first row contains column headers (field names).
• The table is often simply referred to as a datasheet.
16
Working with Tables (Cont.)

17
Working with Tables (Cont.)
• Click the Create tab on the Ribbon
• In the Tables group, click the Table button
• Accept the default ID primary key field with the AutoNumber data type, or rename the
field and change its data type, if necessary
• Double-click the Add New Field column heading, and then type the field name.
• Press the Tab key or the Enter key

18
Creating Tables in Design View
• Creating a table in Design view, gives one more control over the database design.

• First create the new table’s structure in Design view, and then switch to Datasheet
view to enter data.

• In Design view, the Object window consists of two panes.

• The Field Entry pane, located at the top of the window, is used to enter each field’s
name, the data type and description.

• The Field Properties pane, located at the bottom of the window, is used to specify
the field’s properties.
19
Creating Tables in Design View (Cont.)

20
Identifying fields in a Table
• Primary Key: This is a field that helps to identify each row uniquely in a table.
It ensures that there are no duplicate rows.

• Foreign Key: This is the primary key of one table appearing on another table
for the purpose of creating a relationship.

• Composite Key: A composite key is a primary key consisting of more than


one key.

21
Identifying fields in a Table (Cont.)
Student_Info table
Primary key Matric No Name Program Level Sex
21BC028838 Dominion English 100 M
21AH028875 Divine International Relations 100 M
Gift Policy and Strategic 100
Foreign Key 21AK028949 Studies F
Grade table
S/N Matric No Grade honours Program Level Sex
1 21BC028838 First class English 400 M
2 21AH028875 Second class upper International Relations 400 M
3 21AK028949 Second class upper Policy and Strategic Studies 400 F

22
Identifying fields in a Table (Cont.)
Customer ID Date Item ID Quantity Cost
C20 24/04/22 89 5 #250
C40 25/04/22 45 6 #600
C29 26/04/22 67 3 #450

Composite Key

23
Access Data Types
Data Type Usage
Short Text Text is the default data type. Text fields accept either text or
numeric data, including delimited lists of items (up to 255
characters).

Long Text large amounts of text and numeric data can be entered
into the field (up to 65,538 characters). If the field is set
to support rich text formatting, formatting types in MS
Word can be applied.
24
Access Data Types (Cont.)
Data type Usage
Number Only numbers can be entered in this type of field, and
calculations can be performed on the values in a Number
field.

Date/Time Only dates and times can be entered in this type of field.

Currency Only currency values can be entered in this type of field. By


default, Access applies the currency symbol e.g. $, ¥, £ etc.
specified in your Windows regional settings.
25
Access Data Types (Cont.)
Data type Usage
AutoNumber Data cannot be enter or changed in this type of field. Access
increments the values in an AutoNumber field whenever you
add a new record to a table.
Yes/No When a field is set to this data type, Access displays either a check
box or a drop-‐down list, depending on how the field was
formatted.

26

You might also like