Lecture 11

You might also like

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

Lesson 11: Database system software (DBMS)

11.1. Introduction
Every modern-day business has data which requires some organized method or mechanism for
maintaining and retrieving the data. Organizations may be interested in keeping data about
entities such as employee, departments, purchases, supplies e.t.c. Related data is kept in tabular
format in tables called relations. Such tables have rows and columns. Each column of a table is
referred to as a field. Each row of the table is referred to as a record. A record contains
information about a given entity. A database is therefore a collection of one or more related
tables created using database management system software. Examples of database management
system software are Microsoft ®Access, Microsoft ® SQL server, Oracle, DB2 etc.

11.2. Lesson objectives


By the end of this lesson the learner will be able to:

Identify and explain functions of a database management system.

Given a case, identify entities and attributes

Design a simple database

Create a simple database

11.3. Lesson outline


This lesson is organized as follows:
11.1. Introduction
11.2. Lecture objectives
11.3. Lecture outline
11.4. Terminologies
11.5. Launching database software e.g. Ms Access
11.6. Features of DBMS
11.7. Create new database
11.8. Create tables
11.9. Link tables
11.10. Populate tables with records
11.11. Reflection questions, activity, exercises/quizzes
11.12. Summary
11.13. Suggestion for further reading

11.4. Terminologies

Data: Raw facts, text, graphics, images, sound, video segments

Database: A collection of one or more related tables created
using database management system software

Information: Data processed to be useful in decision making.

Primary key: A field used to identify a record uniquely.

Foreign key: A field used to link two tables.

Functions of DMBS

Database creation (storing data in a defined database).

Retrieval of data (query and reporting).

Update of data (Changing the contents of the database).
Example: Consider imaginary company, Bidii enterprises limited.
Bidii enterprises limited tracks records of its stock of products. These products are received from
various suppliers and their payments made to these suppliers. These products are usually sent to
different departments within the company after payments have been made. This is the work of
the store keeper.

Database design
To create a database we must have a plan. The process of coming up with this plan is called
database. Using the above case we can begin to design. We can now identify the following
business processes

Products are received from different suppliers

Payments are made for products

Products are sent to departments after payments.

Next we can identify key entities as



Product

Supplier

Payment

Department
We list all the possible attributes which we may need for the entities
identified. PRODUCT-(ProductID, ProductDescription, Quantity).

SUPPLIER-(SupplierID,SupplierName,Address,ProductID)

PAYMENT-(PaymentID,Amount,PaymentDate,ProductID)
DEPARTMENT-
(DepartmentID,DepartmentName,ProductID)
Notice primary keys are bold.

11.5. Launching Microsoft Access 2007



Click start

Point to All programs

Click Microsoft Access 2007

Microsoft Access 2007 program appear
11.6. The features of Microsoft Access 2007
Microsoft access window provides the features for creating database objects such
as tables, forms, reports e.t.c.

Home ribbon: Consists of views, clipboard, Font, rich text, records, sort & filter
and find categories.

Create ribbon: Consists of tables, forms, reports and other categories.

External data ribbon: Consists of import, export, collect data and sharePoint lists
categories.

Database tools ribbon: Consists of macro, show/hide, analyze, move data,


database tools and administer categories.

Datasheet ribbon: Consists of views, fields &columns, data type &formatting


and relationships categories.
11.7. Creating a new database
The dialog below displays after launching access program, to allow the user select
template to use.

Procedure

Click featuring under template categories

▪ Under new blank database, click blank database Specify the


name e.g. Inventory management system. Specify the
location of the new database Click create button.
The new database opens with a default table
11.8. Creating tables
The next important step is to create tables to this database. Using the design we
can create the following tables:
1. Product
2. Supplier
3. Payment
4. Department Creating product table
We need to know the attributes, attribute domain, primary key and data types for every table to
be used. We can refer to the physical data model. Procedure

Click table 1(default table)

Click data sheet tab

In the views category, click drop down and select Design. Access
will prompt you to specify the name of the table Under table name, type Product.

