SlideShare a Scribd company logo
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Views
 A view in SQL terminology is a single table that is
derived from other tables
 These other tables can be base tables or
previously defined views.
 A view does not necessarily exist in physical
form; it is considered to be a virtual table, in
contrast to base tables, whose tuples are always
physically stored in the database
Slide 16- 2
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Example
Slide 16- 3
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
 A view is supposed to be always up-to-date; if we
modify the tuples in the base tables on which the
view is defined, the view must automatically
reflect these changes.
Slide 16- 4
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
 V1A: DROP VIEW WORKS_ON1;
Slide 16- 5
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Indexing Structures for Files and
Physical Database Design
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Indexing
 Indexing refers to a data structure technique that
is used for quickly retrieving entries from
database files using some attributes that have
been indexed.
 In database systems, indexing is comparable to
indexing in books.
Slide 16- 7
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Introduction
 Indexes used to speed up record retrieval in
response to certain search conditions
 Index structures provide secondary access paths
 Any field can be used to create an index
 Multiple indexes can be constructed
 Most indexes based on ordered files
Slide 17- 9
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 10
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 8- 11
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Primary Indexes
Slide 17- 12
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Primary Indexes
 Ordered file with two fields
 Primary key, K(i)
 Pointer to a disk block, P(i)
 One index entry in the index file for each block in
the data file
 Indexes may be dense or sparse
 Dense index has an index entry for every search
key value in the data file
 Sparse index has entries for only some search
values
Slide 17- 13
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Primary Indexes (cont’d.)
Slide 17-14
Figure 17.1 Primary index on the ordering key field of the file shown in Figure 16.7
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Dense Index
 Every search key value in the data file has an index record in the
dense index. It speeds up the search process. The total number of
records present in the index table and the main table are the same in
this case.
 It requires extra space to hold the index record. A pointer to the actual
record on the disk and the search key are both included in the index
records.
Slide 16- 16
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Sparse Index
 Only a few items in the data file have index records. Each and every
item points to a certain block. Rather than pointing to each item in the
main database, the index, in this case, points to the records that are
present in the main table that is in a gap.
Slide 16- 17
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Clustering Indexes
 Clustering field
 File records are physically ordered on a nonkey
field without a distinct value for each record
 Ordered file with two fields
 Same type as clustering field
 Disk block pointer
Slide 17- 18
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
Clustering Indexes (cont’d.)
Slide 17-19
Figure 17.2 A clustering index on the Dept_number ordering
nonkey field of an EMPLOYEE file

More Related Content

Similar to Indexing1.pptxnnnnñnnnnnnnnnnnnnnnnnnnnnn (19)

PPTX
Elmasri Navathe Primary Files database A
cscmalligawad
 
PPT
Chapter11 kkkkkkkkkkkkkkkkkkkkkkkk(1).ppt
kamalsmail1
 
PPT
Chapter06.ppt
yashodhaHR2
 
PPT
Database administration and management chapter 12
saniaafzalf1f2f3
 
PPTX
Lec 1 indexing and hashing
Md. Mashiur Rahman
 
PPT
A database introduction
Tushar Desarda
 
PPT
11885558.ppt
KalsoomTahir2
 
PPT
lec_7 cyber security in information .ppt
ubaidullah75790
 
PPT
physical database design distributed .ppt
ubaidullah75790
 
PPT
Chapter29.ppt
VarchasvaTiwari2
 
PPTX
Chapter24.pptx big data systems power point ppt
bhargavi804095
 
PPT
Chapter 5: Database superclass, subclass
Bicycle Thief
 
PDF
Chapter 2 data base system normalization.pdf
hendmohamed98
 
PDF
File Types in Data Structure
Prof Ansari
 
PPTX
structured query language elmarsi and navathe edition 7th SQL Chapter06.pptx
SuryaBasnet3
 
PPT
Storage struct
durgaprasad1407
 
PPT
Indexing and hashing
Jeet Poria
 
PPT
Lecture 26
Shani729
 
Elmasri Navathe Primary Files database A
cscmalligawad
 
Chapter11 kkkkkkkkkkkkkkkkkkkkkkkk(1).ppt
kamalsmail1
 
Chapter06.ppt
yashodhaHR2
 
Database administration and management chapter 12
saniaafzalf1f2f3
 
Lec 1 indexing and hashing
Md. Mashiur Rahman
 
A database introduction
Tushar Desarda
 
11885558.ppt
KalsoomTahir2
 
lec_7 cyber security in information .ppt
ubaidullah75790
 
physical database design distributed .ppt
ubaidullah75790
 
Chapter29.ppt
VarchasvaTiwari2
 
Chapter24.pptx big data systems power point ppt
bhargavi804095
 
Chapter 5: Database superclass, subclass
Bicycle Thief
 
Chapter 2 data base system normalization.pdf
hendmohamed98
 
File Types in Data Structure
Prof Ansari
 
structured query language elmarsi and navathe edition 7th SQL Chapter06.pptx
SuryaBasnet3
 
