SlideShare une entreprise Scribd logo
1  sur  58
DBMS

BY:
Bhalwinder kaur
I.T
Data Structure vs. File Structure
2

Data Structure : How to arrange data in

memory
File Structure : How to arrange data in Disk
and/or any other secondary storage
DataBase and DataBase Management System
Users do NOT have to care about how to store data in a
file. DBMS will handle the detail.
 Users can use SQL (Structured Query Language) to
access the DataBase in an interactive command and/or
through a program (embeded SQL)


RAM Disk
File Types
3

Sequential file: one accessed in a serial manner from

beginning to end. E.g. audio, video, text, programs.
Text file: sequential file in which each logical record
is a single character.
ASCII: 1 byte/char
Unicode: 2 bytes/char
Sequential Files
4

Sequential file: A file whose contents can only be

read in order



Reader must be able to detect end-of-file (EOF)
Data can be stored in logical records, sorted by a key field


Greatly increases the speed of batch updates
Text Files
5

Simple file structure.
Extendable to more complex file structures using

markup languages (XHTML, HTML).
XHTML, HTML control the display of the file on a
monitor.
XML is a standard for markup languages.
Converting data from two’s
complement notation into ASCII for
6
storage in a text file
A procedure for merging two sequential files
7
Applying the merge
algorithm (Letters
are used to
represent entire
records.
The particular letter
indicates the value
of the record’s
key field.)

8
XML
9

Example

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
http://www.w3schools.com/xml/xml_whatis.asp
Indexed File
key

pointer

Brown

P1

Johnson

P3

Smith

P4

Watson

P5

Data item
for Brown

P2

Jones

10

Index file

Data file

Index: A list of key values and the location
of their associated records
An inverted file
11
A file with a partial index
12
Opening an indexed file
13
Hashing
14

In hashing the index file is replaced by a hash

function.

The storage space is divided into buckets.
 Each record has a key field. Each record is stored in the
bucket corresponding to the hash of its key.
 A hash function computes a bucket number for each
key value.
Advantage: no index table needed.
Disadvantages:


i) hash function needs careful
design;
ii) unpredictable performance
Terminology
15

Bucket: section of the data storage area.
Key: identifier for a block of information.
Hash function: takes as input a key and outputs a

bucket number.
Collision: two keys yield the same bucket number.
Hash Functions
16

Hash Function Requirements
 Easily and quickly computed.
 Values evenly spread over the bucket numbers.
 What can go wrong: bucket number computed from 1st
and 3rd characters of a name:
Brown, Brook, Broom, Broadhead,
Biot, Bloom,
…
 Examples of Hash Functions
 Mid square: compute (key x key) and
set bucket number = middle digits.
 Extraction: select digits from certain positions within
the key.
 Divide key by number of buckets and use the
remainder.
Hashing the key field value 25X3Z to one of
41 buckets
17
The rudiments of a hashing system, in which each
bucket holds those records that hash to that
18
bucket number
Collisions in Hashing
19

Collision: The case of two keys hashing to the

same bucket
Clustering problem: Poorly designed hashing function
can have uneven distribution of keys into buckets
 Collision also becomes a problem when there aren’t
enough buckets (probability greatly increases as load
factor (% of buckets filled) approaches 75%)
 Solution: somewhere between 50% and 75% load factor,
increase number of buckets and rehash all data

Handling bucket overflow
20
A large file partitioned into buckets
to be accessed by hashing
21
The role of an operating system
when accessing a 22
file

System calls ?
Maintaining a file’s order by means of
a File Allocation Table (FAT)
23
Information Required on a Hard Drive to Load
24

Startup BIOS (POST , Load MBR)
Master Boot Record (MBR)
 Master Boot Program
 Partition Table (16 bytes * 4)
OS Boot Record (Boot Sector)
 Loads the first program file of the OS
Boot Loader Program
 Begins process of loading OS into memory

an OS
How Data Is Logically Stored on a Floppy Disk
25

All floppy and hard disk drives are divided into

tracks and sectors

Tracks are concentric circles on a disk
Sector

Always 512 bytes
 Physical organization of a disk
 BIOS manages disk as sectors
Cluster (file allocation unit)


Group of sectors
 Logical organization of a disk
 OS views disk as a list of clusters

The Boot Record
26

