0% found this document useful (0 votes)
16 views

Database Management 1

The document discusses various topics related to databases including: 1. Designing and creating a database. 2. Data entry, forms, queries, and reports in a database. 3. Types of databases, benefits of databases, database models, and features of a database.

Uploaded by

iannguluwe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Database Management 1

The document discusses various topics related to databases including: 1. Designing and creating a database. 2. Data entry, forms, queries, and reports in a database. 3. Types of databases, benefits of databases, database models, and features of a database.

Uploaded by

iannguluwe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

6.

Designing and creating a database


USING 7. Data entry in a database
DATABASES 8. Creating data forms

Success Criteria: 9. Creating a query


1. Definition of databases 10.Generating database reports
2. Types of Databases 11.Sorting and grouping
3. Benefits of Databases
compiled
4. Database models by
Prof MKB Timothee
5. Features of a Database
Managing data as a resource is an important task in any
organisation today.
It is so because data within an organisation and its
environment forms are parts of the strategic ,
operational management and decision making.
In order to enhance and easy storage as well as retrieval
of data , we use databases.

So what is a

‘’ a Database’’??
Definition of a Database:
a database is a collection of related data items
organised so as to provide consistent and
controlled access to the items.

Uses of Databases:
 to provide consistent and controlled access to the data

to enhance convenient for easy storage and retrieval


Types of Databases
There are two(2) main types of databases
- Manual
- Electronic
Manual Database: consists of a collection of repository files and folders,
each properly tagged and kept in proper sequence in a cabinet.

Let say in a school the admission office stores all students files identified
using student admission numbers such as 201/2014,

However, as organisation data and information grows manual


organisation becomes difficult and time consuming resulting to the
following problems:
Redundancy: - unnecessary duplication of data in multiple files.

Lack of flexibility: - it is difficult to search for a requested file of


record.

Lack of integrity: - poor storage and maintenance of data may


lead to unreliable and misleading reports

Lack of data sharing: - Data or information in different manual


files may not be available to other users.
Electronic Database
Refers to the use of electronic devices such as computers to
store and organise files for easy access.

Advantages of Electronic Database:

- The operating system and electronic database systems


provide users with tools for easy storage and access of data
and information.
Database Management Systems (DBMS)
These are software used to create and manipulate database.
The DBMS provides tools for creating , storing , searching and
manipulating databases.

Examples: -
- Access
- OpenOffice Database
- Microsoft SQL server
- Oracle
- FoxPro
- Dbase IV
- Lotus Approach
- Oracle’s MySQL Server.
Benefits of Using DBMS
1. Allow authorised users to add or delete records

2. Allow users to update of modify existing records

3. Organise files and records for easy access , retrieval and sharing

4. Interface between database files and other application programs

5. Ensure security and integrity of data by safeguarding it against


unauthorised access and modification

6. Keep statistics of data items in a database


Common Features of DBMS
Database Management software have in common:
- Tables

- Queries

- Forms

- Reports

and

- memos
Database Models
A Database Model is a logical structure that determines how data is
stored , organised, and manipulated by DBMS.

Types of Database Models:


o Hierarchical
o Network
o Relational
o Object/relational
And
o object/table oriented model
HIERARCHICAL MODEL
Here data is organised in hierarchical structure like this one
below:
Root(main data item)
Path

Level 2 (data item)

Hierarchical model is rarely used in computer database systems, hence obsolete.


NETWORK MODEL
The network model allows each record to have multiple parents
and child records.
This forms network structure such as this one:
Canteen

Customers Supliers

Transactions

In network models, access to a record can be through multiple


paths and from any record.
This types of record structure is what is referred to as ‘many to many
relationship.
RELATIONAL MODEL
Is the most popular and widely implemented model in
most DBMS. This is why you are likely to seen that in
most database references RDBMS as the default.
In RDBMS , data is organised into records that are stored
in related tables or files.
A table is a collection of related records each record
contains related fields.
It called relational because two table can be linked
together such that a record from one table references to a
record or records in another table.
Example:
Customer Number Name Telephone Number
900 Patricia Tsekandiana 02078907
230 Amos Onani 0667896
450 Bat Kabelo 0456000