Storage struct
durgaprasad1407
 
Indexing and hashing
Jeet Poria
 
Lecture 26
Shani729
 

Recently uploaded (12)

PDF
Modern & Stylish Kitchen Design Ideas.pdf
muqarrab277
 
PDF
TikTok Stories_ A Lifeline for Brands in PR Crises
Ufki
 
PPTX
Multiple Quotes-playful Multiple Quotes-playful.pptx
BinayKrishnaDey
 
PPTX
How-Intent-Data-Platforms-Support-Content-Syndication-Strategies.pptx
brandonsoros91
 
PDF
Unlock TikTok Growth with The Short Media
21MCA2671RITUBISHT
 
PDF
Stand Out Online with Sociocosmos Claim Your Space
SocioCosmos
 
PPTX
IMPACT OF AI FOR FUTURE GENERATIONS.pptx
holin7
 
PDF
"Digital solutions that deliver real results."
Rohitha SEO Analyst
 
PDF
How to Get 100k Views on TikTok_ Secrets You Need to Know
Ufki
 
PDF
What is TikTok Creator Marketplace & Should You
Ufki
 
PDF
Let Poetry Heal What the Heart Can’t Say
Wajiha Mushtaq
 
PDF
TOP 10 AI TOOLS MUST LEARN IN 2025 AND ABOVE
darshikasoni06
 
Modern & Stylish Kitchen Design Ideas.pdf
muqarrab277
 
TikTok Stories_ A Lifeline for Brands in PR Crises
Ufki
 
Multiple Quotes-playful Multiple Quotes-playful.pptx
BinayKrishnaDey
 
How-Intent-Data-Platforms-Support-Content-Syndication-Strategies.pptx
brandonsoros91
 
Unlock TikTok Growth with The Short Media
21MCA2671RITUBISHT
 
Stand Out Online with Sociocosmos Claim Your Space
SocioCosmos
 
IMPACT OF AI FOR FUTURE GENERATIONS.pptx
holin7
 
"Digital solutions that deliver real results."
Rohitha SEO Analyst
 
How to Get 100k Views on TikTok_ Secrets You Need to Know
Ufki
 
What is TikTok Creator Marketplace & Should You
Ufki
 
Let Poetry Heal What the Heart Can’t Say
Wajiha Mushtaq
 
TOP 10 AI TOOLS MUST LEARN IN 2025 AND ABOVE
darshikasoni06
 
Ad

Indexing1.pptxnnnnñnnnnnnnnnnnnnnnnnnnnnn

  • 1. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe
  • 2. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Views  A view in SQL terminology is a single table that is derived from other tables  These other tables can be base tables or previously defined views.  A view does not necessarily exist in physical form; it is considered to be a virtual table, in contrast to base tables, whose tuples are always physically stored in the database Slide 16- 2
  • 3. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Example Slide 16- 3
  • 4. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe  A view is supposed to be always up-to-date; if we modify the tuples in the base tables on which the view is defined, the view must automatically reflect these changes. Slide 16- 4
  • 5. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe  V1A: DROP VIEW WORKS_ON1; Slide 16- 5
  • 6. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Indexing Structures for Files and Physical Database Design
  • 7. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Indexing  Indexing refers to a data structure technique that is used for quickly retrieving entries from database files using some attributes that have been indexed.  In database systems, indexing is comparable to indexing in books. Slide 16- 7
  • 8. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Introduction  Indexes used to speed up record retrieval in response to certain search conditions  Index structures provide secondary access paths  Any field can be used to create an index  Multiple indexes can be constructed  Most indexes based on ordered files Slide 17- 9
  • 9. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 10
  • 10. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 8- 11
  • 11. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Primary Indexes Slide 17- 12
  • 12. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Primary Indexes  Ordered file with two fields  Primary key, K(i)  Pointer to a disk block, P(i)  One index entry in the index file for each block in the data file  Indexes may be dense or sparse  Dense index has an index entry for every search key value in the data file  Sparse index has entries for only some search values Slide 17- 13
  • 13. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Primary Indexes (cont’d.) Slide 17-14 Figure 17.1 Primary index on the ordering key field of the file shown in Figure 16.7
  • 14. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Dense Index  Every search key value in the data file has an index record in the dense index. It speeds up the search process. The total number of records present in the index table and the main table are the same in this case.  It requires extra space to hold the index record. A pointer to the actual record on the disk and the search key are both included in the index records. Slide 16- 16
  • 15. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Sparse Index  Only a few items in the data file have index records. Each and every item points to a certain block. Rather than pointing to each item in the main database, the index, in this case, points to the records that are present in the main table that is in a gap. Slide 16- 17
  • 16. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Clustering Indexes  Clustering field  File records are physically ordered on a nonkey field without a distinct value for each record  Ordered file with two fields  Same type as clustering field  Disk block pointer Slide 17- 18
  • 17. Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Clustering Indexes (cont’d.) Slide 17-19 Figure 17.2 A clustering index on the Dept_number ordering nonkey field of an EMPLOYEE file