Track 0, sector 1 of a floppy disk
Contains basic information about how the disk is

organized
Includes bootstrap program, which can be
used to boot from the disk
Uniform layout and content of boot record allows
any version of DOS or Windows to read any DOS
or Windows disk
The File Allocation Table (FAT)
27

Lists the location of files on disk in a one-column

table
Floppy disk FAT is 12 bits wide, called FAT12
Each entry describes how a cluster on the disk is
used
A bad cluster on the disk will be marked in the
FAT
The Root Directory
28

Lists all the files assigned to this table
Contains a fixed number of entries
Some items included are:


Filename and extension



Time and date of creation or last update



File attributes



First cluster number
How a Hard Drive is Logically Organized to Hold
Low-level format
Data
29


Creates tracks and sectors, done at factory

Partition the hard drive (FDISK.EXE)


Creates partition table at the beginning of drive

High-level format


Done by OS for each logical drive

Master Boot Record (MBR) is the first 512 bytes

of a hard drive

Master boot program (446 bytes) calls boot program to
load OS
 Partition table




Description, Location, Size
Partitions and Logical Drives
30
FAT16
31

Supported by DOS and all versions of Windows
Uses 16 bits for each cluster entry
As the size of the logical drive increases, FAT16

cluster size increases dramatically
FAT32
32

Became available with Windows 95 OSR2
Used 32 bits per FAT entry, although only 28 bits

were used to hold cluster numbers
More efficient than FAT16 in terms of cluster size
NTFS
33

Supported by Windows NT/2000/XP
Provides greater security
Used a database called the master file table

(MFT) to locate files and directories

Supports large hard drives
Comparing FAT16, FAT32, NTFS
34
A file versus a database organization
35

(1/2)
A file versus a database organization
(2/2)
36
The conceptual layers of a database
37
Schemas
38

Schema: A description of the structure of an entire

database, used by database software to maintain the
database
Subschema: A description of only that portion of
the database pertinent to a particular user’s needs,
used to prevent sensitive data from being accessed
by unauthorized personnel
Database Management Systems
39

Database Management System (DBMS): A

software layer that manipulates a database in
response to requests from applications
Distributed Database: A database stored on
multiple machines


DBMS will mask this organizational detail from its users

Data independence: The ability to change the

organization of a database without changing the
application software that uses it
Database Models
40

Database model: A conceptual view of a database



Relational database model
Object-oriented database model
Relational Database Model
41

Relation: A rectangular table



Attribute: A column in the table
Tuple: A row in the table

Relational Design


Avoid multiple concepts within one relation



Can lead to redundant data
Deleting a tuple could also delete necessary but unrelated
information
Improving a Relational Design
42

Decomposition: Dividing the columns of a

relation into two or more relations, duplicating those
columns necessary to maintain relationships


Lossless or nonloss decomposition: A “correct”
decomposition that does not lose any information
A relation containing employee information
43
A relation containing redundancy
44
An employee database consisting of
three relations
45
Finding the departments in which employee
has worked
46
A relation and a proposed decomposition
47
Relational Operations
48

Select: Choose rows
Project: Choose columns
Join: Assemble information from two or more

relations
The SELECT operation
49
The PROJECT operation
50
The JOIN operation
51
Another example of the JOIN
operation
52
An application of the JOIN operation
53
The associations between objects in an objectoriented database
59
Maintaining Database Integrity (1/2)
60

Transaction: A sequence of operations that must

all happen together


Example: transferring money between bank accounts

Transaction log: A non-volatile record of each

transaction’s activities, built before the transaction
is allowed to execute
Commit point: The point at which a transaction has
been recorded in the log
 Roll-back: The process of undoing a transaction

Maintaining database integrity
(2/2)
61

Simultaneous access problems
 Incorrect summary problem
 Lost update problem
Locking = preventing others from accessing data

being used by a transaction



Shared lock: used when reading data
Exclusive lock: used when altering data
Data Mining
62

Data Mining: The area of computer science that

deals with discovering patterns in collections of data
Data warehouse: A static data collection to be
mined


Data cube: Data presented from many perspectives to
enable mining

Data Mining Strategies
 Class description
 Class discrimination
 Cluster analysis
 Association analysis
 Outlier analysis
 Sequential pattern analysis
Social Impact of Database Technology
63

Problems
 Massive amounts of personal data are being collected