Customer ID Order ID Date Amount(K)


900 380 2/3/2014 90,000
450 811 2/5/2014 5,000
450 234 3/5/2014 13,000
450 567 3/6/2014 13,000
Notice that the orders table shows that customer number 450
(Bat Kabelo) has three orders in the orders tables
OBJECT –RELATIONAL MODEL
Is a shift from structured programming.
In object – oriented programming an object is a representation
of real world using state and behaviour (data and operating
/functions).
This shift raised need for a database model that stores and
manipulate objects.

Therefore,
object-relational is an evolutionary hybrid model that has
capabilities to handle both relational and object-oriented
storage and manipulation of data.
Object- oriented model
This model purely support storage , access and manipulation of
objects.
Although, currently not popular in the market, OODBMS provides
unification of application and database development.

This is different from current approaches in DBMS where a separate


application
e.g V. basic application has to be developed to access a database.
DATABASE STRUCTURE
For easy storage, retrieval and manipulation, RDBMS organise data into
a structure called ‘’ a Schema’’.
A Schema is an organisational structure made up of fields at the lowest
level and database at the highest level.
o Field : is a set of characters or logical combination of characters that
defines a single data value.
o Record: is a collection of related fields that represent an single data
item(entity).
o Table: is equivalent to a file and contains a set of related records.
o Database: is a collection related tables and each tables consists of
related records made up of field.
Creating a Database
When designing a database, consider the following:
1. Estimate the amount of data expected to be stored in the database.
2. Study the requirements of the user carefully in order to define all the inputs,
outputs and relationships required to create a database.
3. Design a prototype database preferably on a paper to determine fields and
tables required to implement the database.
4. Normalise the fields into separate tables to allow flexibility in database
manipulation.
5. Identify a field in each table that will used to identify each record uniquely.
Such field is known as a primary key field.
6. Give the most important fields first priority when designing a table structure.
7. Design sample data forms and reports needed for interaction between the
user and the database system.
Using Microsoft Access 2013

Follow all the steps as we do in word processing .

Access window will open and click the create button

Choose the blank database which is set as default.


Creating a Database Table
1. Click the icon representing a Table in the task pane located on the left top
2. On the Home tab, click the view tab and the click Design view. Save as dialog
box pops up that require you to save the table. Save the table as Register.
3. Using the table design grid displayed, enter unique name for each field.
A field must start with a letter and can be up to 64 characters including letters,
numbers, spaces and punctuations.
4. Choose appropriate data type before adding the next field. By default Access
2013 inserts short text as default data type.
5. To save changes, click the save button on the standard toolbard or save on the
file tab.
6. Access will prompt whether you want to create a primary Key . Click yes.
Setting Primary Key and Indexes
 An index is a key used to speed up searching and sorting records in a
table
While
 A primary is index that uniquely identifies each record stored in a
table.
 A primary Key prevents the user from making duplicate entries into a
table.
 Access uses the primary key to order , and control redundancy.
 Once a field is set as primary key, the datasheet is automatically
indexed or sorted using the primary key.

To set a primary key do the following:


1. Open the table in design view then click the design tab
2. Select the field you wish to set as the primary key by clicking in the row
reader on the left of the field Name (show the sample)
3. Click set primary key button on the design toolbar. The field, in this case
the Admission Numbers is set the primary key.
To set another field as an index or secondary key proceed as follow:
1. Open the table in design view.
2. On Design tab, click Indexes button in show/Hide group. The indexes
resister is displayed on the screen (open sample)
3. In the field Name column, select the field you wish to set as secondary
index other than the primary key
4. In the Index Name column, type the name of the index
5. In the sort order column, select Ascending or Descending then close the
window.
Field Data Types Field Properties
Short text Field size
Long text Format
Number Precision
Calculated Decimal places
Date/time Input Mask
Currency Caption
AutoNumber Default Value
Validating Rule
Yes/No
Validation Text
OLE Object
Required
Attachment
Allow Zero Length
Data Entry and Manipulation
Manipulating Records:
Manipulating a database is the process of appending (adding) new
records, editing, modifying the table structure.
Appending records:
Creating Queries
A query means “Question”. In a database context, the term query refers to a
question used to instruct a database to retrieve data or perform operations
such as insertion, update and deletion of data in a table.

