# Lesson Notes By Weeks and Term - Senior Secondary 3

Primary and secondary index, indexes using composite search keys

Term: 1st Term

Week: 5

Class: Senior Secondary School 3

Age: 17 years

Duration: 40 minutes of 2 periods each

Date:

Subject:      Data Processing

Topic:-       Primary and secondary index, indexes using composite search keys

SPECIFIC OBJECTIVES: At the end of the lesson, pupils should be able to

1. Define primary and secondary index
2. Define composite search keys or concatenated keys

INSTRUCTIONAL TECHNIQUES: Identification, explanation, questions and answers, demonstration, videos from source

INSTRUCTIONAL MATERIALS: Videos, loud speaker, pictures, Data Processing for senior Secondary Education by Hiit Plc, WAPB Computer Studies for Senior Secondary I by Adekunle et al, On-line Materials.

INSTRUCTIONAL PROCEDURES

PERIOD 1-2

 PRESENTATION TEACHER’S ACTIVITY STUDENT’S ACTIVITY STEP 1 INTRODUCTION The teacher reviews the previous lesson on the dense and sparse index Students pay attention STEP 2 EXPLANATION He defines primary and secondary index Students pay attention and participates STEP 3 DEMONSTRATION He also further explains composite search keys Students pay attention and participate STEP 4 NOTE TAKING The teacher writes a summarized note on the board The students copy the note in their books

NOTE

PRIMARY AND SECONDARY INDEX

PRIMARY INDEX

Primary index is an index defined on a primary key column(s) of a relation with unique constraint which guarantee that the field will not contain duplicate values and determine the order of how the records are physically stored on the disk. Note that this is also called clustered index.

This is an index on a set of fields that includes the primary key. Primary index contains records that are usually clustered. A primary index is created for the primary key of a table.

SECONDARY INDEX

Secondary index is an index defined on a non-key field which may contain duplicate values and as such does not determine the order of how the records are physically stored on a disk. It is also called non-clustered index.

For example, in student database, student ID is used to look up for a student as the key, however, one might want to look up for a student using Last Name by creating secondary index on that column.

Secondary index is an index that is not a primary index i.e. it does not include primary key. Secondary index can be created on non- key attribute. It contains duplicate data entries.

A Unique index is an index in which the search key contains some candidate key.

INDEXES USING COMPOSITE SEARCH KEYS

Composite search keys or concatenated keys are when the search key for an index contain several fields. For example, considering a collection of employee records with field name, age and salary stored in sorted order by name. if the search key is composite, an equality query is one in which each field in the search key is bound to a constant. For example, we can ask to retrieve all data entries with age = 20 and sal = 10, the hashed file organization supports only equality queries since a hash function identifies the bucket containing desired records only if a value is specified for each field in the search key.

The search key for an index can contain several fields, such keys are called Composite Search Keysor Concatenated Keys.

Range Queryis the one in which not all fields in the search key are bound to constants. For example, we can ask to retrieve all data entries with age = 20; this query implies that any value is acceptable for the sal _eld. Another example of a range query is when ask to retrieve all data entries with age < 30 and sal> 40

EVALUATION:    1. Explain primary and secondary index

1. Define composite search keys

CLASSWORK: As in evaluation

CONCLUSION: The teacher commends the students positively