Often without knowledge or meaningful consent of affected
people

Data merging produces new, more invasive information
Errors are widely disseminated and hard to correct

Remedies
 Existing legal remedies often difficult to apply
 Negative publicity may be more effective

Contenu connexe

Tendances

Buffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya JyothiBuffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya JyothiSowmya Jyothi
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3Ala Qunaibi
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potxVlad Lesin
 
Report blocking ,management of files in secondry memory , static vs dynamic a...
Report blocking ,management of files in secondry memory , static vs dynamic a...Report blocking ,management of files in secondry memory , static vs dynamic a...
Report blocking ,management of files in secondry memory , static vs dynamic a...NoorMustafaSoomro
 
File management
File managementFile management
File managementMohd Arif
 
Alternate Data Streams
Alternate Data StreamsAlternate Data Streams
Alternate Data Streamsnephijohnson
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systemsvampugani
 
11.file system implementation
11.file system implementation11.file system implementation
11.file system implementationSenthil Kanth
 
Chapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationChapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationJafar Nesargi
 
Internal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiInternal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiSowmya Jyothi
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systemsdonny101
 
File handling in qbasic
File handling in qbasicFile handling in qbasic
File handling in qbasicSmritiGurung4
 

Tendances (20)

Buffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya JyothiBuffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya Jyothi
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
 
NTFS
NTFSNTFS
NTFS
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potx
 
Computer
ComputerComputer
Computer
 
Report blocking ,management of files in secondry memory , static vs dynamic a...
Report blocking ,management of files in secondry memory , static vs dynamic a...Report blocking ,management of files in secondry memory , static vs dynamic a...
Report blocking ,management of files in secondry memory , static vs dynamic a...
 
Windows 7
Windows 7Windows 7
Windows 7
 
File management
File managementFile management
File management
 
File management
File managementFile management
File management
 
File Systems
File SystemsFile Systems
File Systems
 
Alternate Data Streams
Alternate Data StreamsAlternate Data Streams
Alternate Data Streams
 
File system implementation
File system implementationFile system implementation
File system implementation
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
11.file system implementation
11.file system implementation11.file system implementation
11.file system implementation
 
Chapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationChapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organization
 
Internal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiInternal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya Jyothi
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
File handling in qbasic
File handling in qbasicFile handling in qbasic
File handling in qbasic
 
Ui disk & terminal drivers
Ui disk & terminal driversUi disk & terminal drivers
Ui disk & terminal drivers
 
File and fat
File and fatFile and fat
File and fat
 

Similaire à DBMS

File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tablesshashikant pabari
 
File Access & File System & File Allocation Table
File Access & File System & File Allocation TableFile Access & File System & File Allocation Table
File Access & File System & File Allocation TableChinmaya M. N
 
Introduction to filesystems and computer forensics
Introduction to filesystems and computer forensicsIntroduction to filesystems and computer forensics
Introduction to filesystems and computer forensicsMayank Chaudhari
 
OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)Chinmaya M. N
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OSC.U
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsMukesh Chinta
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.pptHelalMirzad
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems Dhaivat Zala
 
Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems senthilamul
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849marangburu42
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinalmarangburu42
 
File system, dual boot, addon components, create user
File system, dual boot, addon components, create userFile system, dual boot, addon components, create user
File system, dual boot, addon components, create userHarman Gahir
 

Similaire à DBMS (20)

File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
 
File Access & File System & File Allocation Table
File Access & File System & File Allocation TableFile Access & File System & File Allocation Table
File Access & File System & File Allocation Table
 
Introduction to filesystems and computer forensics
Introduction to filesystems and computer forensicsIntroduction to filesystems and computer forensics
Introduction to filesystems and computer forensics
 
OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
Ch11
Ch11Ch11
Ch11
 
Mshd
MshdMshd
Mshd
 
Os
OsOs
Os
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
 
File system
File systemFile system
File system
 
File system
File systemFile system
File system
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
 
NTFS.ppt
NTFS.pptNTFS.ppt
NTFS.ppt
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems
 
Windows xp
Windows xpWindows xp
Windows xp
 
Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinal
 
File system, dual boot, addon components, create user
File system, dual boot, addon components, create userFile system, dual boot, addon components, create user
File system, dual boot, addon components, create user
 

