SlideShare a Scribd company logo
1 of 59
Chapter A: Network Model
Basic Concepts
Data-Structure Diagrams
The DBTG CODASYL Model
DBTG Data-Retrieval Facility
DBTG Update Facility
DBTG Set-Processing Facility
Mapping of Networks to Files

Database System Concepts

A.1

©Silberschatz, Korth and Sudarshan
Basic Concepts
Data are represented by collections of records.
similar to an entity in the E-R model
Records and their fields are represented as record type

type customer = record
type account = record
customer-name: string;
account-number: integer;
customer-street: string;
balance: integer;
customer-city: string;
end

end

Relationships among data are represented by links
similar to a restricted (binary) form of an E-R relationship
restrictions on links depend on whether the relationship is manymany, many-to-one, or one-to-one.

Database System Concepts

A.2

©Silberschatz, Korth and Sudarshan
Data-Structure Diagrams
Schema representing the design of a network database.

A data-structure diagram consists of two basic components:
Boxes, which correspond to record types.
Lines, which correspond to links.

Specifies the overall logical structure of the database.

Database System Concepts

A.3

©Silberschatz, Korth and Sudarshan
Data-Structure Diagrams (Cont.)
For every E-R diagram, there is a corresponding data-structure
diagram.

Database System Concepts

A.4

©Silberschatz, Korth and Sudarshan
Data-Structure Diagrams (Cont.)
Since a link cannot contain any data value, represent an E-R
relationship with attributes with a new record type and links.

Database System Concepts

A.5

©Silberschatz, Korth and Sudarshan
General Relationships
To represent an E-R relationship of degree 3 or higher, connect
the participating record types through a new record type that is
linked directly to each of the original record types.
1. Replace entity sets account, customer, and branch with record
types account, customer, and branch, respectively.
2. Create a new record type Rlink (referred to as a dummy record
type).
3. Create the following many-to-one links:
CustRlink from Rlink record type to customer record type
AcctRlnk from Rlink record type to account record type
BrncRlnk from Rlink record type to branch record type

Database System Concepts

A.6

©Silberschatz, Korth and Sudarshan
Network Representation of Ternary Relationship

Database System Concepts

A.7

©Silberschatz, Korth and Sudarshan
The DBTG CODASYL Model
All links are treated as many-to-one relationships.
To model many-to-many relationships, a record type is defined to
represent the relationship and two links are used.

Database System Concepts

A.8

©Silberschatz, Korth and Sudarshan
DBTG Sets
The structure consisting of two record types that are linked
together is referred to in the DBTG model as a DBTG set
In each DBTG set, one record type is designated as the owner,
and the other is designated as the member, of the set.
Each DBTG set can have any number of set occurrences (actual
instances of linked records).
Since many-to-many links are disallowed, each set occurrence
has precisely one owner, and has zero or more member records.
No member record of a set can participate in more than one
occurrence of the set at any point.
A member record can participate simultaneously in several set
occurrences of different DBTG sets.

Database System Concepts

A.9

©Silberschatz, Korth and Sudarshan
Repeating Groups
Provide a mechanism for a field to have a set of values rather
than a single value.
Alternative representation of weak entities from the E-R model
Example: Two sets.
customer (customer-name)
customer-address (customer-street, customer-city)

The following diagrams represent these sets without the
repeating-group construct.

Database System Concepts

A.10

©Silberschatz, Korth and Sudarshan
Repeating Groups (Cont.)

With the repeating-group construct, the data-structure diagram
consists of the single record type customer.

Database System Concepts

A.11

©Silberschatz, Korth and Sudarshan
DBTG Data-Retrieval Facility
The DBTG data manipulation language consists of a number of
commands that are embedded in a host language.
Run unit — system application program consisting of a sequence
of host language and DBTG command statements. Statements
access and manipulate database items as well as locally
declared variables.
Program work-area (or user work area) — a buffer storage area
the system maintains for each application program

Database System Concepts

A.12

©Silberschatz, Korth and Sudarshan
DBTG Variables
Record Templates
Currency pointers
Current of record type
Current of set type
Current of run unit

Status flags
DB-status is most frequently used
Additional variables: DB-set-name, DB-record-name, and
DB-data-name

Database System Concepts

A.13

©Silberschatz, Korth and Sudarshan
Example Schema

Database System Concepts

A.14

©Silberschatz, Korth and Sudarshan
Example Program Work Area
Templates for three record types: customer, account, and
branch.
Six currency pointers
Three pointers for record types: one each tot he most recently
accessed customer, account, and branch record
Two pointers for set types: one to the most recently accessed
record in an occurrence of the set depositor, one to the most
recently accessed record in an occurrence of the set accountbranch
One run-unit pointer.

Status flags: four variables defined previously
Following diagram shows an example program work area state.

Database System Concepts

A.15

©Silberschatz, Korth and Sudarshan
Database System Concepts

A.16

©Silberschatz, Korth and Sudarshan
The Find and Get Commands
find locates a record in the database and sets the appropriate
currency pointers
get copies of the record to which the current of run-unit points
from the database to the appropriate program work area
template
Example: Executing a find command to locate the customer
record belonging to Johnson causes the following changes to
occur in the state of the program work area.
The current of the record type customer now points to the record of
Johnson.
The current of set type depositor now points to the set owned by
Johnson
The current of run unit now points to customer record Johnson.