Under field Name type ProductID, under Data type, select text and finally under

description, type the description.
Repeat this procedure for other attributes.

Finally right click ProductID field and select Primary key.

Save the changes.
See the dialog below.

Creating supplier product table


We need to know the attributes, attribute domain, primary key and data
types for every table to be used. We can refer to the physical data model.
While the database is still open in the design view

Click create tab

Click table design

Under field Name type SupplierID, under Data type, select text and

finally under description, type the description.
Repeat this procedure for other attributes.

Most important, since this table will be connected to product specify

a foreign key which is actually a copy of ProductID.
Finally right click SupplierID field and select Primary key.

Save the table.

In the save dialog, under table name, type Supplier.

Click ok.See the diagram below

Creating payment table


We need to know the attributes, attribute domain, primary key and data
types for every table to be used. We can refer to the physical data model.
While the database is still open in the design view

Click create tab

Click table design

Under field Name type PaymentID, under Data type, select text

and finally under description, type the description.
Repeat this procedure for other attributes.

Most important, since this table will be connected to product specify

a foreign key which is actually a copy of ProductID.
Finally right click PaymentID field and select Primary key.

Save the table.

In the save dialog, under table name, type payment.

Click ok.See the diagram below

Creating Department table


We need to know the attributes, attribute domain, primary key and data types for
every table to be used. We can refer to the physical data model.

While the database is still open in the design view Click create tab

Click table design

Under field Name type DepartmentID, under Data type, select text and

finally under description, type the description.
Repeat this procedure for other attributes.

Most important, since this table will be connected to product specify
a foreign key which is actually a copy of ProductID.

Finally right click PaymentID field and select Primary key.

Save the table.

In the save dialog, under table name, type payment.

Click ok.See the diagram below

The next important thing is to link these four tables. This is a relational database.
11.9. Creating relationships
Step 1: Displaying tables in the relationship
window Close all the tables but NOT the
database.

Click Database tools

Click Relationships in the show/hide category

The show table dialog appear

Click tables tab

Click product table then click add.

Proceed until all the tables have been added in the relationship
window. Click close
Step 2: Linking the tables using foreign keys

Click the primary in the parent table then drag and drop it on its related

counterpart.
Edit relationship dialog appear.

Enforce referential integrity then click create

Proceed this way until all the tables are connected.
11.10. Populating tables
You can open the table in datasheet view in order to enter data or create forms to
enter data. To open a table in datasheet view, right click the table name and select
open. The table opens in data sheet view. Click and enter data. To move from one
cell to the next, click and type or press tab key to move to the required cell.
We can also create a form to enter data in the
above table To do this, click create button.

In the forms category, click form design.

The form opens in the design view.

Click design tab and then in the tools category, click add existing
button. Click the cross button next to field list pane.


Click and drag each field then drop in the detail section as
shown below.
To enter data using the form you need to open the form in form view. In the
view category, Click drop down arrow below view and select form view.

To move to next, previous or new record, use navigation bar at the bottom of the
form.

12.11. Reflection questions, activity, exercises/quizzes


[a]. For each of the tables created in this lesson create a form to enter data.
[b]. Create two tables below and and link
them. Lecturer

Column name Data type

LecturerNo Text

FirstName Text

Lastname Text
Course

Column name Data type

CourseNo Text

CourseName Text

LecturerNo Text

[c]. Describe any three functions of a database management system (DBMS).


[d]. Explain why databases are important to organizations.

11.12. Summary
In this lesson we have learnt how to design a simple database given a case, how to launch
Microsoft access and create database, tables and forms to enter data.

11.13. Suggestion for further reading


[1]. Silberschatz A. and et al (2001), Database System Concepts, McGraw-Hill.
[2]. Garcia-Molina H. and et al (2000), Database System: The complete Book, Prentice
Hall.
[3]. Elmasri R. and Navathe S(2000), Fundamentals of Database System, Addison
Wesley.
[4]. Conolly& Begg, Database System: a practical approach to design, implementation
and management, Prentice Hall.

You might also like