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

Advanced Database Management System

This document discusses advanced database management systems and provides information about indexes. It defines row IDs and explains that they are unique identifiers for records in tables. It also describes the different types of indexes that can be created, including simple, composite, duplicate and unique indexes. The document outlines how to create indexes on single or multiple columns and how to destroy indexes. It notes that multiple indexes can improve query performance but also slow down data modification operations.

Uploaded by

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

Advanced Database Management System

This document discusses advanced database management systems and provides information about indexes. It defines row IDs and explains that they are unique identifiers for records in tables. It also describes the different types of indexes that can be created, including simple, composite, duplicate and unique indexes. The document outlines how to create indexes on single or multiple columns and how to destroy indexes. It notes that multiple indexes can improve query performance but also slow down data modification operations.

Uploaded by

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

ADVANCED DATABASE MANAGEMENT SYSTEM

DIPLOMA IN COMPUTER ENGINEERING (GTU)


SEMESTER: 4
SUBJECT CODE: 3340701

Unit 1: Lecture 9

EXPLAINATION & VOICE BY:


Mr. NIKUL JAYSWAL
Lecturer in Computer Engineering
Shri K. J. Polytechnic, Bharuch
RECAP
•Concept of Indexes.
TODAY’S LECTURE OUTCOMES
• RowID concept
• Types of Indexes.
• Creating an Index.
• Destroying Index.
ROW ID
▪ "A RowID is a unique identifier for each record inserted in any table.“
▪ A RowID is a hexadecimal string and contains logical address of the
location in a database where a particular record is stored.
▪ For each and every record, inserted in any table, Oracle assigns a unique
id.
▪ This id can be used to create indexes.
▪ Oracle provides a pseudo column, named ROWID, to retrieve RowID
associated with records in any table.
ROW ID
▪ ROWID can be used like any other column in SELECT statement as well as
with WHERE clause.
▪The format for RowID can be any of the following:
(1) Extended: This format is an 18 digit string.
000000FFFBBBBBBRRR.
This format is used by Oracle8i and higher versions.
(2) Restricted: This format is a 15 digit string, separated with dots.
BBBBBBBB.RRRR.FFFF.
This format is used by Oracle7 and earlier releases.
ROW ID
▪Meaning of Characters:
CHARACTER MEANING
OOOO…. Data object number identifying the database segment.
FFFF…. Data file number identifying a file containing data.
BBBB… Block number in a data file identifying block containing a record.
RRRR… Record number in the block.

▪Example:
select rowid, actno, cname from deposit;
TYPES OF INDEXES: DUPLICATE V/S UNIQUE
▪An Index, that allows duplicate values for indexed column, is called
Duplicate Index.
▪An Index, that does not allow duplicate values for indexed column, is
called a Unique Index.
▪A Unique Index is created automatically for a table, if it contains a
primary key or unique key.
▪For a Customer table, it is not possible to create a unique index for column
city, as it contains duplicate values.
▪Unique indexes are generally created on Primary keys and unique keys.
TYPES OF INDEXES: SIMPLE V/S COMPOSITE
▪ An Index created on a single column of a table is called a
Simple Index.
▪ An Index created on more than one column is called a
Composite Index.
CREATING AN INDEX (SIMPLE INDEX)
▪Syntax:
create [unique] index index_name on table_name (column_name);
▪Example:
create index index_deposit on deposit(actno);
▪If UNIQUE option is provided while creating an index, it will be considered
as a Unique Index.
▪By default, indexes are created as Duplicate Indexes.
CREATING AN INDEX (COMPOSITE INDEX)
▪Syntax:
create [unique] index index_name on table_name
(column_name1, column_name2,….,);
▪Example:
create index index_deposit2 on deposit(cname,bname);
CREATING AN INDEX (COMPOSITE INDEX)
▪Here, second column will be considered only when the first column contains
duplicate data.
▪In such case, sorting is performed based on data of the second column.
▪Similarly, if index is created on more than two columns, other columns will
be considered only the previous all columns contain duplicate data.
MULTIPLE INDEXES ON A TABLE
▪It is possible for a table to have more than one index on different columns.
▪A table can have any number of indexes.
▪If a query, fired on a table, does not contain WHERE or ORDER BY clause,
no index is used for that query.
▪An Index is used when WHERE or ORDER BY clause is specified in query,
and they contain a column on which an Index is created.
▪If a table contains more than one index, a particular index is selected
based on the column specified in WHERE or ORDER BY clause.
MULTIPLE INDEXES ON A TABLE
▪Multiple indexes on tables must be created carefully.
▪Too many indexes may degrade the overall performance.
▪The reason behind this is, whenever a record in table is inserted, deleted
or updated, indexes created on that table also need to be updated.
▪Sorting of contents of Index is required each time such operation is
performed.
▪If there are too many indexes, this processing may take a longer time
resulting in slower system.
▪Thus, indexes speed up the data retrieval, but they slow down the other
operations such as insert, update or delete.
DESTROYING AN INDEX
▪Syntax:
drop index index_name ;
▪Example:
drop index index_deposit ;
THANK YOU…..
Appear for Quiz Assignment in Microsoft Teams.
Note: It is mandatory for all students to appear for quiz assignment, it will be
considered as present in lecture and marks will be count as progressive
assessment.
If you do not appear than it will be considered as Absent in class and marks
will be 0 (zero).

You might also like