Database System Concepts

A.17

©Silberschatz, Korth and Sudarshan
Access of Individual Records
find any <record type> using <record-field>
Locates a record of type <record type> whose <record-field>
value is the same as the value of <record-field> in the
<record type> template in the program work area.
Once such a record is found, the following currency pointers are
set to point to that record:
The current of run-unit pointer
The record-type currency pointer for <record type>
For each set in which that record belongs, the appropriate set
currency pointer

find duplicate <record type> using <record-field>
Locates (according to a system-dependent ordering) the next
record that matches the <record-field>

Database System Concepts

A.18

©Silberschatz, Korth and Sudarshan
Access of Records Within a Set
Other find commands locate records in the DBTG set that is
pointed to by the <set-type> currency pointer.
find first <record type> within <set-type>
Locates the first database record of type <record type>
belonging to the current <set-type>.
To locate the other members of a set,k we use
find next <record type> within <set-type>
which finds the next element in the set <set-type>.
find owner within <set-type>
Locates the owner of a particular DBTG set

Database System Concepts

A.19

©Silberschatz, Korth and Sudarshan
Predicates
For queries in which a field value must be matched with a
specified range of values, rather than to only one, we need to:
get the appropriate records into memory
examine each one separately for a match
determine whether each is the; target of our find statement

Database System Concepts

A.20

©Silberschatz, Korth and Sudarshan
Example DBTG Query
Print the total number of accounts in the Perryridge branch with a
balance greater than $10,000.
count := 0;
branch.branch-name := “Perryridge”;
find any branch using branch-name;
find first account within account-branch;
while DB-status = 0 do
begin
get account
if account.balance > 10000 then count := count + 1;
find next account within account-branch;
end
print (count);

Database System Concepts

A.21

©Silberschatz, Korth and Sudarshan
DBTG Update Facility
DBTG mechanisms are available to update information in the
database.
To create a new record of type <record type>
insert the appropriate values in the corresponding
<record type> template
add this new record to the database by executing
store <record type>

Can create and add new records only one at a time

Database System Concepts

A.22

©Silberschatz, Korth and Sudarshan
DBTG Update Facility (Cont.)
To modify an existing record of type <record type>
find that record in the database
get that record into memory
change the desired fields in the template of <record type>
reflect the changes to the record to which the currency point of
<record type> points by executing
modify <record type>

Database System Concepts

A.23

©Silberschatz, Korth and Sudarshan
DBTG Update Facility (Cont.)
To delete an existing record of type <record type>
make the currency pointer of that type point to the record in the
database to be deleted
delete that record by executing
erase <record type>

Delete an entire set occurrence by finding the owner of the set
and executing
erase all <record type>
Deletes the owner of the set, as well as all the set’s members.
If a member of the set is an owner of another set, the members of
that second set also will be deleted.
erase all is recursive.

Database System Concepts

A.24

©Silberschatz, Korth and Sudarshan
DBTG Set-Processing Facility
Mechanisms are provided for inserting records into and removing
records from a particular set occurrence
Insert a new record into a set by executing the connect
statement.
connect <record type> to <set-type>

Remove a record from a set by executing the disconnect
statement.
disconnect <record type> from <set-type>

Database System Concepts

A.25

©Silberschatz, Korth and Sudarshan
Example disconnect Query
Close account A-201, that is, delete the relationship between
account A-201 and its customer, but archive the record of
account A-201.
The following program removes account A-201 from the set
occurrence of type depositor.
The account will still be accessible in the database for recordkeeping purposes.
account.account-number := “A-201”;
find for update any account using account-number.
get account,
find owner within depositor,
disconnect account from depositor.

Database System Concepts

A.26

©Silberschatz, Korth and Sudarshan
DBTG Set-Processing Facility
(Cont.)
To move a record of type <record type> from one set occurrence
to another set occurrence of type <set-type>
Find the appropriate record and the owner of the set occurrences to
which that record is to be moved.
Move the record by executing
reconnect <record type> to <set-type>

Example: Move all accounts of Hayes that are currently at the
Perryridge branch to the Downtown branch.

Database System Concepts

A.27

©Silberschatz, Korth and Sudarshan
Example reconnect Query
customer.customer-name := “Hayes”;
find any customer using customer-name;
find first account within depositor;
while DB-status = 0 do
begin
find owner within account-branch;
get branch;
if branch.branch-name = “Perryridge” then
begin
branch.branch-name := “Downtown”;
find any branch using branch-name;
reconnect account to account-branch;
end
find next account within depositor,
end

Database System Concepts

A.28

©Silberschatz, Korth and Sudarshan
DBTG Set-Processing Facility
(Cont.)
A newly created member record of type <record type> of a set
type <set-type> can be added to a set occurrence either explicitly
(manually) or implicitly (automatically).
Specify the insert mode at set-definition time via
insertion is <insert mode>
manual:

connect <record type> to <set-type>

automatic:

store <record type>

Database System Concepts

A.29