Dernier

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Dernier (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

DBMS

  • 2. Data Structure vs. File Structure 2 Data Structure : How to arrange data in memory File Structure : How to arrange data in Disk and/or any other secondary storage DataBase and DataBase Management System Users do NOT have to care about how to store data in a file. DBMS will handle the detail.  Users can use SQL (Structured Query Language) to access the DataBase in an interactive command and/or through a program (embeded SQL)  RAM Disk
  • 3. File Types 3 Sequential file: one accessed in a serial manner from beginning to end. E.g. audio, video, text, programs. Text file: sequential file in which each logical record is a single character. ASCII: 1 byte/char Unicode: 2 bytes/char
  • 4. Sequential Files 4 Sequential file: A file whose contents can only be read in order   Reader must be able to detect end-of-file (EOF) Data can be stored in logical records, sorted by a key field  Greatly increases the speed of batch updates
  • 5. Text Files 5 Simple file structure. Extendable to more complex file structures using markup languages (XHTML, HTML). XHTML, HTML control the display of the file on a monitor. XML is a standard for markup languages.
  • 6. Converting data from two’s complement notation into ASCII for 6 storage in a text file
  • 7. A procedure for merging two sequential files 7
  • 8. Applying the merge algorithm (Letters are used to represent entire records. The particular letter indicates the value of the record’s key field.) 8
  • 9. XML 9 Example <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> http://www.w3schools.com/xml/xml_whatis.asp
  • 10. Indexed File key pointer Brown P1 Johnson P3 Smith P4 Watson P5 Data item for Brown P2 Jones 10 Index file Data file Index: A list of key values and the location of their associated records
  • 12. A file with a partial index 12
  • 14. Hashing 14 In hashing the index file is replaced by a hash function. The storage space is divided into buckets.  Each record has a key field. Each record is stored in the bucket corresponding to the hash of its key.  A hash function computes a bucket number for each key value. Advantage: no index table needed. Disadvantages:  i) hash function needs careful design; ii) unpredictable performance
  • 15. Terminology 15 Bucket: section of the data storage area. Key: identifier for a block of information. Hash function: takes as input a key and outputs a bucket number. Collision: two keys yield the same bucket number.
  • 16. Hash Functions 16 Hash Function Requirements  Easily and quickly computed.  Values evenly spread over the bucket numbers.  What can go wrong: bucket number computed from 1st and 3rd characters of a name: Brown, Brook, Broom, Broadhead, Biot, Bloom, …  Examples of Hash Functions  Mid square: compute (key x key) and set bucket number = middle digits.  Extraction: select digits from certain positions within the key.  Divide key by number of buckets and use the remainder.
  • 17. Hashing the key field value 25X3Z to one of 41 buckets 17
  • 18. The rudiments of a hashing system, in which each bucket holds those records that hash to that 18 bucket number
  • 19. Collisions in Hashing 19 Collision: The case of two keys hashing to the same bucket Clustering problem: Poorly designed hashing function can have uneven distribution of keys into buckets  Collision also becomes a problem when there aren’t enough buckets (probability greatly increases as load factor (% of buckets filled) approaches 75%)  Solution: somewhere between 50% and 75% load factor, increase number of buckets and rehash all data 
  • 21. A large file partitioned into buckets to be accessed by hashing 21
  • 22. The role of an operating system when accessing a 22 file System calls ?
  • 23. Maintaining a file’s order by means of a File Allocation Table (FAT) 23
  • 24. Information Required on a Hard Drive to Load 24 Startup BIOS (POST , Load MBR) Master Boot Record (MBR)  Master Boot Program  Partition Table (16 bytes * 4) OS Boot Record (Boot Sector)  Loads the first program file of the OS Boot Loader Program  Begins process of loading OS into memory an OS
  • 25. How Data Is Logically Stored on a Floppy Disk 25 All floppy and hard disk drives are divided into tracks and sectors Tracks are concentric circles on a disk Sector Always 512 bytes  Physical organization of a disk  BIOS manages disk as sectors Cluster (file allocation unit)  Group of sectors  Logical organization of a disk  OS views disk as a list of clusters 
  • 26. The Boot Record 26 Track 0, sector 1 of a floppy disk Contains basic information about how the disk is organized Includes bootstrap program, which can be used to boot from the disk Uniform layout and content of boot record allows any version of DOS or Windows to read any DOS or Windows disk
  • 27. The File Allocation Table (FAT) 27 Lists the location of files on disk in a one-column table Floppy disk FAT is 12 bits wide, called FAT12 Each entry describes how a cluster on the disk is used A bad cluster on the disk will be marked in the FAT
  • 28. The Root Directory 28 Lists all the files assigned to this table Contains a fixed number of entries Some items included are:  Filename and extension  Time and date of creation or last update  File attributes  First cluster number
  • 29. How a Hard Drive is Logically Organized to Hold Low-level format Data 29  Creates tracks and sectors, done at factory Partition the hard drive (FDISK.EXE)  Creates partition table at the beginning of drive High-level format  Done by OS for each logical drive Master Boot Record (MBR) is the first 512 bytes of a hard drive Master boot program (446 bytes) calls boot program to load OS  Partition table   Description, Location, Size
  • 31. FAT16 31 Supported by DOS and all versions of Windows Uses 16 bits for each cluster entry As the size of the logical drive increases, FAT16 cluster size increases dramatically
  • 32. FAT32 32 Became available with Windows 95 OSR2 Used 32 bits per FAT entry, although only 28 bits were used to hold cluster numbers More efficient than FAT16 in terms of cluster size
  • 33. NTFS 33 Supported by Windows NT/2000/XP Provides greater security Used a database called the master file table (MFT) to locate files and directories Supports large hard drives
  • 35. A file versus a database organization 35 (1/2)
  • 36. A file versus a database organization (2/2) 36
  • 37. The conceptual layers of a database 37
  • 38. Schemas 38 Schema: A description of the structure of an entire database, used by database software to maintain the database Subschema: A description of only that portion of the database pertinent to a particular user’s needs, used to prevent sensitive data from being accessed by unauthorized personnel
  • 39. Database Management Systems 39 Database Management System (DBMS): A software layer that manipulates a database in response to requests from applications Distributed Database: A database stored on multiple machines  DBMS will mask this organizational detail from its users Data independence: The ability to change the organization of a database without changing the application software that uses it
  • 40. Database Models 40 Database model: A conceptual view of a database   Relational database model Object-oriented database model
  • 41. Relational Database Model 41 Relation: A rectangular table   Attribute: A column in the table Tuple: A row in the table Relational Design  Avoid multiple concepts within one relation   Can lead to redundant data Deleting a tuple could also delete necessary but unrelated information
  • 42. Improving a Relational Design 42 Decomposition: Dividing the columns of a relation into two or more relations, duplicating those columns necessary to maintain relationships  Lossless or nonloss decomposition: A “correct” decomposition that does not lose any information
  • 43. A relation containing employee information 43
  • 44. A relation containing redundancy 44
  • 45. An employee database consisting of three relations 45
  • 46. Finding the departments in which employee has worked 46
  • 47. A relation and a proposed decomposition 47
  • 48. Relational Operations 48 Select: Choose rows Project: Choose columns Join: Assemble information from two or more relations
  • 52. Another example of the JOIN operation 52
  • 53. An application of the JOIN operation 53
  • 54. The associations between objects in an objectoriented database 59
  • 55. Maintaining Database Integrity (1/2) 60 Transaction: A sequence of operations that must all happen together  Example: transferring money between bank accounts Transaction log: A non-volatile record of each transaction’s activities, built before the transaction is allowed to execute Commit point: The point at which a transaction has been recorded in the log  Roll-back: The process of undoing a transaction 
  • 56. Maintaining database integrity (2/2) 61 Simultaneous access problems  Incorrect summary problem  Lost update problem Locking = preventing others from accessing data being used by a transaction   Shared lock: used when reading data Exclusive lock: used when altering data
  • 57. Data Mining 62 Data Mining: The area of computer science that deals with discovering patterns in collections of data Data warehouse: A static data collection to be mined  Data cube: Data presented from many perspectives to enable mining Data Mining Strategies  Class description  Class discrimination  Cluster analysis  Association analysis  Outlier analysis  Sequential pattern analysis
  • 58. Social Impact of Database Technology 63 Problems  Massive amounts of personal data are being collected    Often without knowledge or meaningful consent of affected people Data merging produces new, more invasive information Errors are widely disseminated and hard to correct Remedies  Existing legal remedies often difficult to apply  Negative publicity may be more effective