Sei sulla pagina 1di 23

Chapter 9

ICOS111B

ICOS111B
Sorting
&
Sorting techniques

ICOS111B
Sorting
Sorting is the process of putting data in
alphabetical or numeric order using one key
field or a concatenation of two or more fields.

Data are sorted according to the primary key.


Once data are in order, they can be accessed by
various means, including the sequential search
and the binary search

ICOS111B
Sorting
All sorting techniques require a comparison of
two data items with a possibility of a switch. If
the sort is in ascending order, the comparison
would be to see if the primary key of data 1 is
larger than the primary key of data 2. If it is,
then data 1 is switched with data 2, and if not,
they are left in the same position. The
comparisons take place until data are in the
required order.
ICOS111B
Selection Exchange Sort
The theory is to find the smallest value of the
remaining values and switch with the value
found in the first position of the remaining
elements.

ICOS111B
Selection Exchange Sort

ICOS111B
Bubble Sort
The theory of the bubble sort is to compare
each element with the next element. If the
element is larger than the next element, the
elements are switched. If not, they remain the
same. After the first pass, the largest element
has “bubbled” its way to the bottom.

ICOS111B
Bubble Sort

ICOS111B
Bubble Sort
A flag is set during each pass. If a switch has
been made, another pass is made; if a switch
has not been made, then data are in order and
no more passes are made.

ICOS111B
Shell Sort
The theory of the shell sort is to compare each
element with another element in the data set
using a gap to separate the elements. The gap
during the first pass is the number of elements
divided by 2. The truncated value is used.

ICOS111B
Shell Sort

ICOS111B
DBMS

ICOS111B
DBMS
Database Management Systems (DBMS)
software is a data organizer. The primary
function of a DBMS is to store large quantities of
data, organize data, protect data integrity, and
secure the data.

Structured Query Language (SQL) is rapidly


becoming the standard language for accessing
relational data industry wide.
ICOS111B
BENEFITS OF DBMS
• Centralization of data
• Increased reliability of data
• Decrease in redundancy of data.
• Simultaneous access of data.
• Increased security of data.
• Increased performance of data access.
• Increased data integrity.

ICOS111B
Database terminology
Database is developed to store data that needs
to be retrieved at a later date.

Entities or Records are Items in the database


that have one or more data values attached to
them, such as an inventory item, an employee, a
place, a thing, and so on.

ICOS111B
Database terminology
Attributes or fields are data items that are
required to be associated with the entity
For example, the attributes of a client entity
might be last name, first name, street address,
city, state, zip code, sales rep, and so forth.

ICOS111B
Database terminology
A table is a group of related entities or records
A record is a group of related attributes or fields
A primary key field contains unique data, that
is, data that will not be repeated in the same
field of another record.
Secondary keys are not necessarily unique. They
are primarily used to search for a specific record
when you do not know the primary key

ICOS111B
Database terminology

ICOS111B
Database terminology
A foreign key is a relational field to another
table. The foreign key is a primary key in another
table and determines the relationship between
the tables.
Queries are the way to select fields and/or
records to be processed. The result of a query is
a query table

ICOS111B
ICOS111B
Database
terminology

ICOS111B
Database terminology
Forms allow the user to see all or some of the
fields of a record on the monitor. The table is
transversed through the use of buttons to go to
the next, the previous, the last, or the first
record. The form must be designed well to
ensure the end user’s productivity. Fields should
be located on the form for easy reading and
entering of data.

ICOS111B
Database terminology
Reports are printed documents of the records in
a specific database or query table. You may
choose any or all of the fields to be included in
your report.

ICOS111B

Potrebbero piacerti anche