©Silberschatz, Korth and Sudarshan
Set Insertion Example
Create account A535 for customer Hayes at the Downtown
branch.
Set insertion is manual for set type depositor and is automatic
for set type account-branch.
branch.branch-name := “Downtown”;
find any branch using branch-name;
account.account-number := “A-535”;
account.balance := 0;
store account;
customer.customer-name := “Hayes”;
find any customer using customer-name;
connect account to depositor;

Database System Concepts

A.30

©Silberschatz, Korth and Sudarshan
DBTG Set-Processing Facility
(Cont.)
Restrictions on how and when a member record can be removed
from a set occurrence are specified at set-definition time via
retention is <retention-mode>
<retention-mode> can take one of the three forms:
1. fixed — a member record cannot be removed. To reconnect a
record to another set, we must erase that record, recreate it, and
then insert it into the new set occurrence.
2. mandatory — a member record of a particular set
occurrence can be reconnected to another set occurrence of only
type <set-type>.
3. optional — no restrictions on how and when a member record
can be removed from a set occurrence.

Database System Concepts

A.31

©Silberschatz, Korth and Sudarshan
DBTG Set-Processing Facility
(Cont.)
The best way to delete a record that is the owner of set
occurrence of type <set-type> depends on the specification of
the set retention of <set-type>.
optional — the record will be deleted and every member of the
set that it owns will be disconnected. These records, however,
will be in the database.
fixed — the record and all its owned members will be deleted; a
member record cannot be removed from the set occurrence
without being deleted.
mandatory — the record cannot be erased, because the
mandatory status indicates that a member record must belong to
a set occurrence. The record cannot be disconnected from that
set.

Database System Concepts

A.32

©Silberschatz, Korth and Sudarshan
Set Ordering
Set ordering is specified by a programmer when the set is defined:
order is <order-mode>
first. A new record is inserted in the first position; the set is in
reverse chronological ordering.
last. A new record is inserted in the final position; the set is in
chronological ordering.
next. Suppose that the currency pointer or <set-type> points to
record X.
If X is a member type, a new record is inserted in the next position
following X.
If X is an owner type, a new record is inserted in the first position.

Database System Concepts

A.33

©Silberschatz, Korth and Sudarshan
Set Ordering (Cont.)
prior. If X is a member type, a new record is inserted in the
position just prior to X. If X is an owner type, a new record is
inserted in the last position.
system default. A new record is inserted in an arbitrary
position determined by the system.
sorted. A new record is inserted in a position that ensures that
the set will remain sorted. The sorting order is specified by a
particular key value when a programmer defines the set.
Example: Consider the set occurrence of type depositor with the
owner-record customer Turner and member-record accounts
A-305, A-402, and A-408 ordered as indicated in our example
schema (page A.14).

Database System Concepts

A.34

©Silberschatz, Korth and Sudarshan
Set Ordering Example
Add a new account A-125. For each <order-mode> option, the
new set ordering is as follows:
first: {A-125,A-305,A-402,A-408}
last: {A-305,A-402,A-408,A-125}
next: Suppose that the currency pointer points to record
“Turner”; then the new set order is {A-125,A-305,A-402,A-408}
prior: Suppose that the currency pointer points to record A-402;
then the new set order is {A-305,A-125,A-402,A-408}
system default: Any arbitrary order is acceptable; thus,
{A-305,A-402,A-125,A-408} is a valid set ordering
sorted: The set must be ordered in ascending order with
account number being the key; thus, the ordering must be
{A-125,A-305,A-402,A-408}
Database System Concepts

A.35

©Silberschatz, Korth and Sudarshan
Mapping of Networks to Files
We implement links by adding pointer fields to records that are
associated via a link
Each record must have one pointer field for each link with which
it is associated.
Example data-structure diagram and corresponding database.
Figure missing

Database System Concepts

A.36

©Silberschatz, Korth and Sudarshan
Mapping of Networks to Files (Cont.)
Diagram showing the sample instance with pointer fields to
represent the links. Each link is replaced by two pointers.

Database System Concepts

A.37

©Silberschatz, Korth and Sudarshan
Mapping of Networks to Files (Cont.)
Since the depositor link is many to many, each record can be
associated with an arbitrary number of records (e.g., the account
record would have a pointer to the customer record for each
customer who has that account).
Direct implementation of many-to-many relationships requires
the use of variable length records.
The DBTG model restricts links to be either one to one or one to
many; the number of pointers needed is reduced, and it is
possible to retain fixed-length records.

Database System Concepts

A.38

©Silberschatz, Korth and Sudarshan
Mapping of Networks to Files (Cont.)
Assume that the depositor link is one to many and is represented
by the DBTG set depositor and this corresponding sample
database.
set name is depositor
owner is customer
member is account

Database System Concepts

A.39

©Silberschatz, Korth and Sudarshan
Mapping of Networks to Files (Cont.)
Because an account record can be associated with only one
customer record, we need only one pointer in the account record
to represent the depositor relationship.
A customer record can be associated with many account
records.
Rather ant using multiple pointers in the customer record, we can
use a ring structure to represent the entire occurrence of the
DBTG set depositor.
In a ring structure, the records of both the owner an member
types for a set occurrence are organized into a circular list.
There is one circular list for each set occurrence (that is, for each
record of the owner type).

Database System Concepts

A.40