The language used to query a database on behalf of the user is referred to as


“structured Query Language”.(SQL)

Types of queries:
Select
and
action queries.
Simply we can say that there exist 2 type of query.
Description
Type Description
 Is the most common type of query used for searching and
Select Query retrieving data from one or more tables.
 A select query lets the user specify the search criteria and
records that meet the criteria are displayed in a query data
sheet called dynaset.
Are queries used to make changes to records in a table. An action
query may be used to delete, update, add a group of records
from one table to another or create a table form from another
table.
Action Query
Types of Action Queries:
1. Update query: - updates data in a table
2. Append query: - adds data in a table from one or more tables.
3. Make table query: - creates a new table from a dynaset.
4. Delete Query: - Deletes specified records from one or more
tables.
Creating Queries using Wizard
The following are the steps to under take when creating a query using
wizard:
1. Ensure that the database you want to create a query for is open

2. Click the create tab, then query wizard command.

3. In the New query dialog box, choose simple query wizard

4. Under Tables/Queries, click the table that has the data

5. Follow the wizard’s prompt until the query is fully created.


Create Queries in Design View
Steps
1. Click the query tab on the objects pane panel

2. Click the New button and then select Design View in the dialog box that
appears.

3. Select the table you want to create the query from

4. Drag each field or selected fields from the table shown on the upper part
of the design and into the field row on the lower part.
The following are important sections of a query design grid that are used to
specify the fields and criteria to be used to display the dynaset:
- Field row: - fields from a table to be used are arranged in this row. Each field
should occupy its column.
- Table row: – indicates the table providing the fields.
- Sort row: - by clicking the down arrow in the sort row, you can specify the sort
order ; that is ascending or descending or no sort.
- Show row:- by clicking the show row, you specify whether to display the field
in the query results. When the box is not checked, the field will not be
displayed.
- Criteria row: - is where you enter a condition or expression that will be used
by the query to display specific records.
- Or row: - used to specify an alternative condition. If for example you want to
display records of all employees from branches located in Lilongwe or
Blantyre, type Lilongwe in the criteria, and Blantyre in OR
Specifying query Criteria
In order to search for a particular set of records, you have to enter a
conditional statement or statements in the criteria row.
For example you have a table called employees with one of the fields salary,
you can display all the employees earning more than 5,000 by typing >5000
in the criteria row in the salary column.
To define criteria, use either relation or logical operators.
Relational operators include: less than, (<), greater than (>), greater or equal
to (>=), less than or equal to (<=) , not equal (<>), and equal to (=).

Logical expression: AND, OR and NOT


AND OR NOT
 To display values in a specific  If you wish to get either one • If you want to list all records
range. or both values, if for except those that you don’t want
to see, use NOT. For example if
example you wish to get you type NOT6000 in the salary
 For example , to display employees or both towns column of the employees table, all
records of employees with use from branches located in employees records will be
salaries above 4000 but less Zomba and Limbe, use an displayed except those with their
that 6000 from employees expression like “Zomba” OR salary as 6000.
• To display records for field name
table, type >4000AND<6000 “Limbe”. you are not sure of, but can at
on the criteria row in the least remember a few characters,
salary column.  If you want to display data in use operator LIKE and the
a particular range, use the wildcards.
 All the employees who word between. • Wildcards: are special symbols
(mostly asterisk and question
meet this condition will be marks) used in place of other
displayed.  For example: instead og characters.
typing >4000AND<6000, • For example: to display all names
type between4000AND6000. starting with “Sm” followed by any
other character, type;LikeSm?.

You might also like