©Silberschatz, Korth and Sudarshan
Example Ring Structure

Database System Concepts

A.41

©Silberschatz, Korth and Sudarshan
Modified Ring Structures
Execute find owner via a ring structure in which every membertype record contains a second pointer which points to the owner
record.

Database System Concepts

A.42

©Silberschatz, Korth and Sudarshan
Physical Placement of Records
To specify the storage strategy for DBTG set, add a placement
clause to the definition of the member record type.
The clause
placement clustered via depositor
will store members of each set occurrence close to one another
physically on disk, if possible, in the same block.
Store owner and member records close to one another physically
on disk by adding the clause near owner.
placement clustered via depositor near owner

Database System Concepts

A.43

©Silberschatz, Korth and Sudarshan
Physical Placement of Records
(Cont.)
Storing member records in the same block as the owner reduces
the number of block accesses required to read an entire set
occurrence.

Database System Concepts

A.44

©Silberschatz, Korth and Sudarshan
Sample Database

Database System Concepts

A.45

©Silberschatz, Korth and Sudarshan
Two Data-Structure Diagrams

Database System Concepts

A.46

©Silberschatz, Korth and Sudarshan
Sample Database Corresponding to
Diagram of Figure A.3b

Database System Concepts

A.47

©Silberschatz, Korth and Sudarshan
Sample Database Corresponding to
Diagram of Figure A.6b

Database System Concepts

A.48

©Silberschatz, Korth and Sudarshan
Sample Database Corresponding to
Diagram of Figure A.8b

Database System Concepts

A.49

©Silberschatz, Korth and Sudarshan
Two Data-Structure Diagrams

Database System Concepts

A.50

©Silberschatz, Korth and Sudarshan
Sample Database Corresponding to
the Diagram of Figure A.11

Database System Concepts

A.51

©Silberschatz, Korth and Sudarshan
DBTG Set

Database System Concepts

A.52

©Silberschatz, Korth and Sudarshan
Three Set Occurrences

Database System Concepts

A.53

©Silberschatz, Korth and Sudarshan
Data-Structure and E-R Diagram

Database System Concepts

A.54

©Silberschatz, Korth and Sudarshan
A customer Record

Database System Concepts

A.55

©Silberschatz, Korth and Sudarshan
Clustered Record Placement for
Instance for Figure A.1

Database System Concepts

A.56

©Silberschatz, Korth and Sudarshan
Class Enrollment E-R Diagram

Database System Concepts

A.57

©Silberschatz, Korth and Sudarshan
Parent—Child E-R Diagram

Database System Concepts

A.58

©Silberschatz, Korth and Sudarshan
Car-Insurance E-R Diagram

Database System Concepts

A.59

©Silberschatz, Korth and Sudarshan

More Related Content

What's hot

Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Yadhu Kiran
 
Object Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQLObject Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQLShahriar Hyder
 
Annotating search results from web databases
Annotating search results from web databasesAnnotating search results from web databases
Annotating search results from web databasesIEEEFINALYEARPROJECTS
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresSteven Johnson
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastoreHaris Khan
 
Data mining model for the data retrieval from central server configuration
Data mining model for the data retrieval from central server configurationData mining model for the data retrieval from central server configuration
Data mining model for the data retrieval from central server configurationijcsit
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsDataminingTools Inc
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 
Survey real time databases
Survey real time databasesSurvey real time databases
Survey real time databasesManuel Santos
 
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...ijdms
 
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMINGEVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMINGijiert bestjournal
 
Annotating search results from web databases
Annotating search results from web databasesAnnotating search results from web databases
Annotating search results from web databasesJPINFOTECH JAYAPRAKASH
 
Krish data controls
Krish data controlsKrish data controls
Krish data controlssubakrish
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql serverDivya Sharma
 
An overview of data warehousing and OLAP technology
An overview of  data warehousing and OLAP technology An overview of  data warehousing and OLAP technology
An overview of data warehousing and OLAP technology Nikhatfatima16
 

What's hot (20)

Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013
 
Object Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQLObject Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQL
 
Annotating search results from web databases
Annotating search results from web databasesAnnotating search results from web databases
Annotating search results from web databases
 
Discover database
Discover databaseDiscover database
Discover database
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
 
XML
XML XML
XML
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastore
 
Data mining model for the data retrieval from central server configuration
Data mining model for the data retrieval from central server configurationData mining model for the data retrieval from central server configuration
Data mining model for the data retrieval from central server configuration
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database Concepts
 
Extend db
Extend dbExtend db
Extend db
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Survey real time databases
Survey real time databasesSurvey real time databases
Survey real time databases
 
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
 
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMINGEVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
 
Annotating search results from web databases
Annotating search results from web databasesAnnotating search results from web databases
Annotating search results from web databases
 
Temporal database
Temporal databaseTemporal database
Temporal database
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
 
Krish data controls
Krish data controlsKrish data controls
Krish data controls
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql server
 
An overview of data warehousing and OLAP technology
An overview of  data warehousing and OLAP technology An overview of  data warehousing and OLAP technology
An overview of data warehousing and OLAP technology
 

Viewers also liked (17)

Ddl
DdlDdl
Ddl
 
E3 chap-14
E3 chap-14E3 chap-14
E3 chap-14
 
E3 chap-04
E3 chap-04E3 chap-04
E3 chap-04
 
Peubah acak
Peubah acakPeubah acak
Peubah acak
 
Aries
AriesAries
Aries
 
Ch9
Ch9Ch9
Ch9
 
E3 chap-09
E3 chap-09E3 chap-09
E3 chap-09
 
Imk pertemuan-4
Imk pertemuan-4Imk pertemuan-4
Imk pertemuan-4
 
Ch3
Ch3Ch3
Ch3
 
E3 chap-18
E3 chap-18E3 chap-18
E3 chap-18
 
E3 chap-12
E3 chap-12E3 chap-12
E3 chap-12
 
Soal kombinatorik
Soal kombinatorikSoal kombinatorik
Soal kombinatorik
 
Uji hipotesis
Uji hipotesisUji hipotesis
Uji hipotesis
 
Ch16
Ch16Ch16
Ch16
 
App b
App bApp b
App b
 
Ch1 introduction
Ch1   introductionCh1   introduction
Ch1 introduction
 
Ch2 another design
Ch2 another designCh2 another design
Ch2 another design
 

Similar to App a

Similar to App a (20)

Network model.ppt
Network model.pptNetwork model.ppt
Network model.ppt
 
App B
App BApp B
App B
 
Lesson 2 network database system
Lesson 2 network database systemLesson 2 network database system
Lesson 2 network database system
 
databasemanagementsystempptforbeginners.ppt
databasemanagementsystempptforbeginners.pptdatabasemanagementsystempptforbeginners.ppt
databasemanagementsystempptforbeginners.ppt
 
Introduction to Database System Concepts
Introduction to Database System ConceptsIntroduction to Database System Concepts
Introduction to Database System Concepts
 
ch3[1].ppt
ch3[1].pptch3[1].ppt
ch3[1].ppt
 
PPT demo
PPT demoPPT demo
PPT demo
 
Relational Model
Relational ModelRelational Model
Relational Model
 
DDL DML sysytems
DDL DML sysytemsDDL DML sysytems
DDL DML sysytems
 
Data base management systems ppt
Data base management systems pptData base management systems ppt
Data base management systems ppt
 
DBMS PPT 3.pptx
DBMS PPT 3.pptxDBMS PPT 3.pptx
DBMS PPT 3.pptx
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
PPT (2).ppt
PPT (2).pptPPT (2).ppt
PPT (2).ppt
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
 
Unit 1
Unit 1Unit 1
Unit 1
 
RDBMS, theory class - 1 (UIU CSI 221)
RDBMS, theory class - 1 (UIU CSI 221)RDBMS, theory class - 1 (UIU CSI 221)
RDBMS, theory class - 1 (UIU CSI 221)
 
Ch2
Ch2Ch2
Ch2
 
Ch5
Ch5Ch5
Ch5
 

Recently uploaded

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
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 

Recently uploaded (20)

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
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 

App a

  • 1. Chapter A: Network Model Basic Concepts Data-Structure Diagrams The DBTG CODASYL Model DBTG Data-Retrieval Facility DBTG Update Facility DBTG Set-Processing Facility Mapping of Networks to Files Database System Concepts A.1 ©Silberschatz, Korth and Sudarshan
  • 2. Basic Concepts Data are represented by collections of records. similar to an entity in the E-R model Records and their fields are represented as record type type customer = record type account = record customer-name: string; account-number: integer; customer-street: string; balance: integer; customer-city: string; end end Relationships among data are represented by links similar to a restricted (binary) form of an E-R relationship restrictions on links depend on whether the relationship is manymany, many-to-one, or one-to-one. Database System Concepts A.2 ©Silberschatz, Korth and Sudarshan
  • 3. Data-Structure Diagrams Schema representing the design of a network database. A data-structure diagram consists of two basic components: Boxes, which correspond to record types. Lines, which correspond to links. Specifies the overall logical structure of the database. Database System Concepts A.3 ©Silberschatz, Korth and Sudarshan
  • 4. Data-Structure Diagrams (Cont.) For every E-R diagram, there is a corresponding data-structure diagram. Database System Concepts A.4 ©Silberschatz, Korth and Sudarshan
  • 5. Data-Structure Diagrams (Cont.) Since a link cannot contain any data value, represent an E-R relationship with attributes with a new record type and links. Database System Concepts A.5 ©Silberschatz, Korth and Sudarshan
  • 6. General Relationships To represent an E-R relationship of degree 3 or higher, connect the participating record types through a new record type that is linked directly to each of the original record types. 1. Replace entity sets account, customer, and branch with record types account, customer, and branch, respectively. 2. Create a new record type Rlink (referred to as a dummy record type). 3. Create the following many-to-one links: CustRlink from Rlink record type to customer record type AcctRlnk from Rlink record type to account record type BrncRlnk from Rlink record type to branch record type Database System Concepts A.6 ©Silberschatz, Korth and Sudarshan
  • 7. Network Representation of Ternary Relationship Database System Concepts A.7 ©Silberschatz, Korth and Sudarshan
  • 8. The DBTG CODASYL Model All links are treated as many-to-one relationships. To model many-to-many relationships, a record type is defined to represent the relationship and two links are used. Database System Concepts A.8 ©Silberschatz, Korth and Sudarshan
  • 9. DBTG Sets The structure consisting of two record types that are linked together is referred to in the DBTG model as a DBTG set In each DBTG set, one record type is designated as the owner, and the other is designated as the member, of the set. Each DBTG set can have any number of set occurrences (actual instances of linked records). Since many-to-many links are disallowed, each set occurrence has precisely one owner, and has zero or more member records. No member record of a set can participate in more than one occurrence of the set at any point. A member record can participate simultaneously in several set occurrences of different DBTG sets. Database System Concepts A.9 ©Silberschatz, Korth and Sudarshan
  • 10. Repeating Groups Provide a mechanism for a field to have a set of values rather than a single value. Alternative representation of weak entities from the E-R model Example: Two sets. customer (customer-name) customer-address (customer-street, customer-city) The following diagrams represent these sets without the repeating-group construct. Database System Concepts A.10 ©Silberschatz, Korth and Sudarshan
  • 11. Repeating Groups (Cont.) With the repeating-group construct, the data-structure diagram consists of the single record type customer. Database System Concepts A.11 ©Silberschatz, Korth and Sudarshan
  • 12. DBTG Data-Retrieval Facility The DBTG data manipulation language consists of a number of commands that are embedded in a host language. Run unit — system application program consisting of a sequence of host language and DBTG command statements. Statements access and manipulate database items as well as locally declared variables. Program work-area (or user work area) — a buffer storage area the system maintains for each application program Database System Concepts A.12 ©Silberschatz, Korth and Sudarshan
  • 13. DBTG Variables Record Templates Currency pointers Current of record type Current of set type Current of run unit Status flags DB-status is most frequently used Additional variables: DB-set-name, DB-record-name, and DB-data-name Database System Concepts A.13 ©Silberschatz, Korth and Sudarshan
  • 14. Example Schema Database System Concepts A.14 ©Silberschatz, Korth and Sudarshan
  • 15. Example Program Work Area Templates for three record types: customer, account, and branch. Six currency pointers Three pointers for record types: one each tot he most recently accessed customer, account, and branch record Two pointers for set types: one to the most recently accessed record in an occurrence of the set depositor, one to the most recently accessed record in an occurrence of the set accountbranch One run-unit pointer. Status flags: four variables defined previously Following diagram shows an example program work area state. Database System Concepts A.15 ©Silberschatz, Korth and Sudarshan
  • 17. The Find and Get Commands find locates a record in the database and sets the appropriate currency pointers get copies of the record to which the current of run-unit points from the database to the appropriate program work area template Example: Executing a find command to locate the customer record belonging to Johnson causes the following changes to occur in the state of the program work area. The current of the record type customer now points to the record of Johnson. The current of set type depositor now points to the set owned by Johnson The current of run unit now points to customer record Johnson. Database System Concepts A.17 ©Silberschatz, Korth and Sudarshan
  • 18. Access of Individual Records find any <record type> using <record-field> Locates a record of type <record type> whose <record-field> value is the same as the value of <record-field> in the <record type> template in the program work area. Once such a record is found, the following currency pointers are set to point to that record: The current of run-unit pointer The record-type currency pointer for <record type> For each set in which that record belongs, the appropriate set currency pointer find duplicate <record type> using <record-field> Locates (according to a system-dependent ordering) the next record that matches the <record-field> Database System Concepts A.18 ©Silberschatz, Korth and Sudarshan
  • 19. Access of Records Within a Set Other find commands locate records in the DBTG set that is pointed to by the <set-type> currency pointer. find first <record type> within <set-type> Locates the first database record of type <record type> belonging to the current <set-type>. To locate the other members of a set,k we use find next <record type> within <set-type> which finds the next element in the set <set-type>. find owner within <set-type> Locates the owner of a particular DBTG set Database System Concepts A.19 ©Silberschatz, Korth and Sudarshan
  • 20. Predicates For queries in which a field value must be matched with a specified range of values, rather than to only one, we need to: get the appropriate records into memory examine each one separately for a match determine whether each is the; target of our find statement Database System Concepts A.20 ©Silberschatz, Korth and Sudarshan
  • 21. Example DBTG Query Print the total number of accounts in the Perryridge branch with a balance greater than $10,000. count := 0; branch.branch-name := “Perryridge”; find any branch using branch-name; find first account within account-branch; while DB-status = 0 do begin get account if account.balance > 10000 then count := count + 1; find next account within account-branch; end print (count); Database System Concepts A.21 ©Silberschatz, Korth and Sudarshan
  • 22. DBTG Update Facility DBTG mechanisms are available to update information in the database. To create a new record of type <record type> insert the appropriate values in the corresponding <record type> template add this new record to the database by executing store <record type> Can create and add new records only one at a time Database System Concepts A.22 ©Silberschatz, Korth and Sudarshan
  • 23. DBTG Update Facility (Cont.) To modify an existing record of type <record type> find that record in the database get that record into memory change the desired fields in the template of <record type> reflect the changes to the record to which the currency point of <record type> points by executing modify <record type> Database System Concepts A.23 ©Silberschatz, Korth and Sudarshan
  • 24. DBTG Update Facility (Cont.) To delete an existing record of type <record type> make the currency pointer of that type point to the record in the database to be deleted delete that record by executing erase <record type> Delete an entire set occurrence by finding the owner of the set and executing erase all <record type> Deletes the owner of the set, as well as all the set’s members. If a member of the set is an owner of another set, the members of that second set also will be deleted. erase all is recursive. Database System Concepts A.24 ©Silberschatz, Korth and Sudarshan
  • 25. DBTG Set-Processing Facility Mechanisms are provided for inserting records into and removing records from a particular set occurrence Insert a new record into a set by executing the connect statement. connect <record type> to <set-type> Remove a record from a set by executing the disconnect statement. disconnect <record type> from <set-type> Database System Concepts A.25 ©Silberschatz, Korth and Sudarshan
  • 26. Example disconnect Query Close account A-201, that is, delete the relationship between account A-201 and its customer, but archive the record of account A-201. The following program removes account A-201 from the set occurrence of type depositor. The account will still be accessible in the database for recordkeeping purposes. account.account-number := “A-201”; find for update any account using account-number. get account, find owner within depositor, disconnect account from depositor. Database System Concepts A.26 ©Silberschatz, Korth and Sudarshan
  • 27. DBTG Set-Processing Facility (Cont.) To move a record of type <record type> from one set occurrence to another set occurrence of type <set-type> Find the appropriate record and the owner of the set occurrences to which that record is to be moved. Move the record by executing reconnect <record type> to <set-type> Example: Move all accounts of Hayes that are currently at the Perryridge branch to the Downtown branch. Database System Concepts A.27 ©Silberschatz, Korth and Sudarshan
  • 28. Example reconnect Query customer.customer-name := “Hayes”; find any customer using customer-name; find first account within depositor; while DB-status = 0 do begin find owner within account-branch; get branch; if branch.branch-name = “Perryridge” then begin branch.branch-name := “Downtown”; find any branch using branch-name; reconnect account to account-branch; end find next account within depositor, end Database System Concepts A.28 ©Silberschatz, Korth and Sudarshan
  • 29. DBTG Set-Processing Facility (Cont.) A newly created member record of type <record type> of a set type <set-type> can be added to a set occurrence either explicitly (manually) or implicitly (automatically). Specify the insert mode at set-definition time via insertion is <insert mode> manual: connect <record type> to <set-type> automatic: store <record type> Database System Concepts A.29 ©Silberschatz, Korth and Sudarshan
  • 30. Set Insertion Example Create account A535 for customer Hayes at the Downtown branch. Set insertion is manual for set type depositor and is automatic for set type account-branch. branch.branch-name := “Downtown”; find any branch using branch-name; account.account-number := “A-535”; account.balance := 0; store account; customer.customer-name := “Hayes”; find any customer using customer-name; connect account to depositor; Database System Concepts A.30 ©Silberschatz, Korth and Sudarshan
  • 31. DBTG Set-Processing Facility (Cont.) Restrictions on how and when a member record can be removed from a set occurrence are specified at set-definition time via retention is <retention-mode> <retention-mode> can take one of the three forms: 1. fixed — a member record cannot be removed. To reconnect a record to another set, we must erase that record, recreate it, and then insert it into the new set occurrence. 2. mandatory — a member record of a particular set occurrence can be reconnected to another set occurrence of only type <set-type>. 3. optional — no restrictions on how and when a member record can be removed from a set occurrence. Database System Concepts A.31 ©Silberschatz, Korth and Sudarshan
  • 32. DBTG Set-Processing Facility (Cont.) The best way to delete a record that is the owner of set occurrence of type <set-type> depends on the specification of the set retention of <set-type>. optional — the record will be deleted and every member of the set that it owns will be disconnected. These records, however, will be in the database. fixed — the record and all its owned members will be deleted; a member record cannot be removed from the set occurrence without being deleted. mandatory — the record cannot be erased, because the mandatory status indicates that a member record must belong to a set occurrence. The record cannot be disconnected from that set. Database System Concepts A.32 ©Silberschatz, Korth and Sudarshan
  • 33. Set Ordering Set ordering is specified by a programmer when the set is defined: order is <order-mode> first. A new record is inserted in the first position; the set is in reverse chronological ordering. last. A new record is inserted in the final position; the set is in chronological ordering. next. Suppose that the currency pointer or <set-type> points to record X. If X is a member type, a new record is inserted in the next position following X. If X is an owner type, a new record is inserted in the first position. Database System Concepts A.33 ©Silberschatz, Korth and Sudarshan
  • 34. Set Ordering (Cont.) prior. If X is a member type, a new record is inserted in the position just prior to X. If X is an owner type, a new record is inserted in the last position. system default. A new record is inserted in an arbitrary position determined by the system. sorted. A new record is inserted in a position that ensures that the set will remain sorted. The sorting order is specified by a particular key value when a programmer defines the set. Example: Consider the set occurrence of type depositor with the owner-record customer Turner and member-record accounts A-305, A-402, and A-408 ordered as indicated in our example schema (page A.14). Database System Concepts A.34 ©Silberschatz, Korth and Sudarshan
  • 35. Set Ordering Example Add a new account A-125. For each <order-mode> option, the new set ordering is as follows: first: {A-125,A-305,A-402,A-408} last: {A-305,A-402,A-408,A-125} next: Suppose that the currency pointer points to record “Turner”; then the new set order is {A-125,A-305,A-402,A-408} prior: Suppose that the currency pointer points to record A-402; then the new set order is {A-305,A-125,A-402,A-408} system default: Any arbitrary order is acceptable; thus, {A-305,A-402,A-125,A-408} is a valid set ordering sorted: The set must be ordered in ascending order with account number being the key; thus, the ordering must be {A-125,A-305,A-402,A-408} Database System Concepts A.35 ©Silberschatz, Korth and Sudarshan
  • 36. Mapping of Networks to Files We implement links by adding pointer fields to records that are associated via a link Each record must have one pointer field for each link with which it is associated. Example data-structure diagram and corresponding database. Figure missing Database System Concepts A.36 ©Silberschatz, Korth and Sudarshan
  • 37. Mapping of Networks to Files (Cont.) Diagram showing the sample instance with pointer fields to represent the links. Each link is replaced by two pointers. Database System Concepts A.37 ©Silberschatz, Korth and Sudarshan
  • 38. Mapping of Networks to Files (Cont.) Since the depositor link is many to many, each record can be associated with an arbitrary number of records (e.g., the account record would have a pointer to the customer record for each customer who has that account). Direct implementation of many-to-many relationships requires the use of variable length records. The DBTG model restricts links to be either one to one or one to many; the number of pointers needed is reduced, and it is possible to retain fixed-length records. Database System Concepts A.38 ©Silberschatz, Korth and Sudarshan
  • 39. Mapping of Networks to Files (Cont.) Assume that the depositor link is one to many and is represented by the DBTG set depositor and this corresponding sample database. set name is depositor owner is customer member is account Database System Concepts A.39 ©Silberschatz, Korth and Sudarshan
  • 40. Mapping of Networks to Files (Cont.) Because an account record can be associated with only one customer record, we need only one pointer in the account record to represent the depositor relationship. A customer record can be associated with many account records. Rather ant using multiple pointers in the customer record, we can use a ring structure to represent the entire occurrence of the DBTG set depositor. In a ring structure, the records of both the owner an member types for a set occurrence are organized into a circular list. There is one circular list for each set occurrence (that is, for each record of the owner type). Database System Concepts A.40 ©Silberschatz, Korth and Sudarshan
  • 41. Example Ring Structure Database System Concepts A.41 ©Silberschatz, Korth and Sudarshan
  • 42. Modified Ring Structures Execute find owner via a ring structure in which every membertype record contains a second pointer which points to the owner record. Database System Concepts A.42 ©Silberschatz, Korth and Sudarshan
  • 43. Physical Placement of Records To specify the storage strategy for DBTG set, add a placement clause to the definition of the member record type. The clause placement clustered via depositor will store members of each set occurrence close to one another physically on disk, if possible, in the same block. Store owner and member records close to one another physically on disk by adding the clause near owner. placement clustered via depositor near owner Database System Concepts A.43 ©Silberschatz, Korth and Sudarshan
  • 44. Physical Placement of Records (Cont.) Storing member records in the same block as the owner reduces the number of block accesses required to read an entire set occurrence. Database System Concepts A.44 ©Silberschatz, Korth and Sudarshan
  • 45. Sample Database Database System Concepts A.45 ©Silberschatz, Korth and Sudarshan
  • 46. Two Data-Structure Diagrams Database System Concepts A.46 ©Silberschatz, Korth and Sudarshan
  • 47. Sample Database Corresponding to Diagram of Figure A.3b Database System Concepts A.47 ©Silberschatz, Korth and Sudarshan
  • 48. Sample Database Corresponding to Diagram of Figure A.6b Database System Concepts A.48 ©Silberschatz, Korth and Sudarshan
  • 49. Sample Database Corresponding to Diagram of Figure A.8b Database System Concepts A.49 ©Silberschatz, Korth and Sudarshan
  • 50. Two Data-Structure Diagrams Database System Concepts A.50 ©Silberschatz, Korth and Sudarshan
  • 51. Sample Database Corresponding to the Diagram of Figure A.11 Database System Concepts A.51 ©Silberschatz, Korth and Sudarshan
  • 52. DBTG Set Database System Concepts A.52 ©Silberschatz, Korth and Sudarshan
  • 53. Three Set Occurrences Database System Concepts A.53 ©Silberschatz, Korth and Sudarshan
  • 54. Data-Structure and E-R Diagram Database System Concepts A.54 ©Silberschatz, Korth and Sudarshan
  • 55. A customer Record Database System Concepts A.55 ©Silberschatz, Korth and Sudarshan
  • 56. Clustered Record Placement for Instance for Figure A.1 Database System Concepts A.56 ©Silberschatz, Korth and Sudarshan
  • 57. Class Enrollment E-R Diagram Database System Concepts A.57 ©Silberschatz, Korth and Sudarshan
  • 58. Parent—Child E-R Diagram Database System Concepts A.58 ©Silberschatz, Korth and Sudarshan
  • 59. Car-Insurance E-R Diagram Database System Concepts A.59 ©Silberschatz, Korth and Sudarshan