SlideShare a Scribd company logo
DBF-Lecture11-Chapter12.ppt
Database Principles: Fundamentals of Design, Implementations
and Management
Lecture11- CHAPTER 12: Transaction Management and
Concurrency Control
Presented by Rabia Cherouk
*
ObjectivesIn this chapter, you will learn:About database
transactions and their propertiesWhat concurrency control is
and what role it plays in maintaining the database’s
integrityWhat locking methods are and how they workHow
stamping methods are used for concurrency controlHow
optimistic methods are used for concurrency controlHow
database recovery management is used to maintain database
integrity
*
What is a Transaction?A transaction is a logical unit of work
that must be either entirely completed or abortedSuccessful
transaction changes database from one consistent state to
anotherOne in which all data integrity constraints are
satisfiedMost real-world database transactions are formed by
two or more database requestsEquivalent of a single SQL
statement in an application program or transaction
Same as Fig. 12.1 in your book
*
Same as Fig. 12.1 in your book
*
Evaluating Transaction Results Not all transactions update the
databaseSQL code represents a transaction because database
was accessedImproper or incomplete transactions can have
devastating effect on database integritySome DBMSs provide
means by which user can define enforceable constraintsOther
integrity rules are enforced automatically by the DBMS
Same as Fig. 12.2 in your book
*
Figure 9.2
Same as Fig. 12.2 in your book
*
Transaction Properties
All transactions must display atomicity, consistency, durability
and serializability (ACIDS).AtomicityAll operations of a
transaction must be completedConsistency Permanence of
database’s consistent stateIsolation Data used during transaction
cannot be used by second transaction until the first is completed
*
Transaction Properties (cont..)Durability Once transactions are
committed, they cannot be undoneSerializabilityConcurrent
execution of several transactions yields consistent
resultsMultiuser databases are subject to multiple concurrent
transactions
*
Transaction Management with SQLANSI (American National
Standard Institute) has defined standards that govern SQL
database transactionsTransaction support is provided by two
SQL statements: COMMIT and ROLLBACKTransaction
sequence must continue until:COMMIT statement is
reachedROLLBACK statement is reachedEnd of program is
reachedProgram is abnormally terminated
*
The Transaction LogA DBMS uses a Transaction log to store:A
record for the beginning of transactionFor each transaction
component: Type of operation being performed (update, delete,
insert)Names of objects affected by transaction“Before” and
“after” values for updated fieldsPointers to previous and next
transaction log entries for the same transactionEnding
(COMMIT) of the transaction
Table 12.1 in your book
*
The Transaction Log
Table 12.1 in your book
*
Concurrency ControlIs the coordination of simultaneous
transaction execution in a multiprocessing databaseObjective is
to ensure serializability of transactions in a multiuser
environmentSimultaneous execution of transactions over a
shared database can create several data integrity and
consistency problemsLost updatesUncommitted dataInconsistent
retrievals
*
Lost UpdatesLost update problem:Two concurrent transactions
update same data elementOne of the updates is lostOverwritten
by the other transaction
Lost Updates
*
Lost Updates (cont..)
*
*
Uncommitted Data Uncommitted data phenomenon:Two
transactions executed concurrentlyFirst transaction rolled back
after second already accessed uncommitted data
Uncommitted Data
*
Uncommitted Data (cont..)
*
*
Inconsistent RetrievalsInconsistent retrievals:First transaction
accesses dataSecond transaction alters the dataFirst transaction
accesses the data againTransaction might read some data before
they are changed and other data after changedYields
inconsistent results
*
*
*
The SchedulerSpecial DBMS program Purpose is to establish
order of operations within which concurrent transactions are
executedInterleaves execution of database operations:Ensures
serializabilityEnsures isolationSerializable scheduleInterleaved
execution of transactions yields same results as serial execution
The Scheduler (cont..) Bases its actions on concurrency control
algorithmsEnsures computer’s central processing unit (CPU) is
used efficientlyFacilitates data isolation to ensure that two
transactions do not update same data element at same time
*
*
Database Recovery Management
Database recoveryRestores database from given state, usually
inconsistent, to previously consistent stateBased on atomic
transaction propertyAll portions of transaction treated as single
logical unit of workAll operations applied and completed to
produce consistent database
If transaction operation cannot be completed, transaction must
be aborted, and any changes to database must be rolled back
(undone)
Transaction RecoveryMakes use of deferred-write and write-
through techniquesDeferred write Transaction operations do not
immediately update physical databaseOnly transaction log is
updatedDatabase is physically updated only after transaction
reaches its commit point using transaction log information
*
*
Transaction Recovery (cont..)Write-through techniqueDatabase
is immediately updated by transaction operations during
transaction’s execution, even before transaction reaches its
commit pointRecovery processIdentify last checkpointIf
transaction was committed before checkpointDo nothingIf
transaction committed after last checkpointDBMS redoes the
transaction using “after” valuesIf transaction had ROLLBACK
or was left activeDo nothing because no updates were made
Transaction Recovery (cont..)
*
*
SummaryTransaction: sequence of database operations that
access databaseLogical unit of workNo portion of transaction
can exist by itselfFive main properties: atomicity, consistency,
isolation, durability, and serializabilityCOMMIT saves changes
to diskROLLBACK restores previous database stateSQL
transactions are formed by several SQL statements or database
requests
*
Summary (cont..) Transaction log keeps track of all transactions
that modify databaseConcurrency control coordinates
simultaneous execution of transactionsScheduler establishes
order in which concurrent transaction operations are
executedLock guarantees unique access to a data item by
transactionTwo types of locks: binary locks and
shared/exclusive locks
*
Summary (cont..) Serializability of schedules is guaranteed
through the use of two-phase lockingDeadlock: when two or
more transactions wait indefinitely for each other to release
lockThree deadlock control techniques: prevention, detection,
and avoidanceTime stamping methods assign unique time stamp
to each transaction Schedules execution of conflicting
transactions in time stamp order
*
Summary (cont..) Optimistic methods assume the majority of
database transactions do not conflictTransactions are executed
concurrently, using private copies of the dataDatabase recovery
restores database from given state to previous consistent state
CHAPTER 12: Transaction Management and Concurrency
Control
ADDITIONAL SLIDES pages 635 to 644 in your
Book..
*
*
Two-Phase Locking to Ensure Serializability (cont..)Governed
by the following rules:Two transactions cannot have conflicting
locksNo unlock operation can precede a lock operation in the
same transactionNo data are affected until all locks are
obtained—that is, until transaction is in its locked point
*
Concurrency Control
with Locking MethodsLock Guarantees exclusive use of a data
item to a current transactionRequired to prevent another
transaction from reading inconsistent dataLock
managerResponsible for assigning and policing the locks used
by transactions
*
Lock GranularityIndicates level of lock useLocking can take
place at following levels: DatabaseTablePageRowField
(attribute)
*
Lock Granularity (cont..) Database-level lockEntire database is
lockedTable-level lockEntire table is lockedPage-level
lockEntire diskpage is locked Row-level lock Allows concurrent
transactions to access different rows of same tableEven if rows
are located on same page Field-level lock Allows concurrent
transactions to access same row as long as they Require the use
of different fields (attributes) within the row
Fig 12.3 in your book
*
Fig 12.3 in your book
Fig 12.4 in your book
*
Fig 12.4 in your book
Fig. 12.5 in your book
*
Lock Granularity (cont..)
Fig. 12.5 in your book
Fig. 12.6 in your book
*
Lock Granularity (cont..)
Fig. 12.6 in your book
*
Lock TypesBinary lockTwo states: locked (1) or unlocked
(0)Exclusive lock Access is specifically reserved for transaction
that locked objectMust be used when potential for conflict
existsShared lock Concurrent transactions are granted read
access on basis of a common lock
Table 12.10 in your book
*
Table 12.10 in your book
*
Two-Phase Locking to Ensure SerializabilityDefines how
transactions acquire and relinquish locksGuarantees
serializability, but does not prevent deadlocks Growing
phaseTransaction acquires all required locks without unlocking
any dataShrinking phaseTransaction releases all locks and
cannot obtain any new lock
Deadlocks (cont..)
*
*
DeadlocksCondition that occurs when two transactions wait for
each other to unlock dataPossible only if one of the transactions
wants to obtain an exclusive lock on a data itemNo deadlock
condition can exist among shared locks
*
Table 12.11 in your book
Deadlocks (cont..)
*
Deadlocks (cont..)Three techniques to control
deadlock:Prevention Detection Avoidance Choice of deadlock
control method depends on database environmentLow
probability of deadlock, detection recommendedHigh
probability, prevention recommended
*
Concurrency Control
with Time Stamping Methods Assigns global unique time stamp
to each transactionProduces explicit order in which transactions
are submitted to DBMSUniqueness Ensures that no equal time
stamp values can existMonotonicityEnsures that time stamp
values always increase
*
Wait/Die and Wound/Wait SchemesWait/die Older transaction
waits and younger is rolled back and rescheduledWound/wait
Older transaction rolls back younger transaction and
reschedules it
Wait/Die and Wound/Wait Schemes (cont..)
*
*
Concurrency Control
with Optimistic Methods Optimistic approach Based on
assumption that majority of database operations do not
conflictDoes not require locking or time stamping
techniquesTransaction is executed without restrictions until it is
committedPhases: read, validation, and write
MA 106 Final Exam Name________________________
Solve by Factoring.
1) �2 + 4� − 5 = 0
2) (� − 2) (� + 5) = 8
Solve.
3) A batter hits a baseball in the air. The height h (in feet) of
the baseball after t seconds is
given by the equation ℎ = −16�2 + 64� + 3 = 0. When is the
baseball at a height of three feet?
Simplify.
5) 50
6)
10
x25
7)
3
7
x3
x48
Solve.
8) �2 − 64 = 0
MA 106 Final Exam Name________________________
9) (� + 2)2 = 36
10) Solve by completing the square.
7x6x
2
11) Solve by using the quadratic formula.
4-x6x
2
Find all values that make the rational expression undefined. If
the rational expression is
defined for all real numbers, so state.
12)
18x9x
64x
2
2
Simplify the expression.
13)
2
32
9x3x
x217x
Perform the indicated operation. Simplify if possible.
14)
ara
a
ra
ra
2
22
MA 106 Final Exam Name________________________
15)
12
2
4
1x
x
1-x
48x
16)
6-m
18
6-m
9mm
2
17)
3x
6
3x
4
18)
49x
x
142x
11
2
Solve the equation.
19)
x
7
7
1
x
2
MA 106 Final Exam Name________________________
Simplify the complex fraction.
20)
1
a
7
1
a
7
21) The triangles in the figure are similar. Find the length of
the side marked with an x.
Simplify.
Solve.
10
8
x
5
4
3
Database Principles: Fundamentals of Design, Implementations
and Management
Lecture7- CHAPTER 8 : Beginning Structured Query Language
Presented by Rabia Cherouk
*
ObjectivesIn this chapter, you will learn:The basic commands
and functions of SQLHow to use SQL for data administration
(to create tables, indexes, and views)How to use SQL for data
manipulation (to add, modify, delete, and retrieve data)How to
use SQL to query a database for useful information
*
Introduction to SQLSQL functions fit into two broad
categories:Data definition language (DDL)Create database
objects, such as tables, indexes, and viewsDefine access rights
to those database objectsData manipulation language
(DML)SQL is relatively easy to learnBasic command set has
vocabulary of less than 100 words – Non-procedural
languageAmerican National Standards Institute (ANSI)
prescribes a standard SQLand standards are accepted by ISO
(International Organisation for Standardisation) .Several SQL
dialects exist
Introduction to SQL (cont..)
*
Introduction to SQL (cont..)
*
*
Data Definition CommandsThe database modelIn this chapter, a
simple database with these tables is used to illustrate
commands:CUSTOMERINVOICELINEPRODUCTVENDORFoc
us on PRODUCT and VENDOR tables
*
The Database Model
Figure 8.1 in your book
The Database Model (cont..)
*
*
Creating the DatabaseTwo tasks must be completed:
1/ Create database structure
2/ Create tables that will hold end-user dataFirst
task:RDBMS creates physical files that will hold
databaseDiffers substantially from one RDBMS to another
*
The Database SchemaAuthentication Process through which
DBMS verifies that only registered users are able to access
databaseLog on to RDBMS using user ID and password created
by database administratorSchemaIs a group of database
objects—such as tables and indexes— that are related to each
other. Usually a schema belongs to a single user or application.
A single database can hold multiple schemas belonging to
different users or applications.
*
Data TypesData type selection is usually dictated by nature of
data and by intended usePay close attention to expected use of
attributes for sorting and data retrieval purposesSupported data
types:Number(L,D), Integer, Smallint, Decimal(L,D)Char(L),
Varchar(L), Varchar2(L)Date, Time, TimestampReal, Double,
FloatInterval day to hourMany other types
Data Types (cont..)
*
*
Creating Table StructuresUse one line per column (attribute)
definitionUse spaces to line up attribute characteristics and
constraintsTable and attribute names are capitalizedNOT NULL
specification UNIQUE specification Primary key attributes
contain both a NOT NULL and a UNIQUE specificationRDBMS
will automatically enforce referential integrity for foreign keys
*
Creating Table Structures (cont..)Command sequence ends with
semicolon
Example:
CREATE TABLE EMP_2
( EMP_NUM CHAR(3) NOT NULL UNIQUE,
EMP_LNAME VARCHAR(15) NOT NULL,
EMP_FNAME VARCHAR(15) NOT NULL,
EMP_INITIAL CHAR(1),
EMP_HIRE DATE NOT NULL,
JOB_CODE CHAR(3) NOT NULL,
PRIMARY KEY (EMP_NUM),
FOREIGN KEY (JOB_CODE) REFERENCES JOB);
*
SQL ConstraintsNOT NULL constraint Ensures that column
does not accept nullsUNIQUE constraint Ensures that all values
in column are uniqueDEFAULT constraint Assigns value to
attribute when a new row is added to tableCHECK constraint
Validates data when attribute value is entered
*
SQL IndexesWhen primary key is declared, DBMS
automatically creates unique indexOften need additional
indexesUsing CREATE INDEX command, SQL indexes can be
created on basis of any selected attributeComposite indexIndex
based on two or more attributesOften used to prevent data
duplication
SQL Indexes (cont..)
*
Data Manipulation CommandsAdding table rowsSaving table
changesListing table rowsUpdating table rowsRestoring table
contentsDeleting table rowsInserting table rows with a select
subquery
*
*
*
Data Manipulation
CommandsINSERTSELECTCOMMITUPDATEROLLBACK
DELETE
*
Adding Table RowsINSERT Used to enter data into
tableSyntax: INSERT INTO columnname
VALUES (value1, value2, … , valueN);
*
Adding Table Rows (cont..)When entering values, notice
that:Row contents are entered between parenthesesCharacter
and date values are entered between apostrophesNumerical
entries are not enclosed in apostrophesAttribute entries are
separated by commasA value is required for each columnUse
NULL for unknown values
*
Saving Table ChangesChanges made to table contents are not
physically saved on disk until:Database is closedProgram is
closedCOMMIT command is usedSyntax:COMMIT
[WORK];Will permanently save any changes made to any table
in the database
*
Listing Table RowsSELECT Used to list contents of
tableSyntax: SELECT columnlistFROM tablename;Columnlist
represents one or more attributes, separated by commasAsterisk
can be used as wildcard character to list all attributes
Listing Table Rows (cont..)
*
*
Updating Table RowsUPDATE Modify data in a tableSyntax:
UPDATE tablename
SET columnname = expression [, columnname = expression]
[WHERE conditionlist];If more than one attribute is to be
updated in row, separate corrections with commas
*
Restoring Table ContentsROLLBACKUsed to restore database
to its previous conditionOnly applicable if COMMIT command
has not been used to permanently store changes in
databaseSyntax:ROLLBACK;COMMIT and ROLLBACK only
work with manipulation commands that are used to add, modify,
or delete table rows
*
Deleting Table RowsDELETE Deletes a table rowSyntax:
DELETE FROM tablename
[WHERE conditionlist ];WHERE condition is optionalIf
WHERE condition is not specified, all rows from specified table
will be deleted
*
Inserting Table Rows with a
SELECT SubqueryINSERTInserts multiple rows from another
table (source)Uses SELECT subquerySubquery: query that is
embedded (or nested) inside another querySubquery is executed
firstSyntax:
INSERT INTO tablename SELECT columnlist FROM
tablename;
*
SELECT QueriesFine-tune SELECT command by adding
restrictions to search criteria using:Conditional
restrictionsArithmetic operatorsLogical operatorsSpecial
operators
*
Selecting Rows with
Conditional RestrictionsSelect partial table contents by placing
restrictions on rows to be included in outputAdd conditional
restrictions to SELECT statement, using WHERE clauseSyntax:
SELECT columnlist
FROM tablelist
[ WHERE conditionlist ] ;
Selecting Rows with
Conditional Restrictions (continued)
*
Selecting Rows with
Conditional Restrictions (continued)
*
*
Selecting Rows with
Conditional Restrictions (cont..)
Selecting Rows with
Conditional Restrictions (continued)
*
Selecting Rows with
Conditional Restrictions (cont..)
*
Selecting Rows with
Conditional Restrictions (continued)
*
Selecting Rows with
Conditional Restrictions (continued)
*
Selecting Rows with
Conditional Restrictions (cont..)
*
Selecting Rows with
Conditional Restrictions (continued)
*
Selecting Rows with
Conditional Restrictions (continued)
*
*
Arithmetic Operators:
The Rule of PrecedencePerform operations within
parenthesesPerform power operationsPerform multiplications
and divisionsPerform additions and subtractionsTable 8.7 in
your book in T
*
Logical Operators: AND, OR, and NOTSearching data involves
multiple conditionsLogical operators: AND, OR, and NOTCan
be combinedParentheses placed to enforce precedence
orderConditions in parentheses always executed firstBoolean
algebra: mathematical field dedicated to use of logical
operatorsNOT negates result of conditional expression
*
Special OperatorsBETWEEN: checks whether attribute value is
within a rangeIS NULL: checks whether attribute value is
nullLIKE: checks whether attribute value matches given string
patternIN: checks whether attribute value matches any value
within a value listEXISTS: checks if subquery returns any rows
*
Advanced Data Definition CommandsAll changes in table
structure are made by using ALTER commandThree
optionsADD adds a columnMODIFY changes column
characteristicsDROP deletes a columnCan also be used to: Add
table constraintsRemove table constraints
*
Changing a Column’s Data TypeALTER can be used to change
data typeSome RDBMSs do not permit changes to data types
unless column is empty
Changing a Column’s Data CharacteristicsUse ALTER to
change data characteristicsChanges in column’s characteristics
permitted if changes do not alter the existing data type
*
Adding a Column
Dropping a ColumnUse ALTER to add columnDo not include
the NOT NULL clause for new columnUse ALTER to drop
columnSome RDBMSs impose restrictions on the deletion of an
attribute
*
SummarySQL commands can be divided into two overall
categories: Data definition language commands Data
manipulation language commandsThe ANSI standard data types
are supported by all RDBMS vendors in different waysBasic
data definition commands allow you to create tables, indexes,
and views
*
Summary (cont..)DML commands allow you to add, modify, and
delete rows from tablesThe basic DML commands:SELECT,
INSERT, UPDATE, DELETE, COMMIT, and
ROLLBACKSELECT statement is main data retrieval command
in SQL
*
Summary (cont..)WHERE clause can be used with SELECT,
UPDATE, and DELETE statementsAggregate functionsSpecial
functions that perform arithmetic computations over a set of
rowsORDER BY clauseUsed to sort output of SELECT
statementCan sort by one or more columnsAscending or
descending order
*
Summary (cont..)Join output of multiple tables with SELECT
statementJoin performed every time you specify two or more
tables in FROM clauseIf no join condition specified, DBMX
performs Cartesian productNatural join uses join condition to
match only rows with equal values in specified columnsRight
outer join and left outer join select rows with no matching
values in other related table
*
Advanced Data UpdatesUPDATE command updates only data in
existing rowsIf relationship between entries and existing
columns, can assign values to slotsArithmetic operators useful
in data updatesIn Oracle, ROLLBACK command undoes
changes made by last two UPDATE statements
*
Advanced Data Updates
*
Copying Parts of TablesSQL permits copying contents of
selected table columnsData need not be reentered manually into
newly created table(s)First create the table structureNext add
rows to new table using table rows from another table
Copying Parts of Tables (cont..)
*
*
Adding Primary and Foreign Key DesignationsWhen table is
copied, integrity rules do not copyPrimary and foreign keys
manually defined on new tableUser ALTER TABLE
commandSyntax:
ALTER TABLE tablename
ADD PRIMARY KEY (fieldname);For foreign key, use
FOREIGN KEY in place of PRIMARY KEY
*
Deleting a Table from the DatabaseDROPDeletes table from
databaseSyntax:
DROP TABLE tablename;Can drop a table only if it is not the
“one” side of any relationshipOtherwise RDBMS generates an
error messageForeign key integrity violation
*
Advanced SELECT QueriesLogical operators work well in the
query environmentSQL provides useful functions
that:CountFind minimum and maximum valuesCalculate
averages, etc.SQL allows user to limit queries to:Entries having
no duplicatesEntries whose duplicates may be grouped
*
Ordering a ListingORDER BY clause useful when listing order
importantSyntax:
SELECT columnlist
FROM tablelist
[WHERE conditionlist]
[ORDER BY columnlist [ASC | DESC]];Ascending order
by default
Ordering a Listing
*
Ordering a Listing (cont..)
*
Ordering a Listing (cont..)
*
*
Listing Unique ValuesDISTINCT clause produces list of only
values that are different from one anotherExample:
SELECT DISTINCT V_CODE
FROM PRODUCT;Access places nulls at the top of the
listOracle places it at the bottomPlacement of nulls does not
affect list contents
Listing Unique Values
*
*
Aggregate FunctionsCOUNT function tallies number of non-null
values of an attributeTakes one parameter: usually a column
nameMAX and MIN find highest (lowest) value in a
tableCompute MAX value in inner queryCompare to each value
returned by the querySUM computes total sum for any specified
attributeAVG function format similar to MIN and MAX
Aggregate Functions
*
Aggregate Functions (cont..)
Figure 8.21 COUNT function output examples
*
Aggregate Functions (cont..)
Figure 8.22 MIN and MAX Output Examples
*
Aggregate Functions (cont..)
Figure 8.23 The total values of all items in the PRODUCT table
*
Aggregate Functions (cont..)
Figure 8.24 AVG Function Output Examples
*
*
Grouping DataFrequency distributions created by GROUP BY
clause within SELECT statementSyntax:
SELECT columnlist
FROM tablelist
[WHERE conditionlist]
[GROUP BY columnlist]
[HAVINGconditionlist]
[ORDER BY columnlist [ASC | DESC] ] ;
Grouping Data
Figure 8.25 GROUP BY Clause Output Examples
*
Grouping Data (cont..)
Figure 8.27 An application of the HAVING clause
*
*
Virtual Tables: Creating a ViewView is virtual table based on
SELECT queryCreate view by using CREATE VIEW
commandSpecial characteristics of relational view:Name of
view can be used anywhere a table name is expectedView
dynamically updatedRestricts users to only specified columns
and rowsViews may be used as basis for reports
Virtual Tables: Creating a View (cont..)
Figure 8.28 Creating a virtual table using the CREATE VIEW
command
*
*
Joining Database TablesAbility to combine (join) tables on
common attributes is most important distinction between
relational database and other databasesJoin is performed when
data are retrieved from more than one table at a timeEquality
comparison between foreign key and primary key of related
tablesJoin tables by listing tables in FROM clause of SELECT
statementDBMS creates Cartesian product of every table
Joining Database Tables (cont..)
*
Joining Database Tables (cont..)
*
*
Joining Tables with an AliasAlias identifies the source table
from which data are takenAlias can be used to identify source
tableAny legal table name can be used as aliasAdd alias after
table name in FROM clauseFROM tablename alias
Joining Database Tables (cont..)
*
*
Recursive Joins - Outer JoinsAlias especially useful when a
table must be joined to itselfRecursive queryUse aliases to
differentiate the table from itselfTwo types of outer joinLeft
outer joinRight outer join
Recursive Joins
*
Recursive Joins (cont..)
*
Outer Joins
*
Outer Joins (cont..)
*
Grouping Data (cont..)
Figure 8.26 Incorrect and Correct use of the GROUP BY Clause
*
Lect10-Conceptual, Logical and Physical.ppt
9
*
Database Principles: Fundamentals of Design, Implementations
and Management
Lecture 10 - CHAPTER 11: CONCEPTUAL, LOGICAL AND
PHYSICAL DATABASE DESIGN
*
9
*
In this chapter, you will learn:About the three stages of
database design: conceptual, logical and physical.How to design
a conceptual model to represent the business and its key
functional areas.How the conceptual model can be transformed
into a logically equivalent set of relations.How to translate the
logical data model into a set of specific DBMS table
specifications.About different types of file organization.How
indexes can be applied to improve data access and retrieval.How
to estimate data storage requirements.
*
9
*
Database DesignNecessary to focus on the dataMust
concentrate on the data characteristics required to build
database modelAt this point there are two views of data within
system:Business view of data as an information
sourceDesigner’s view of the data structure, its access, and
activities required to transform data into information
9
*
Database Design (cont..)
9
*
Database Design (cont..)
To complete the design phase, we must remember
these points:The process of database design is loosely related
to analysis and design of larger system The data component is
only one element of a larger systemSystems analysts or systems
programmers are in charge of designing other system
componentsTheir activities create procedures that will help
transform data within database into useful informationThe
Database Design does not constitute a sequential
processIterative process that provides continuous feedback
designed to trace previous steps
9
*
Database Design (cont..)
9
*
3 Stages of Database Design
*
9
*
I. Conceptual Design (CD)In the CD, Data modeling is used to
create an abstract database structure that represents real-world
objects in most realistic way possibleThe CD must embody
clear understanding of business and its functional areasEnsure
that all data needed are in the model, and that all data in the
model are neededRequires four steps:Data analysis and
requirementsEntity relationship modeling and
normalisationData model verificationDistributed database
design
9
*
I. Conceptual Design (cont..)Data Analysis and Requirements
First step is to discover the data element characteristicsObtains
characteristics from different sourcesMust take into account the
business rulesDerived from the description of operations which
is a Document that provides precise, detailed, up-to-date, and
thoroughly reviewed description of activities that define
organization’s operating environment
9
*
I. Conceptual Design (cont...)Entity Relationship (ER)
Modeling
and Normalization Designer must communicate and enforce
appropriate standards to be used in documentation of designUse
of diagrams and symbolsDocumentation writing
styleLayoutOther conventions to be followed during
documentation
9
*
I. Conceptual Design (cont..)
*
9
*
I. Conceptual Design (cont..)
Fig 11.2 in your book
9
*
I. Conceptual Design (cont..)
9
*
I. Conceptual Design (cont..)
*
9
*
I. Conceptual Design (cont..)
*
9
*
I. Conceptual Design (cont..)Entity Relationship (ER) Modeling
and
Normalization (cont…)Data dictionary Defines all objects
(entities, attributes, relations, views, and so on) Used in tandem
with the normalization process to help eliminate data anomalies
and redundancy problems
9
*
I. Conceptual Design (cont..)The Data Model Verification The
ER Model must be verified against the proposed system
processes to corroborate (confirm) that the intended processes
can be supported by the database modelA revision of the
original design starts with careful reevaluation of the entities,
followed by the detailed examination of the attributes that
describe these entitiesDefine design’s major components as
modules:A module is an information system component that
handles a specific function
9
*
I. Conceptual Design (cont..)
*
9
*
I. Conceptual Design (cont..)
*
9
*
I. Conceptual Design (cont..)Data Model Verification
(cont..)Verification process starts with:Selecting a central
(most important) entityWhich is defined in terms of its
participation in most of the model’s relationshipsThe next step
is to identify the module or subsystem to which central entity
belongs and to define boundaries and scopeOnce the module is
identified, the central entity is placed within module’s
framework
9
*
I. Conceptual Design (cont..)Distributed Database
DesignPortions of the database may reside in different physical
locationsDesigner must also develop data distribution and
allocation strategies
9
*
II. DBMS Software SelectionThe selection of the software is
critical to an information system’s smooth operationAdvantages
and disadvantages should be carefully studiedSome common
factors that may affect the purchasing decision are:CostDBMS
features and toolsUnderlying model: Hierarchical, network,
relational etc…PortabilityDBMS requirements
9
*
III. Logical DesignUsed to translate the conceptual design into
internal model for selected database management systemLogical
design is software-dependentRequires that all objects in the
model be mapped to specific constructs used by selected
database software
9
*
III. Logical Design (cont..)Used to translate the conceptual
design into internal model for the selected database management
systemLogical design is software-dependentThe logical design
stage consists of the following phases:
Creating the logical data model.
Validating the logical data model using normalization.
Assigning and validating integrity constraints.
Merging logical models constructed for different parts for the
database together.
Reviewing the logical data model with the user.
*
9
*
III. Logical Design (cont..)
9
*
III. Logical Design (cont…)
9
*
Review the complete logical model with the userReviewing the
completed logical model with the users to ensure that all the
data requirements have been modelled Ensure that all the
transactions are supported within the different user views. This
stage is very important as any problems need to be solved
before beginning the physical database design stage.
*
9
*
IV. Physical Database DesignPhysical database design requires
the definition of specific storage or access methods that will be
used by the database. Involves the translation of the logical
model into a set of specific DBMS specifications for storing and
accessing data.The ultimate goal must be to ensure that data
storage is effective to ensure integrity and security and efficient
in terms of query response time.
*
9
*
IV. Physical Design (cont..)Is the process of selecting data
storage and data access characteristics of the databaseThe
storage characteristics are a function of device types supported
by the hardware, the type of data access methods supported by
the system, and DBMSParticularly important in older
hierarchical and network modelsBecomes more complex when
data are distributed at different locations
9
*
IV. Physical Database Design (cont..)
The following information needs to have been collected:
A set of normalized relations devised from the ER model and
the normalization process.
An estimate of the volume of data which will be stored in each
database table and the usage statistics.
An estimate of the physical storage requirements for each field
(attribute) within the database.
The physical storage characteristics of the DBMS that are being
used
*
9
*
Stages of Physical Database Design
Analysing data volume and database usage.
Translate each relation identified in the logical data model into
a table.
Determine a suitable file organization.
Define indexes.
Define user views.
Estimate data storage requirements.
Determine database security for users.
Additional slides are after the summary
*
9
*
Analysing Data Volume and Database UsageThe steps required
to carrying out this phase are:
Identifying the most frequent and critical transactions.
Analysis of critical transactions to determine which relations in
the database participate in these transactions.
*
9
*
Analysing Data Volume and Database Usage (cont….)Data
volume and data usage statistics are usually shown on a
simplified version of the ERD. This diagram is known as a
composite usage map or a transaction usage map.
*
9
*
Analysing Data Volume and Database Usage (cont….)
*
9
*
Translate logical relations into tables
Identify the primary and any foreign keys for each table.
Identify those attributes which are not allowed to contain NULL
values and those which should be UNIQUE. You can exclude
the primary key attribute(s) here as the PRIMARY KEY
constraint automatically imposes the NOT NULL and UNIQUE
constraints.
*
9
*
Translate logical relations into tablesFor each relation you
should:
Identify each attribute name and its domain from the data
dictionary. Note any attributes which require DEFAULT values
to be inserted into the attribute whenever new rows are inserted
into the database.
Determine any attributes that require a CHECK constraint in
order to validate the value of the attribute.
*
9
*
Translate logical relations into tables (continued)
*
9
*
Translate logical relations into tables (cont..)
*
9
*
Determine Suitable File OrganisationSelecting the most suitable
file organization is very important to ensure that the data is
stored efficiently and data can be retrieved as quickly as
possible.To do this the DBMS must know where this record is
stored and how it can identify it. Look at the future growth of
the database and whether the type of file organization provides
some protection against data loss.
*
9
*
Determine Suitable File Organisation (cont..)There are three
categories of file organizations:files which contain randomly
ordered records known as heap filesfiles which are sorted on
one or more fields such as file organizations which are based on
indexesfiles hashed on one or more fields known as hash files.
*
9
*
Determine Suitable File Organisation (cont..)Sequential File
OrganizationsRecords are stored in a sequence based on the
value of one or more fields which is often the primary key. In
order to locate a specific record the whole file must be searched
and every record in the file must be read in turn until the
required record is located.
*
9
*
Determine Suitable File Organisation (cont..)Heap File
OrganizationsRecords are unordered and inserted into the file as
they come. Only used when a large quantity of data needs to be
inserted into a table for the first time.
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)Indexed File
OrganizationsRecords can be stored in a sorted or unsorted
sequence and an index is created locate specific records
quickly.
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)Types of
IndexesPrimary index —these indexes are placed on unique
fields such as the primary key.Secondary index —these indexes
can be placed on any field in the file that is unordered.Multi-
level index —is used where one index becomes too large and so
is split into a number of separate indexes in order to reduce the
search.
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)B-treesBalanced or
B-trees and are used to maintain an ordered set of indexes or
data to allow efficient operations to select, delete and insert
data.A special kind of B-tree is known as the B+-tree where all
keys reside in the leaves. This tree is mostoften used to
represent indexes which act as a ‘road_map’ so that each index
can be quickly located
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Conceptual Design of the DVD rental store
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)Bitmap
IndexesBitmap indexes are usually applied to attributes which
are sparse in their given domain.A two-dimensional array is
constructed. One column is generated for every row in the table
which we want to index with each column representing a
distinct value within the bitmapped index. The two-dimensional
array represents each value within the index multiplied by the
number of rows in the table.
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)Bitmap indexes are
usually used when:A column in the table has low cardinality.
The table is not used often for data manipulation activities and
is large.Specific SQL queries reference a number of low
cardinality values in their where clauses.
*
9
*
Determine Suitable File Organisation (cont..)Join IndexCan be
applied to columns from two or more tables whose values come
from the same domain. It is often referred to as a bitmap join
index and it is a way of saving space by reducing the volume of
data that must be joined. The bitmap join stores the ROWIDS of
corresponding rows in a separate table.
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)
*
9
*
Determine Suitable File Organisation (cont..)Hashed File
OrganizationsUses a hashing algorithm to map a primary key
value onto a specific record address in the file. Records are
stored in a random order throughout the file. Often referred to
as random or direct files.
*
9
*
Define Indexes (cont..)In SQL, indexes are created using the
CREATE INDEX statement. For example, if we wanted to
create a primary index on the DVD_ID primary key field from
the DVDs table the SQL would be:
CREATE UNIQUE INDEX DVDINDEX ON
DVD(DVD_ID)
*
9
*
Define Indexes (cont..)As a general rule, indexes are likely to
be used:When an indexed column appears by itself in a search
criteria of a WHERE or HAVING clause.When an indexed
column appears by itself in a GROUP BY or ORDER BY
clause.When a MAX or MIN function is applied to an indexed
column.When the data sparsity on the indexed column is high.
*
9
*
Guidelines for creating IndexesCreate indexes for each single
attribute used in a WHERE, HAVING, ORDER BY, or GROUP
BY clause.Do not use indexes in small tables or tables with low
sparsity.Declare primary and foreign keys so the query
optimizer within a specific DBMS can use the indexes in join
operations.Declare indexes in join columns other than PK/FK.
*
9
*
Define User ViewsDuring the conceptual design stage the
different user views required for the database are
determined.Using the relations defined in the logical data
model, these views must now be defined. Views are often
defined taking database security into account as they can help to
define the roles of different types of users.
*
9
*
Estimate Data Storage Requirements
*
9
*
SecurityData must be protected from access by unauthorized
usersMust provide for following: Physical securityPassword
securityAccess rightsAudit trailsData encryptionDiskless
workstations
9
*
Determine database security for usersDuring physical database
design security requirements must be implementedDatabase
privileges for users will need to be established. For example,
privileges may include selecting rows from specified tables or
views, being able to modify or delete data in specified tables
etc.
*
9
*
Determine database security for usersDuring physical database
design security requirements must be implementedDatabase
privileges for users will need to be established. For example,
privileges may include selecting rows from specified tables or
views, being able to modify or delete data in specified tables
etc.
*
9
*
Security in ORACLEThe SQL commands GRANT and REVOKE
are used to authorize or withdraw privileges on specific user
accounts. For example, the following two SQL statements grant
the account with the username ‘Craig’ the ability to select rows
from the DVD table and the ability to create tables.
GRANT SELECT ON DVD TO Craig;
GRANT CREATE TABLE TO Craig;
*
9
*
Security in ORACLE (cont..)Removing these privileges can be
done using the following SQL statements:
REVOKE SELECT ON MOVIE FROM Craig;
REVOKE CREATE TABLE FROM Craig;
*
9
*
Security in ORACLE (cont..)A role is simply a collection of
privileges referred to under a single name. The major benefit of
roles is that a DBA can add or revoke privileges from a role at
any time. These changes will then automatically apply to all the
users who have been assigned that role.
*
9
*
Security in ORACLE (cont..)For example, in the DVD rental
store, the sales staff need to perform SELECT and UPDATE
operations on the CUSTOMER table. The SQL command
CREATE ROLE is used to create the role
STAFF_CUSTOMER_ROLE:CREATE ROLE
STAFF_CUSTOMER_ROLE;Once created, privileges can then
be granted on selected database objects to the new role.
*
9
*
Security in ORACLE (cont..)For example:
GRANT SELECT ON CUSTOMERS TO
STAFF_CUSTOMER_ROLE;
GRANT UPDATE ON CUSTOMERS TO
STAFF_CUSTOMER_ROLE;The last stage then involves
granting the role to individual users accounts, e.g. Frank:
GRANT STAFF_CUSTOMER_ROLE TO Frank;
*
9
*
SummaryConceptual database design is where the conceptual
representation of the database is created by producing a data
model which identifies the relevant entities and relationships
within the system.
*
9
*
Summary (cont..)Logical database design is the second stage in
the Database Life Cycle, where relations are designed based on
each entity and its relationships within the conceptual model.
*
9
*
Summary (cont..)Physical database design is where the logical
data model is mapped onto the physical database tables to be
implemented in the chosen DBMS. The ultimate goal must be to
ensure that data storage is used effectively, to ensure integrity
and security and to improve efficiency in terms of query
response time.
*
9
*
Summary (cont…)Selecting a suitable file organization is
important for fast data retrieval and efficient use of storage
space.Indexes are crucial in speeding up data access. Indexes
facilitate searching, sorting, and using aggregate functions and
even join operations.
*
Chap 2.pptx
Database Principles: Fundamentals of Design, Implementations
and Management
CHAPTER 2: DATA MODELS
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
20/03/2017
1
In this chapter, you will learn:
Why data models are important
About the basic data-modeling building blocks
What business rules are and how they influence database design
How the major data models evolved
How data models can be classified by level of abstraction
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
2
20/03/2017
The Importance of Data Models
Data models
Relatively simple representations, usually graphical, of complex
real-world data structures
Facilitate interaction among the designer, the applications
programmer, and the end user
End-users have different views and needs for data
Data model organizes data for various users
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
3
20/03/2017
Data Model Basic Building Blocks
Entity - anything about which data are to be collected and
stored
Attribute - a characteristic of an entity
Relationship - describes an association among entities
One-to-many (1:*) relationship
Many-to-many (*:*) relationship
One-to-one (1:1) relationship
Constraint - a restriction placed on the data
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
4
20/03/2017
Business Rules
A business rule is a brief, precise, and unambiguous
descriptions of a policies, procedures, or principles within a
specific organization
Apply to any organization that stores and uses data to generate
information
Description of operations that help to create and enforce actions
within that organization’s environment
Must be rendered in writing
Must be kept up to date
Sometimes are external to the organization
Must be easy to understand and widely disseminated
Describe characteristics of the data as viewed by the company
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
5
20/03/2017
Discovering Business Rules
Sources of Business Rules:
Company managers
Policy makers
Department managers
Written documentation
Procedures
Standards
Operations manuals
Direct interviews with end users
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
6
20/03/2017
Translating Business Rules into Data Model Components
Standardize company’s view of data
Constitute a communications tool between users and designers
Allow designer to understand the nature, role, and scope of data
Allow designer to understand business processes
Allow designer to develop appropriate relationship participation
rules and constraints
Promote creation of an accurate data model
Generally, nouns translate into entities
Verbs translate into relationships among entities
Relationships are bi-directional
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
7
20/03/2017
The Evolution of Data Models
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
8
20/03/2017
The Evolution of Data Models (cont..)
Hierarchical
Network
Relational
Entity relationship
Object oriented (OO)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
9
20/03/2017
The Hierarchical Model
Developed in the 1960s to manage large amounts of data for
complex manufacturing projects
Basic logical structure is represented by an upside-down “tree”
The hierarchical structure contains levels, or segments
Depicts a set of one-to-many (1:*) relationships between a
parent and its children segments
Each parent can have many children
each child has only one parent
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
10
20/03/2017
The Hierarchical Model (cont…)
Advantages
Many of the hierarchical data model’s features formed the
foundation for current data models
Its database application advantages are replicated, though in a
different form, in current database environments
Generated a large installed (mainframe) base, created a pool of
programmers who developed numerous tried-and-true business
applications
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
11
Albeit= Bien que , quoique que , though
20/03/2017
The Hierarchical Model (cont..)
Disadvantages
Complex to implement
Difficult to manage
Lacks structural independence
Implementation limitations
Lack of standards
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
12
20/03/2017
The Network Model
Created to
Represent complex data relationships more effectively than the
hierarchical model
Improve database performance
Impose a database standard
While the Network model is not used today, the definitions of
standard database concepts are still used by modern data models
such as:
Schema
Conceptual organization of entire database as viewed by the
database administrator
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
13
20/03/2017
The Network Model (cont..)
Subschema
Defines database portion “seen” by the application programs
that actually produce the desired information from data
contained within the database
Data Management Language (DML)
Defines the environment in which data can be managed and is
used to work with the data in the database
Schema Data Definition Language (DDL)
Enables database administrator to define schema components
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
14
20/03/2017
The Network Model (cont..)
Disadvantages
Too cumbersome
The lack of ad hoc query capability put heavy pressure on
programmers
Any structural change in the database could produce havoc in
all application programs that drew data from the database
Many database old-timers can recall the interminable
information delays
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
15
20/03/2017
The Relational Model
Developed by Codd (IBM) in 1970
Considered ingenious but impractical in 1970
Conceptually simple
Computers lacked power to implement the relational model
Today, microcomputers can run sophisticated Relational
Database Software called Relational Database Management
System (RDBMS)- Ex: Oracle : mainframe relational software
Performs same basic functions provided by hierarchical and
network DBMS systems, in addition to a host of other functions
Most important advantage of the RDBMS is its ability to hide
the complexities of the relational model from the user
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
16
20/03/2017
The Relational Model (cont..)
Table
Matrix consisting of a series of row/column intersections
Related to each other through sharing a common entity
characteristic
Tables, also called relations are related to each other through
the sharing of a common field
Relational diagram
Is a representation of relational database’s entities, attributes
within those entities, and relationships between those entities
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
17
20/03/2017
The Relational Model (cont..)
Relational Table
Stores a collection of related entities
Resembles a file
Relational table is purely a logical structure
How data are physically stored in the database is of no concern
to the user or the designer
This property became the source of a real database revolution
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
18
20/03/2017
The Relational Model (cont..)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
19
20/03/2017
The Relational Model (continued)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
20
20/03/2017
The Relational Model (cont..)
Another raison for the database model’s rise to dominance is its
powerful and flexible query language
Structured Query Language (SQL) allows the user to specify
what must be done without specifying how it must be done
SQL-based relational database application involves 3 parts:
User interface
A set of tables stored in the database
SQL engine
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
21
20/03/2017
The Entity Relationship Model
Widely accepted and adapted graphical tool for data modeling
Introduced by Peter Chen in 1976
It was the graphical representation of entities and their
relationships in a database structure.
More recently the class diagram component of the Unified
Modeling Language (UML) has been used to produce entity
relationship models.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
22
20/03/2017
The Entity Relationship Model (cont..)
Entity relationship diagram (ERD)
Uses graphic representations to model database components
Entity is mapped to a relational table
Entity instance (or occurrence) is a row in table
Each entity is described by a set of attributes that describe
particular characteristics of the entity
Entity set is collection of like entities
Connectivity labels types of relationships (1-1, 1- M, M-M)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
23
20/03/2017
The Entity Relationship Model (cont..)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
24
20/03/2017
The Entity Relationship Model (cont..)
Fig 2.4 The basic Crow’s foot ERD
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
25
20/03/2017
Data Models: A Summary
Each new data model capitalized on the shortcomings of
previous models
Common characteristics that data models must have in order to
be widely accepted:
Conceptual simplicity without compromising the semantic
completeness of the database
Represent the real world as closely as possible
Representation of real-world transformations (behavior) must
comply with consistency and integrity characteristics of any
data model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
26
20/03/2017
Data Models: A Summary (cont..)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
27
20/03/2017
Degrees of Data Abstraction
Way of classifying data models
Many processes begin at high level of abstraction and proceed
to an ever-increasing level of detail
Designing a usable database follows the same basic process
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
28
20/03/2017
Degrees of Data Abstraction (cont..)
In the early 1970s, the American National Standards Institute
(ANSI) Standards Planning and Requirements Committee
(SPARC)
Defined a framework for data modeling based on degrees of
data abstraction:
External
Conceptual
Internal
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
29
20/03/2017
Degrees of Data Abstraction (cont..)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
30
20/03/2017
The External Model
End users’ view of the data environment
Requires that the modeler subdivide set of requirements and
constraints into functional modules that can be examined within
the framework of their external models
Advantages:
Easy to identify specific data required to support each business
unit’s operations
Facilitates designer’s job by providing feedback about the
model’s adequacy
Creation of external models helps to ensure security constraints
in the database design
Simplifies application program development
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
31
20/03/2017
The External Model (cont..)
Fig 2.9 External Models for Tiny College
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
32
20/03/2017
The External Model (cont..)
Fig 2.9 External Models for Tiny College
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
33
20/03/2017
The Conceptual Model
Represents global view of the entire database
Representation of data as viewed by the entire organization
The conceptual is the basis for identification and high-level
description of main data objects, avoiding details
Most widely used conceptual model is the entity relationship
(ER) model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
34
20/03/2017
The Conceptual Model (cont..)
Fig 2.10 The Conceptual Model for Tiny College
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
35
20/03/2017
The Conceptual Model (cont..)
First, the CM provides a relatively easily understood macro
level view of data environment
Second, the CM is independent of both software and hardware
Does not depend on the DBMS software used to implement the
model
Does not depend on the hardware used in the implementation of
the model
Changes in either hardware or DBMS software have no effect on
the database design at the conceptual level
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
36
20/03/2017
The Internal Model
Is the representation of the database as “seen” by the DBMS
The internal model should map the conceptual model to the
DBMS
The internal schema depicts a specific representation of an
internal model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
37
20/03/2017
Fig 2.11 An Internal Model for Tiny College
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
38
20/03/2017
The Physical Model
Operates at lowest level of abstraction, describing the way data
are saved on storage media such as disks or tapes
Software and hardware dependent
Requires that database designers have a detailed knowledge of
the hardware and software used to implement database design
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
39
20/03/2017
The Physical Model (cont..)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
40
20/03/2017
Summary
A data model is a (relatively) simple abstraction of a complex
real-world data environment
Basic data modeling components are:
Entities
Attributes
Relationships
Constraints
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
41
20/03/2017
Summary (cont..)
Hierarchical model
Depicts a set of one-to-many (1:*) relationships between a
parent and its children segments
Network data model
Uses sets to represent 1:* relationships between record types
Relational model
Current database implementation standard
ER model is a popular graphical tool for data modeling that
complements the relational model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
42
20/03/2017
Summary (cont..)
Object is basic modeling structure of object oriented data model
The relational model has adopted many object-oriented
extensions to become the extended relational data model
(ERDM)
Data modeling requirements are a function of different data
views (global vs. local) and level of data abstraction
NoSQL databases are a new generation of databases that do not
use the relational model and are geared to support the very
specific needs of Big Data organizations
Additional slides are next
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
43
20/03/2017
The Object Oriented Model
Modeled both data and their relationships in a single structure
known as an object
Object-oriented data model (OODM) is the basis for the object-
oriented database management system (OODBMS)
OODM is said to be a semantic data model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
44
20/03/2017
The Object Oriented Model (cont..)
Object described by its factual content
Like relational model’s entity
Includes information about relationships between facts within
object, and relationships with other objects
Unlike relational model’s entity
Subsequent OODM development allowed an object to also
contain all operations
Object becomes basic building block for autonomous structures
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
45
20/03/2017
The Object Oriented Model (cont..)
Object is an abstraction of a real-world entity
Attributes describe the properties of an object
Objects that share similar characteristics are grouped in classes
Classes are organized in a class hierarchy
Inheritance is the ability of an object within the class hierarchy
to inherit the attributes and methods of classes above it
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
46
20/03/2017
The Object Oriented Model (cont..)
Fig 2.5 A comparison of the OO model and the ER model
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
47
20/03/2017
Other Models
Extended Relational Data Model (ERDM)
Semantic data model developed in response to increasing
complexity of applications
DBMS based on the ERDM often described as an
object/relational database management system (O/RDBMS)
Primarily geared to business applications
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
48
20/03/2017
Emerging Data Models: Big Data and NoSQL
Big Data refers to a movement to find new and better ways to
manage large amounts of Web-generated data and derive
business insight from it, while simultaneously providing high
performance and scalability at a reasonable cost.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
Emerging Data Models: Big Data and NoSQL (cont…)
The relational approach does not always match the needs of
organizations with Big Data challenges.
It is not always possible to fi t unstructured, social media data
into the conventional relational structure of rows and columns.
Adding millions of rows of multi-format (structured and
nonstructured) data on a daily basis will
inevitably lead to the need for more storage, processing power,
and sophisticated data analysis
tools that may not be available in the relational environment.
The type of high-volume implementations required in the
RDBMS environment
for the Big Data problem comes with a hefty price tag for
expanding hardware, storage, and software licenses.
Data analysis based on OLAP tools has proven to be very
successful in relational environments with highly structured
data.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
Database Models and the Internet
Internet drastically changed role and scope of database market
OODM and ERDM-O/RDM have taken a backseat to
development of databases that interface with Internet
Dominance of Web has resulted in growing need to manage
unstructured information
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
51
20/03/2017
NoSQL Databases
NoSQL to refer to a new generation of databases that address
the specific challenges of the Big Data era.
They have the following general characteristics:
Not based on the relational model, hence the name NoSQL.
Supports distributed database architectures.
Provides high scalability, high availability, and fault tolerance.
Supports very large amounts of sparse data.
Geared toward performance rather than transaction consistency.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
NoSQL Databases (cont..)
The key-value data model is based on a structure composed of
two data elements: a key and a value, in which every key has a
corresponding value or set of values.
The key-value data model is also referred to as the attribute-
value or associative data model.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
NoSQL Databases (cont…)
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
NoSQL Databases (cont..)
The data type of the “value” column is generally a long string to
accommodate the variety of actual data types of the values
placed in the column.
To add a new entity attribute in the relational model, you need
to modify the table definition.
To add a new attribute in the key-value store, you add a row to
the key-value store, which is why it is said to be “schema-less.”
NoSQL databases do not store or enforce relationships among
entities.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
NoSQL Databases (cont..)
NoSQL databases use their own native application programming
interface (API) with simple data access commands, such as put,
read, and delete.
Indexing and searches can be difficult. Because the “value”
column in the key-value data model could contain many
different data types, it is often difficult to create indexes on the
data. At the same time, searches can become very complex.
Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
© 2013 Cengage Learning EMEA
Lecture7_ch07.ppt
Database Principles: Fundamentals of Design, Implementations
and Management
CHAPTER 7 Normalizing Database Designs
*
ObjectivesIn this chapter, you will learn:What normalization is
and what role it plays in the database design processAbout the
normal forms 1NF, 2NF, 3NF, BCNF,
and 4NFHow normal forms can be transformed from lower
normal forms to higher normal formsThat normalization and ER
modeling are used concurrently to produce a good database
designThat some situations require denormalization to generate
information efficiently
*
Database Tables and NormalizationNormalization Process for
evaluating and correcting table structures to minimize data
redundanciesReduces data anomaliesWorks through a series of
stages called normal forms: First normal form (1NF)Second
normal form (2NF)Third normal form (3NF)
*
Database Tables and Normalization (cont..)Normalization
(cont..)2NF is better than 1NF; 3NF is better than 2NFFor most
business database design purposes, 3NF is as high as needed in
normalizationHighest level of normalization is not always most
desirableDenormalization produces a lower normal formPrice
paid for increased performance is greater data redundancy
*
The Need for NormalizationExample: company that manages
building projectsCharges its clients by billing hours spent on
each contractHourly billing rate is dependent on employee’s
positionPeriodically, report is generated that contains
information such as displayed in Table 5.1
The Need for Normalization
*
The Need for Normalization
*
*
The Need for Normalization (cont..)Structure of data set in
Figure 7.1 does not handle data very wellTable structure
appears to work; report generated with easeUnfortunately report
may yield different results depending on what data anomaly has
occurredRelational database environment suited to help designer
avoid data integrity problems
*
The Normalization ProcessEach table represents a single
subjectNo data item will be unnecessarily stored in more than
one tableAll attributes in a table are dependent on the primary
keyEach table void of insertion, update, deletion anomalies
Void = depourvu de
*
The Normalization Process (cont..)
*
*
The Normalization Process (cont..)Objective of normalization is
to ensure all tables in at least 3NFHigher forms not likely to be
encountered in business environmentNormalization works one
relation at a timeProgressively breaks table into new set of
relations based on identified dependencies
*
Conversion to First Normal FormRepeating groupDerives its
name from the fact that a group of multiple entries of same type
can exist for any single key attribute occurrenceRelational table
must not contain repeating groupsNormalizing table structure
will reduce data redundanciesNormalization is three-step
procedure
*
Conversion to First Normal Form (cont.)Step 1: Eliminate the
Repeating Groups Present data in tabular format, where each
cell has single value and there are no repeating groupsEliminate
nulls: each repeating group attribute contains an appropriate
data value
Step 2: Identify the Primary Key Primary key must uniquely
identify attribute valueNew key must be composed
Conversion to First Normal Form (cont..)
*
Conversion to First Normal Form (cont..)
*
Conversion to First Normal Form (cont..)Step 3: Identify All
Dependencies Dependencies can be depicted with help of a
diagramDependency diagram: Depicts all dependencies found
within given table structureHelpful in getting bird’s-eye view of
all relationships among table’s attributesMakes it less likely
that will overlook an important dependency
*
Conversion to First Normal Form (cont..)
*
*
Conversion to First Normal Form (cont.)First normal form
describes tabular format in which:All key attributes are
definedThere are no repeating groups in the tableAll attributes
are dependent on primary keyAll relational tables satisfy 1NF
requirementsSome tables contain partial
dependenciesDependencies based on part of the primary
keySometimes used for performance reasons, but should be used
with cautionStill subject to data redundancies
Conversion to Second Normal FormRelational database design
can be improved by converting the database into second normal
form (2NF)Two steps
*
*
Conversion to Second Normal Form (cont..)Step 1: Write Each
Key Component
on a Separate Line Write each key component on separate line,
then write original (composite) key on last lineEach component
will become key in new table
Step 2: Assign Corresponding Dependent Attributes Determine
those attributes that are dependent on other attributesAt this
point, most anomalies have been eliminated
Conversion to Second Normal Form (cont..)
*
*
Conversion to Second Normal Form (cont..)Table is in second
normal form (2NF) when:It is in 1NF and It includes no partial
dependencies:No attribute is dependent on only portion of
primary key
*
Conversion to Third Normal FormData anomalies created are
easily eliminated by completing three stepsStep 1: Identify Each
New Determinant For every transitive dependency, write its
determinant as PK for new tableDeterminant: any attribute
whose value determines other values within a row
Conversion to Third Normal Form (cont..)Step 2: Identify the
Dependent Attributes Identify attributes dependent on each
determinant identified in Step 1 and identify dependency
Name table to reflect its contents and function
*
*
Conversion to Third Normal Form (cont.)Step 3: Remove the
Dependent Attributes from Transitive Dependencies Eliminate
all dependent attributes in transitive relationship(s) from each
of the tablesDraw new dependency diagram to show all tables
defined in Steps 1–3Check new tables as well as tables modified
in Step 3 to make sure that:Each table has a determinant and
thatNo table contains inappropriate dependencies
Conversion to Third Normal Form (cont..)
*
*
Conversion to Third Normal Form (cont.)A table is in third
normal form (3NF) when both of the following are true:It is in
2NFIt contains no transitive dependencies
*
Improving the DesignTable structures are cleaned up to
eliminate troublesome initial partial and transitive dependencies
Normalization cannot, by itself, be relied on to make good
designs
It is valuable because its use helps eliminate data redundancies
*
Improving the Design (cont..)Issues to address in order to
produce a good normalized set of tables: Evaluate PK
AssignmentsEvaluate Naming ConventionsRefine Attribute
AtomicityIdentify New AttributesIdentify New
RelationshipsRefine Primary Keys as Required for Data
GranularityMaintain Historical AccuracyEvaluate Using
Derived Attributes
Improving the Design (cont..)
*
Improving the Design (cont..)
*
Improving the Design (cont..)
*
*
Surrogate Key ConsiderationsWhen primary key is considered
to be unsuitable, designers use surrogate keysData entries in
Table 7.3 are inappropriate because they duplicate existing
recordsYet there has been no violation of either entity integrity
or referential integrity
*
Higher-Level Normal FormsTables in 3NF perform suitably in
business transactional databasesHigher order normal forms
useful on occasionTwo special cases of 3NF:Boyce-Codd
normal form (BCNF)Fourth normal form (4NF)
*
The Boyce-Codd Normal Form (BCNF)Every determinant in
table is a candidate keyHas same characteristics as primary key,
but for some reason, not chosen to be primary keyWhen table
contains only one candidate key, the 3NF and the BCNF are
equivalentBCNF can be violated only when table contains more
than one candidate key
*
The Boyce-Codd Normal Form (BCNF) (cont..)Most designers
consider the BCNF as special case of 3NFTable is in 3NF when
it is in 2NF and there are no transitive dependenciesTable can
be in 3NF and fails to meet BCNFNo partial dependencies, nor
does it contain transitive dependenciesA nonkey attribute is the
determinant of a key attribute
The Boyce-Codd Normal Form (BCNF) (cont...)
*
The Boyce-Codd Normal Form (BCNF) (cont..)
*
The Boyce-Codd Normal Form (BCNF) (cont..)
*
*
SummaryNormalization is used to minimize data
redundanciesFirst three normal forms (1NF, 2NF, and 3NF) are
most commonly encounteredTable is in 1NF when:All key
attributes are definedAll remaining attributes are dependent on
primary key
*
Summary (continued)Table is in 2NF when it is in 1NF and
contains no partial dependenciesTable is in 3NF when it is in
2NF and contains no transitive dependenciesTable that is not in
3NF may be split into new tables until all of the tables meet
3NF requirementsNormalization is important part—but only
part—of the design process
*
Summary (continued)Table in 3NF may contain multivalued
dependencies Numerous null values or redundant dataConvert
3NF table to 4NF by:Splitting table to remove multivalued
dependenciesTables are sometimes denormalized to yield less
I/O, which increases processing speed
Additional SlidesPlease have a look a the following slides
*
*
Fourth Normal Form (4NF)Table is in fourth normal form (4NF)
when both of the following are true:It is in 3NF No multiple
sets of multivalued dependencies4NF is largely academic if
tables conform to following two rules:All attributes dependent
on primary key, independent of each otherNo row contains two
or more multivalued facts about an entity
Fourth Normal Form (4NF) (continued)
*
*
Fourth Normal Form (4NF)
Fourth Normal Form (4NF)
*
*
Normalization and Database DesignNormalization should be
part of the design processMake sure that proposed entities meet
required normal form before table structures are createdMany
real-world databases have been improperly designed or
burdened with anomaliesYou may be asked to redesign and
modify existing databases
*
Normalization and Database Design (cont.)ER diagram Identify
relevant entities, their attributes, and their relationshipsIdentify
additional entities and attributesNormalization procedures
Focus on characteristics of specific entitiesMicro view of
entities within ER diagramDifficult to separate normalization
process from ER modeling processTwo techniques should be
used concurrently
Figure 7.13 in your book
*
Normalization and Database Design (cont.)
Figure 7.13 in your book
*
Normalization and Database Design (cont.)
Figure 7.14 in your book
Figure 7.14 in your book
*
Figure 7.15 in your book
Normalization and Database Design (cont.)
Figure 7.15 in your book
Normalization and Database Design (continued)
*
Normalization and Database Design (continued)
*
Normalization and Database Design (continued)
*
*
*
Void = depourvu de
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Lecture9-Chap10- Database Development Process.pptx
Database Principles: Fundamentals of Design, Implementations
and Management
Lecture9-CHAPTER 10 : Database Development Process
In this chapter, you will learn:
That successful database design must reflect the information
system of which the database is a part
That successful information systems are developed within a
framework known as the Systems Development Life Cycle
(SDLC)
That within the information system, the most successful
databases are subject to frequent evaluation and revision within
a framework known as the Database Life Cycle (DBLC)
How to conduct evaluation and revision within the SDLC and
DBLC frameworks
2
In this chapter, you will learn (cont..):
About database design strategies: top-down vs. bottom-up
design and centralized vs. decentralized design
Common threats to the security of the data and what security
measures could be put in place
The importance of the database administration in an
organization
The technical and managerial roles of the database
administrator (DBA)
3
The Information System
Provides for data collection, storage, and retrieval
Composed of people, hardware, software, database(s),
application programs, and procedures
Systems analysis
Is the process that establishes the need for and extent of an
information system
Systems development
Is the process of creating information system
4
The Information System (cont..)
Applications
Transform data into information that forms the basis for
decision making
Usually produce the following:
Formal report
Tabulations
Graphic displays
Composed of following two parts:
Data
Code by which data are transformed into information
5
The Information System (cont..)
6
The Information System (cont..)
Information system performance depends on triad of factors:
Database design and implementation
Application design and implementation
Administrative procedures
Database development
Is the process of database design and implementation
The primary objective is to create complete, normalized, non-
redundant (to the extent possible), and fully integrated
conceptual, logical, and physical database models
7
The Systems Development Life Cycle (SDLC)
Traces history (life cycle) of information system
Provides “big picture” within which database design and
application development can be mapped out and evaluated
Divided into following five phases:
Planning
Analysis
Detailed systems design
Implementation
Maintenance
Iterative rather than sequential process
8
The Systems Development Life Cycle (SDLC) (cont..)
9
Planning
Yields a general overview of the company and its objectives
Is an initial assessment made of information-flow-and-extent
requirements
Must begin to study and evaluate alternate solutions
Technical aspects of hardware and software requirements
System cost
10
Analysis
The problems defined during planning phase are examined in
greater detail during analysis
Thorough audit of user requirements
The existing hardware and software systems are studied
Goal is a better understanding of :
system’s functional areas,
The actual and potential problems,
and opportunities
11
Analysis (cont..)
Includes the creation of logical system design
Must specify appropriate conceptual data model, inputs,
processes, and expected output requirements
Might use tools such as data flow diagrams (DFDs), hierarchical
input process output (HIPO) diagrams, and entity relationship
(ER) diagrams
Yields functional descriptions of system’s components
(modules) for each process within database environment
12
Detailed Systems Design
The designer completes the design of the system’s processes
Includes all necessary technical specifications
The steps are laid out for conversion from old to new system
The training principles and methodologies are also planned
Submitted for management approval
13
Implementation
Hardware, DBMS software, and application programs are
installed,
and the database design is implemented
The system enters into:
A cycle of coding,
Testing, and debugging continues until it is ready to be
delivered
The actual database is created and the system is customized by
creation of tables and views,
and user authorizations
14
Maintenance
Maintenance activities can be grouped into three types:
Corrective maintenance in response to systems errors
Adaptive maintenance due to changes in business environment
Perfective maintenance to enhance system
Computer-assisted systems engineering (CASE)
Make it possible to produce better systems within reasonable
amount of time and at reasonable cost
CASE-produced applications are structured, documented,
standardized
15
16
The Database Life Cycle (DBLC)
Six phases:
Database initial study
Database design
Implementation and loading
Testing and evaluation
Operation
Maintenance and evolution
The Database Life Cycle (DBLC)
17
The Database Initial Study
Overall purpose:
Analyze company situation
Define problems and constraints
Define objectives
Define scope and boundaries
Fig 10.4 in the next slide depicts the interactive and iterative
processes required to complete first phase of DBLC successfully
18
The Database Initial Study (cont..)
Fig 10.4 in your book
19
Analyze the Company Situation
Analysis–To break up any whole into its parts so as to find out
their nature, function, and so on
Company situation
General conditions in which company operates, its
organizational structure, and its mission
Analyze company situation
Discover what company’s operational components are, how they
function, and how they interact
20
Define Problems and Constraints
Managerial view of company’s operation is often different from
that of end users
The Database Designer must continue to carefully probe to
generate additional information that will help define problems
within larger framework of company operations
Finding precise answers is important
Defining problems does not always lead to perfect solution
21
Define Objectives
Designer must ensure that database system objectives
correspond to those envisioned by end user(s)
Designer must begin to address following questions:
What is proposed system’s initial objective?
Will system interface with other existing or future systems in
the company?
Will system share data with other systems or users?
22
Define Scope and Boundaries
Scope
Defines extent of design according to operational requirements
Helps define required data structures, type and number of
entities, and physical size of database
Boundaries
Limits external to system
Often imposed by existing hardware and software
23
Database Design
Necessary to concentrate on data
Characteristics required to build database model
Two views of data within system:
Business view of
data as information source
Designer’s view of
data structure, its access, and activities required to transform
data into information
24
Database Design (cont..)
Fig 10.5 in your book
25
Database Design (cont..)
Loosely related to analysis and design of larger system
The Systems analysts or systems programmers are in charge of
designing other system components
Their activities create procedures that will help transform data
within database into useful information
Does not constitute sequential process
Iterative process that provides continuous feedback designed to
trace previous steps
26
Database Design (cont..)
27
I. Conceptual Design Overview
Data modeling used to create an abstract database structure
that represents real-world objects in most realistic way possible
Must embody clear understanding of business and its functional
areas
Ensure that all data needed are in model, and that all data in the
model are needed
28
I. Conceptual Design Overview (cont..)
Requires four steps
Data analysis and requirements
Discover data element characteristics
Obtains characteristics from different sources
Take into account business rules
Derived from description of operations
Entity relationship modeling and normalization
Designer enforces standards in design documentation
Use of diagrams and symbols, documentation writing style,
layout, other conventions
29
30
I. Conceptual Design Overview (cont..)
3. Data model verification
Verified against proposed system processes
Revision of original design
Careful reevaluation of entities
Detailed examination of attributes describing entities
Define design’s major components as modules:
Module: information system component that handles specific
function
31
I. Conceptual Design Overview (cont..)
Data model verification (cont…)
Verification process
Select central (most important) entity
Defined in terms of its participation in most of model’s
relationships
Identify module or subsystem to which central entity belongs
and define boundaries and scope
Place central entity within module’s framework
32
I. Conceptual Design Overview(cont..)
Distributed database design
Portions of the database may reside in different physical
locations
Processes accessing the database vary from one location to
another
The Designer must also develop data distribution and allocation
strategies
II. DBMS Software Selection
Critical to information system’s smooth operation
Common factors affecting purchasing decisions:
Cost
DBMS features and tools
Underlying model
Portability
DBMS hardware requirements
Advantages and disadvantages should be carefully studied
33
III. Logical Design Overview
Used to translate conceptual design into internal model for
selected database management system
Logical design is software-dependent
Requires that all objects in model be mapped to specific
constructs used by selected database software
Definition of attribute domains, design of required tables,
access restriction formats
Tables must correspond to entities in conceptual design
Translates software-independent conceptual model into
software-dependent logical model
34
III. Logical Design Overview (cont..)
The logical design stage consists of the following phases:
Creating the logical data model.
Validating the logical data model using normalization.
Assigning and validating integrity constraints.
Merging logical models constructed for different parts for the
database together.
Reviewing the logical data model with the use
35
IV. Physical Design Overview
Is the Process of selecting data storage and data access
characteristics of database
Storage characteristics are function of device types supported
by hardware, type of data access methods supported by system,
and DBMS
Particularly important in older hierarchical and network models
Becomes more complex when data are distributed at different
locations
36
IV. Physical Design Overview (cont..)
Physical database design can be broken down into a number of
stages:
Analyze data volume and database usage.
Translate each relation identified in the logical data model into
tables.
Determine a suitable file organization.
Define indexes.
Define user views.
Estimate data storage requirements.
Determine database security for users.
37
Implementation and Loading
New database implementation requires creation of special
storage-related constructs to house end-user tables
38
Performance
Is one of the most important factors in certain database
implementations
Not all DBMSs have performance-monitoring and fine-tuning
tools embedded in their software
Performance evaluation is rendered more difficult as there is no
standard measurement for database performance
39
Backup and Recovery
Database can be subject to data loss through unintended data
deletion and power outages
Data backup and recovery procedures
Create safety valve
Allow database administrator to ensure availability of consistent
data
Integrity
Enforced through proper use of primary and foreign key rules
40
Company Standards
May partially define database standards
Database administrator must implement and enforce such
standards
Database Security
Data must be protected from access by unauthorized users
Establish security goals
- What are we trying to protect the database from?
- What security related problems are we trying to prevent?
The most common security goals relate to the integrity,
confidentiality and the availability of data.
41
Data Security Measures
Physical security allows only authorized personnel physical
access to specific areas.
User authentication is a way of identifying the user and
verifying that the user is allowed to access some restricted data
or application.
achieved through the use of passwords and access rights.
Audit trails are usually provided by the DBMS to check for
access violations.
42
Data Security Measures (cont..)
Data encryption
Can be used to render data useless to unauthorised users.
ORACLE DBMS has a Transparent Data Encryption
User-defined policies and procedures
Backup and recovery strategies should be in place in the event
of a disaster occurring
Antivirus software
Firewalls are systems comprising of hardware devices or
software applications which act as gatekeepers to an
organisation’s network.
For more details on security measures read the slides after the
chapter summary
43
Testing and Evaluation
This phase occurs in parallel with applications programming
Programmers use database tools to prototype applications
during coding of the programs
If the DB implementation fails to meet some of system’s
evaluation criteria, several options may be considered to
enhance the system:
Fine-tune specific system and DBMS configuration parameters
Modify physical design
Modify logical design
Upgrade or change DBMS software and/or hardware platform
44
Operation
Once the database has passed the evaluation stage, it is
considered operational
The beginning of the operational phase starts the process of
system maintenance and evolution
45
Maintenance and Evolution
Required periodic maintenance:
Preventive maintenance (backup)
Corrective maintenance (recovery)
Adaptive maintenance
Assignment of access permissions and their maintenance for
new and old users
Generation of database access statistics
Periodic security audits
Periodic system-usage summaries
46
Parallel Activities in the DBLC and the SDLC
47
Summary
Information system is designed to facilitate transformation of
data into information and to manage both data and information
SDLC traces history (life cycle) of an application within the
information system
DBLC describes history of database within the information
system
Database design and implementation process moves through
series of well-defined stages
Conceptual portion of design may be subject to several
variations, based on two design philosophies
48
Summary (cont..)
Threats to database security include the loss of integrity,
confidentiality and availability of data.
The database administrator (DBA) is responsible for managing
the corporate database.
The development of the data administration strategy is closely
related to the company’s mission and objectives.
49
Threats to Security
Threats are any set of circumstances that have the potential to
cause loss, misuse or harm to the system and/or its data.
Threats can cause:
The loss of the integrity of data through unauthorized
modification.
For example a person gaining unauthorized access to a bank
account and removing some money from the account.
50
Threats to Security
The loss of availability of the data.
For example some adversary causes the database system from
being operational which stops authorized users of the data from
accessing it.
The loss of confidentiality of the data (also referred to as the
privacy of data).
This could be caused by a person gaining access to private
information such as a password or a bank account balance.
51
Examples of Threats
Theft and fraud of data.
Human error which causes accidental loss of data.
Electronic infections
Viruses
Email Viruses
Worms
Trojan Horses
52
Examples of Threats (cont..)
The occurrence of natural disasters such as hurricanes, fires or
floods.
Unauthorized access and modification of data.
Employee sabotage is concerned with the deliberate acts of
malice against the organization.
Poor database administration.
53
Examples of Threats (cont..)
54
Database Design Strategies
Two classical approaches to database design:
Top-down design
Identifies data sets
Defines data elements for each of those sets
Bottom-up design
Identifies data elements (items)
Groups them together in data sets
55
Database Design Strategies Top-down vs. bottom-up design
sequencing
56
Centralized vs. Decentralized Design
Database design may be based on two very different design
philosophies:
Centralized design
Productive when data component is composed of relatively
small number of objects and procedures
Decentralized design
Used when data component of system has considerable number
of entities and complex relations on which very complex
operations are performed
57
Centralized vs. Decentralized Design Centralized Design
58
Decentralized Design
59
Centralized vs. Decentralized Design (cont..)
Aggregation process
Requires designer to create single model in which various
aggregation problems must be addressed:
Synonyms and homonyms
Entity and entity subtypes
Conflicting object definitions
60
Centralized vs. Decentralized Design Summary of aggregation
problems
61
Database Administration
Data management is a complex job
Led to the development of the database administration function.
The person responsible for the control of the centralized and
shared database is the database administrator (DBA).
62
DBA Activities
Database planning, including the definition of standards,
procedures and enforcement.
Database requirements gathering and conceptual design.
Database logical design and transaction design.
63
DBA Activities (cont..)
Database physical design and implementation.
Database testing and debugging.
Database operations and maintenance, including installation,
conversion and migration.
Database training and support.
64
The DBA in the Organisation
65
DBA Skills
66
The Managerial Role of the DBA
67
The Managerial Role of the DBA (cont..)
End-User Support
Gathering user requirements
Building end-user confidence.
Resolving conflicts and problems.
Finding solutions to information needs.
Ensuring quality and integrity of applications and data.
Managing the training and support of DBMS users.
68
The Managerial Role of the DBA (cont..)
Policies, Procedures and Standards
Policies are general statements of direction or action that
communicate and support DBA goals.
Standards are more detailed and specific than policies and
describe the minimum requirements of a given DBA activity.
Procedures are written instructions that describe a series of
steps to be followed during the performance of a given activity.
69
The Managerial Role of the DBA (cont..)
Data Security, Privacy and Integrity
Protecting the security and privacy of the data in the database is
a function of authorization management.
Authorization management defines procedures to protect and
guarantee database security and integrity.
Includes: user access management, view definition, DBMS
access control and DBMS usage monitoring.
70
The Managerial Role of the DBA (cont..)
Data Backup and Recovery
Many DBA departments have created a position staffed by the
database security officer (DSO).
The DSO’s activities are often classified as disaster
management.
Disaster management includes all of the DBA activities
designed to secure data availability following a physical
disaster or a database integrity failure.
Disaster management includes all planning, organizing and
testing of database contingency plans and recovery procedures.
71
The Managerial Role of the DBA (cont..)
Data Distribution and Use
The DBA is responsible for ensuring that the data are
distributed to the right people, at the right time and in the right
format.
72
The Technical Role of the DBA
Evaluating, selecting and installing the DBMS and related
utilities.
Designing and implementing databases and applications.
Testing and evaluating databases and applications.
Operating the DBMS, utilities and applications.
Training and supporting users.
Maintaining the DBMS, utilities and applications.
73
Evaluating, Selecting and Installing the DBMS and Utilities
(DBA)
Covers the selection of the database management system, utility
software and supporting hardware for use in the organization.
Must be based primarily on the organization’s needs
The DBA would be wise to develop a checklist of desired
DBMS features.
74
Designing and Implementing Databases and Applications (DBA)
Covers data modelling and design services to the end-user
community
Determine and enforce standards and procedures to be used.
DBA then provides the necessary assistance and support during
the design of the database at the conceptual, logical and
physical levels
75
Testing and Evaluating Databases and Applications (DBA)
The DBA must also provide testing and evaluation services for
all of the database and end-user applications.
Those services are the logical extension of the design,
development and implementation services.
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx

More Related Content

Similar to DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx

DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
Mukesh Tekwani
 
1. Transaction Processing and Concurrency Control.pptx
1. Transaction Processing and Concurrency Control.pptx1. Transaction Processing and Concurrency Control.pptx
1. Transaction Processing and Concurrency Control.pptx
calf_ville86
 
Vani dbms
Vani dbmsVani dbms
Vani dbms
SangeethaSasi1
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
kansel85
 
Session 9 Tp9
Session 9 Tp9Session 9 Tp9
Session 9 Tp9
phanleson
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12
Syed Asrarali
 
Dartabase Transaction.pptx
Dartabase Transaction.pptxDartabase Transaction.pptx
Dartabase Transaction.pptx
Bibus Poudel
 
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
kareemangels
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
Binte fatima
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
Dilum Bandara
 
Dbms
DbmsDbms
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
Sanjeev Gupta
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
PravinBhargav1
 
Sistem manajemen basis data 8
Sistem manajemen basis data   8Sistem manajemen basis data   8
Sistem manajemen basis data 8
Universitas Putera Batam
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
Meghaj Mallick
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
ssuserec53e73
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
DrCViji
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
BikalAdhikari4
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
Niraj Bharambe
 

Similar to DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx (20)

DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
 
1. Transaction Processing and Concurrency Control.pptx
1. Transaction Processing and Concurrency Control.pptx1. Transaction Processing and Concurrency Control.pptx
1. Transaction Processing and Concurrency Control.pptx
 
Vani dbms
Vani dbmsVani dbms
Vani dbms
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Session 9 Tp9
Session 9 Tp9Session 9 Tp9
Session 9 Tp9
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12
 
Dartabase Transaction.pptx
Dartabase Transaction.pptxDartabase Transaction.pptx
Dartabase Transaction.pptx
 
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 
Dbms
DbmsDbms
Dbms
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
 
Sistem manajemen basis data 8
Sistem manajemen basis data   8Sistem manajemen basis data   8
Sistem manajemen basis data 8
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
 

More from randyburney60861

Delusional DisordersPakistani hought ProcessesBACKGROUND.docx
Delusional DisordersPakistani hought ProcessesBACKGROUND.docxDelusional DisordersPakistani hought ProcessesBACKGROUND.docx
Delusional DisordersPakistani hought ProcessesBACKGROUND.docx
randyburney60861
 
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docxDemand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
randyburney60861
 
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docxDeloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
randyburney60861
 
DELL COMPANY’ Application of the accounting theories on the comp.docx
DELL COMPANY’ Application of the accounting theories on the comp.docxDELL COMPANY’ Application of the accounting theories on the comp.docx
DELL COMPANY’ Application of the accounting theories on the comp.docx
randyburney60861
 
Deliverable Length10–15 slides not including title and refere.docx
Deliverable Length10–15 slides not including title and refere.docxDeliverable Length10–15 slides not including title and refere.docx
Deliverable Length10–15 slides not including title and refere.docx
randyburney60861
 
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docx
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docxDeliverable 6 - Using Business VisualsCompetencyExamine and de.docx
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docx
randyburney60861
 
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docxDeliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
randyburney60861
 
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docxDeliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
randyburney60861
 
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docxDeliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
randyburney60861
 
Deliverable 4 - Global Environment ChallengesCompetencyC.docx
Deliverable 4 - Global Environment ChallengesCompetencyC.docxDeliverable 4 - Global Environment ChallengesCompetencyC.docx
Deliverable 4 - Global Environment ChallengesCompetencyC.docx
randyburney60861
 
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docxDeliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
randyburney60861
 
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docxDeliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
randyburney60861
 
DEFINITION a brief definition of the key term followed by t.docx
DEFINITION a brief definition of the key term followed by t.docxDEFINITION a brief definition of the key term followed by t.docx
DEFINITION a brief definition of the key term followed by t.docx
randyburney60861
 
Definition of HIVAIDS. What are the symptoms and general characteri.docx
Definition of HIVAIDS. What are the symptoms and general characteri.docxDefinition of HIVAIDS. What are the symptoms and general characteri.docx
Definition of HIVAIDS. What are the symptoms and general characteri.docx
randyburney60861
 
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docx
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docxDefinition of Ethos and How to Use it1. Trustworthiness
Does y.docx
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docx
randyburney60861
 
Definition Multimodal refers to works that use a combination .docx
Definition Multimodal refers to works that use a combination .docxDefinition Multimodal refers to works that use a combination .docx
Definition Multimodal refers to works that use a combination .docx
randyburney60861
 
Definition Argument Essay AssignmentGoal Write a 1,500.docx
Definition Argument Essay AssignmentGoal Write a 1,500.docxDefinition Argument Essay AssignmentGoal Write a 1,500.docx
Definition Argument Essay AssignmentGoal Write a 1,500.docx
randyburney60861
 
DEFINITION a brief definition of the key term followed by the APA r.docx
DEFINITION a brief definition of the key term followed by the APA r.docxDEFINITION a brief definition of the key term followed by the APA r.docx
DEFINITION a brief definition of the key term followed by the APA r.docx
randyburney60861
 
Defining Privacy in Employee Health ScreeningCases Ethical .docx
Defining Privacy in Employee Health ScreeningCases Ethical .docxDefining Privacy in Employee Health ScreeningCases Ethical .docx
Defining Privacy in Employee Health ScreeningCases Ethical .docx
randyburney60861
 
Define      diversity” and inclusion” as applied to your pre.docx
Define      diversity” and inclusion” as applied to your pre.docxDefine      diversity” and inclusion” as applied to your pre.docx
Define      diversity” and inclusion” as applied to your pre.docx
randyburney60861
 

More from randyburney60861 (20)

Delusional DisordersPakistani hought ProcessesBACKGROUND.docx
Delusional DisordersPakistani hought ProcessesBACKGROUND.docxDelusional DisordersPakistani hought ProcessesBACKGROUND.docx
Delusional DisordersPakistani hought ProcessesBACKGROUND.docx
 
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docxDemand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
Demand, Supply, and the Market ProcessGWARTNEY – STROUP .docx
 
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docxDeloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
Deloitte’s 2020 Global Blockchain SurveyFrom promise to re.docx
 
DELL COMPANY’ Application of the accounting theories on the comp.docx
DELL COMPANY’ Application of the accounting theories on the comp.docxDELL COMPANY’ Application of the accounting theories on the comp.docx
DELL COMPANY’ Application of the accounting theories on the comp.docx
 
Deliverable Length10–15 slides not including title and refere.docx
Deliverable Length10–15 slides not including title and refere.docxDeliverable Length10–15 slides not including title and refere.docx
Deliverable Length10–15 slides not including title and refere.docx
 
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docx
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docxDeliverable 6 - Using Business VisualsCompetencyExamine and de.docx
Deliverable 6 - Using Business VisualsCompetencyExamine and de.docx
 
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docxDeliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
Deliverable 5 - Hypothesis Tests for Two SamplesCompetencyForm.docx
 
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docxDeliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
Deliverable 5 - Proposed HR Initiatives PresentationAssignme.docx
 
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docxDeliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
Deliverable 4 - Diversity and Inclusion PolicyAssignment Con.docx
 
Deliverable 4 - Global Environment ChallengesCompetencyC.docx
Deliverable 4 - Global Environment ChallengesCompetencyC.docxDeliverable 4 - Global Environment ChallengesCompetencyC.docx
Deliverable 4 - Global Environment ChallengesCompetencyC.docx
 
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docxDeliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Com.docx
 
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docxDeliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
Deliverable 03 - Humanities (Test-Out Sophia Replacement)Compete.docx
 
DEFINITION a brief definition of the key term followed by t.docx
DEFINITION a brief definition of the key term followed by t.docxDEFINITION a brief definition of the key term followed by t.docx
DEFINITION a brief definition of the key term followed by t.docx
 
Definition of HIVAIDS. What are the symptoms and general characteri.docx
Definition of HIVAIDS. What are the symptoms and general characteri.docxDefinition of HIVAIDS. What are the symptoms and general characteri.docx
Definition of HIVAIDS. What are the symptoms and general characteri.docx
 
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docx
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docxDefinition of Ethos and How to Use it1. Trustworthiness
Does y.docx
Definition of Ethos and How to Use it1. Trustworthiness
Does y.docx
 
Definition Multimodal refers to works that use a combination .docx
Definition Multimodal refers to works that use a combination .docxDefinition Multimodal refers to works that use a combination .docx
Definition Multimodal refers to works that use a combination .docx
 
Definition Argument Essay AssignmentGoal Write a 1,500.docx
Definition Argument Essay AssignmentGoal Write a 1,500.docxDefinition Argument Essay AssignmentGoal Write a 1,500.docx
Definition Argument Essay AssignmentGoal Write a 1,500.docx
 
DEFINITION a brief definition of the key term followed by the APA r.docx
DEFINITION a brief definition of the key term followed by the APA r.docxDEFINITION a brief definition of the key term followed by the APA r.docx
DEFINITION a brief definition of the key term followed by the APA r.docx
 
Defining Privacy in Employee Health ScreeningCases Ethical .docx
Defining Privacy in Employee Health ScreeningCases Ethical .docxDefining Privacy in Employee Health ScreeningCases Ethical .docx
Defining Privacy in Employee Health ScreeningCases Ethical .docx
 
Define      diversity” and inclusion” as applied to your pre.docx
Define      diversity” and inclusion” as applied to your pre.docxDefine      diversity” and inclusion” as applied to your pre.docx
Define      diversity” and inclusion” as applied to your pre.docx
 

Recently uploaded

Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 

Recently uploaded (20)

Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 

DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx

  • 1. DBF-Lecture11-Chapter12.ppt Database Principles: Fundamentals of Design, Implementations and Management Lecture11- CHAPTER 12: Transaction Management and Concurrency Control Presented by Rabia Cherouk * ObjectivesIn this chapter, you will learn:About database transactions and their propertiesWhat concurrency control is and what role it plays in maintaining the database’s integrityWhat locking methods are and how they workHow stamping methods are used for concurrency controlHow optimistic methods are used for concurrency controlHow database recovery management is used to maintain database integrity * What is a Transaction?A transaction is a logical unit of work that must be either entirely completed or abortedSuccessful transaction changes database from one consistent state to anotherOne in which all data integrity constraints are satisfiedMost real-world database transactions are formed by two or more database requestsEquivalent of a single SQL
  • 2. statement in an application program or transaction Same as Fig. 12.1 in your book * Same as Fig. 12.1 in your book * Evaluating Transaction Results Not all transactions update the databaseSQL code represents a transaction because database was accessedImproper or incomplete transactions can have devastating effect on database integritySome DBMSs provide means by which user can define enforceable constraintsOther integrity rules are enforced automatically by the DBMS Same as Fig. 12.2 in your book * Figure 9.2 Same as Fig. 12.2 in your book * Transaction Properties All transactions must display atomicity, consistency, durability and serializability (ACIDS).AtomicityAll operations of a transaction must be completedConsistency Permanence of database’s consistent stateIsolation Data used during transaction cannot be used by second transaction until the first is completed
  • 3. * Transaction Properties (cont..)Durability Once transactions are committed, they cannot be undoneSerializabilityConcurrent execution of several transactions yields consistent resultsMultiuser databases are subject to multiple concurrent transactions * Transaction Management with SQLANSI (American National Standard Institute) has defined standards that govern SQL database transactionsTransaction support is provided by two SQL statements: COMMIT and ROLLBACKTransaction sequence must continue until:COMMIT statement is reachedROLLBACK statement is reachedEnd of program is reachedProgram is abnormally terminated * The Transaction LogA DBMS uses a Transaction log to store:A record for the beginning of transactionFor each transaction component: Type of operation being performed (update, delete, insert)Names of objects affected by transaction“Before” and “after” values for updated fieldsPointers to previous and next transaction log entries for the same transactionEnding (COMMIT) of the transaction Table 12.1 in your book * The Transaction Log Table 12.1 in your book
  • 4. * Concurrency ControlIs the coordination of simultaneous transaction execution in a multiprocessing databaseObjective is to ensure serializability of transactions in a multiuser environmentSimultaneous execution of transactions over a shared database can create several data integrity and consistency problemsLost updatesUncommitted dataInconsistent retrievals * Lost UpdatesLost update problem:Two concurrent transactions update same data elementOne of the updates is lostOverwritten by the other transaction Lost Updates * Lost Updates (cont..) *
  • 5. * Uncommitted Data Uncommitted data phenomenon:Two transactions executed concurrentlyFirst transaction rolled back after second already accessed uncommitted data Uncommitted Data * Uncommitted Data (cont..) * * Inconsistent RetrievalsInconsistent retrievals:First transaction accesses dataSecond transaction alters the dataFirst transaction accesses the data againTransaction might read some data before they are changed and other data after changedYields inconsistent results *
  • 6. * * The SchedulerSpecial DBMS program Purpose is to establish order of operations within which concurrent transactions are executedInterleaves execution of database operations:Ensures serializabilityEnsures isolationSerializable scheduleInterleaved execution of transactions yields same results as serial execution The Scheduler (cont..) Bases its actions on concurrency control algorithmsEnsures computer’s central processing unit (CPU) is used efficientlyFacilitates data isolation to ensure that two transactions do not update same data element at same time * * Database Recovery Management Database recoveryRestores database from given state, usually inconsistent, to previously consistent stateBased on atomic transaction propertyAll portions of transaction treated as single logical unit of workAll operations applied and completed to produce consistent database If transaction operation cannot be completed, transaction must be aborted, and any changes to database must be rolled back (undone)
  • 7. Transaction RecoveryMakes use of deferred-write and write- through techniquesDeferred write Transaction operations do not immediately update physical databaseOnly transaction log is updatedDatabase is physically updated only after transaction reaches its commit point using transaction log information * * Transaction Recovery (cont..)Write-through techniqueDatabase is immediately updated by transaction operations during transaction’s execution, even before transaction reaches its commit pointRecovery processIdentify last checkpointIf transaction was committed before checkpointDo nothingIf transaction committed after last checkpointDBMS redoes the transaction using “after” valuesIf transaction had ROLLBACK or was left activeDo nothing because no updates were made Transaction Recovery (cont..) * *
  • 8. SummaryTransaction: sequence of database operations that access databaseLogical unit of workNo portion of transaction can exist by itselfFive main properties: atomicity, consistency, isolation, durability, and serializabilityCOMMIT saves changes to diskROLLBACK restores previous database stateSQL transactions are formed by several SQL statements or database requests * Summary (cont..) Transaction log keeps track of all transactions that modify databaseConcurrency control coordinates simultaneous execution of transactionsScheduler establishes order in which concurrent transaction operations are executedLock guarantees unique access to a data item by transactionTwo types of locks: binary locks and shared/exclusive locks * Summary (cont..) Serializability of schedules is guaranteed through the use of two-phase lockingDeadlock: when two or more transactions wait indefinitely for each other to release lockThree deadlock control techniques: prevention, detection, and avoidanceTime stamping methods assign unique time stamp to each transaction Schedules execution of conflicting transactions in time stamp order * Summary (cont..) Optimistic methods assume the majority of database transactions do not conflictTransactions are executed concurrently, using private copies of the dataDatabase recovery
  • 9. restores database from given state to previous consistent state CHAPTER 12: Transaction Management and Concurrency Control ADDITIONAL SLIDES pages 635 to 644 in your Book.. * * Two-Phase Locking to Ensure Serializability (cont..)Governed by the following rules:Two transactions cannot have conflicting locksNo unlock operation can precede a lock operation in the same transactionNo data are affected until all locks are obtained—that is, until transaction is in its locked point * Concurrency Control with Locking MethodsLock Guarantees exclusive use of a data item to a current transactionRequired to prevent another transaction from reading inconsistent dataLock managerResponsible for assigning and policing the locks used
  • 10. by transactions * Lock GranularityIndicates level of lock useLocking can take place at following levels: DatabaseTablePageRowField (attribute) * Lock Granularity (cont..) Database-level lockEntire database is lockedTable-level lockEntire table is lockedPage-level lockEntire diskpage is locked Row-level lock Allows concurrent transactions to access different rows of same tableEven if rows are located on same page Field-level lock Allows concurrent transactions to access same row as long as they Require the use of different fields (attributes) within the row Fig 12.3 in your book * Fig 12.3 in your book Fig 12.4 in your book * Fig 12.4 in your book Fig. 12.5 in your book *
  • 11. Lock Granularity (cont..) Fig. 12.5 in your book Fig. 12.6 in your book * Lock Granularity (cont..) Fig. 12.6 in your book * Lock TypesBinary lockTwo states: locked (1) or unlocked (0)Exclusive lock Access is specifically reserved for transaction that locked objectMust be used when potential for conflict existsShared lock Concurrent transactions are granted read access on basis of a common lock Table 12.10 in your book * Table 12.10 in your book * Two-Phase Locking to Ensure SerializabilityDefines how transactions acquire and relinquish locksGuarantees serializability, but does not prevent deadlocks Growing phaseTransaction acquires all required locks without unlocking any dataShrinking phaseTransaction releases all locks and cannot obtain any new lock
  • 12. Deadlocks (cont..) * * DeadlocksCondition that occurs when two transactions wait for each other to unlock dataPossible only if one of the transactions wants to obtain an exclusive lock on a data itemNo deadlock condition can exist among shared locks * Table 12.11 in your book Deadlocks (cont..) * Deadlocks (cont..)Three techniques to control deadlock:Prevention Detection Avoidance Choice of deadlock control method depends on database environmentLow probability of deadlock, detection recommendedHigh probability, prevention recommended * Concurrency Control
  • 13. with Time Stamping Methods Assigns global unique time stamp to each transactionProduces explicit order in which transactions are submitted to DBMSUniqueness Ensures that no equal time stamp values can existMonotonicityEnsures that time stamp values always increase * Wait/Die and Wound/Wait SchemesWait/die Older transaction waits and younger is rolled back and rescheduledWound/wait Older transaction rolls back younger transaction and reschedules it Wait/Die and Wound/Wait Schemes (cont..) * * Concurrency Control with Optimistic Methods Optimistic approach Based on assumption that majority of database operations do not conflictDoes not require locking or time stamping techniquesTransaction is executed without restrictions until it is committedPhases: read, validation, and write
  • 14. MA 106 Final Exam Name________________________ Solve by Factoring. 1) �2 + 4� − 5 = 0 2) (� − 2) (� + 5) = 8 Solve. 3) A batter hits a baseball in the air. The height h (in feet) of the baseball after t seconds is given by the equation ℎ = −16�2 + 64� + 3 = 0. When is the baseball at a height of three feet? Simplify.
  • 16. MA 106 Final Exam Name________________________ 9) (� + 2)2 = 36 10) Solve by completing the square. 7x6x 2 11) Solve by using the quadratic formula. 4-x6x 2 Find all values that make the rational expression undefined. If
  • 17. the rational expression is defined for all real numbers, so state. 12) 18x9x 64x 2 2 Simplify the expression. 13) 2 32 9x3x x217x
  • 18. Perform the indicated operation. Simplify if possible. 14) ara a ra ra 2 22
  • 19. MA 106 Final Exam Name________________________ 15) 12 2 4 1x x 1-x 48x 16) 6-m 18 6-m
  • 22. MA 106 Final Exam Name________________________ Simplify the complex fraction. 20) 1 a 7 1 a 7 21) The triangles in the figure are similar. Find the length of the side marked with an x.
  • 24. 10 8 x 5 4 3 Database Principles: Fundamentals of Design, Implementations and Management Lecture7- CHAPTER 8 : Beginning Structured Query Language Presented by Rabia Cherouk * ObjectivesIn this chapter, you will learn:The basic commands and functions of SQLHow to use SQL for data administration (to create tables, indexes, and views)How to use SQL for data manipulation (to add, modify, delete, and retrieve data)How to use SQL to query a database for useful information *
  • 25. Introduction to SQLSQL functions fit into two broad categories:Data definition language (DDL)Create database objects, such as tables, indexes, and viewsDefine access rights to those database objectsData manipulation language (DML)SQL is relatively easy to learnBasic command set has vocabulary of less than 100 words – Non-procedural languageAmerican National Standards Institute (ANSI) prescribes a standard SQLand standards are accepted by ISO (International Organisation for Standardisation) .Several SQL dialects exist Introduction to SQL (cont..) * Introduction to SQL (cont..) * * Data Definition CommandsThe database modelIn this chapter, a simple database with these tables is used to illustrate commands:CUSTOMERINVOICELINEPRODUCTVENDORFoc us on PRODUCT and VENDOR tables
  • 26. * The Database Model Figure 8.1 in your book The Database Model (cont..) * * Creating the DatabaseTwo tasks must be completed: 1/ Create database structure 2/ Create tables that will hold end-user dataFirst task:RDBMS creates physical files that will hold databaseDiffers substantially from one RDBMS to another * The Database SchemaAuthentication Process through which DBMS verifies that only registered users are able to access databaseLog on to RDBMS using user ID and password created by database administratorSchemaIs a group of database objects—such as tables and indexes— that are related to each other. Usually a schema belongs to a single user or application. A single database can hold multiple schemas belonging to different users or applications.
  • 27. * Data TypesData type selection is usually dictated by nature of data and by intended usePay close attention to expected use of attributes for sorting and data retrieval purposesSupported data types:Number(L,D), Integer, Smallint, Decimal(L,D)Char(L), Varchar(L), Varchar2(L)Date, Time, TimestampReal, Double, FloatInterval day to hourMany other types Data Types (cont..) * * Creating Table StructuresUse one line per column (attribute) definitionUse spaces to line up attribute characteristics and constraintsTable and attribute names are capitalizedNOT NULL specification UNIQUE specification Primary key attributes contain both a NOT NULL and a UNIQUE specificationRDBMS will automatically enforce referential integrity for foreign keys * Creating Table Structures (cont..)Command sequence ends with semicolon Example: CREATE TABLE EMP_2 ( EMP_NUM CHAR(3) NOT NULL UNIQUE, EMP_LNAME VARCHAR(15) NOT NULL, EMP_FNAME VARCHAR(15) NOT NULL,
  • 28. EMP_INITIAL CHAR(1), EMP_HIRE DATE NOT NULL, JOB_CODE CHAR(3) NOT NULL, PRIMARY KEY (EMP_NUM), FOREIGN KEY (JOB_CODE) REFERENCES JOB); * SQL ConstraintsNOT NULL constraint Ensures that column does not accept nullsUNIQUE constraint Ensures that all values in column are uniqueDEFAULT constraint Assigns value to attribute when a new row is added to tableCHECK constraint Validates data when attribute value is entered * SQL IndexesWhen primary key is declared, DBMS automatically creates unique indexOften need additional indexesUsing CREATE INDEX command, SQL indexes can be created on basis of any selected attributeComposite indexIndex based on two or more attributesOften used to prevent data duplication SQL Indexes (cont..) *
  • 29. Data Manipulation CommandsAdding table rowsSaving table changesListing table rowsUpdating table rowsRestoring table contentsDeleting table rowsInserting table rows with a select subquery * * * Data Manipulation CommandsINSERTSELECTCOMMITUPDATEROLLBACK DELETE * Adding Table RowsINSERT Used to enter data into tableSyntax: INSERT INTO columnname VALUES (value1, value2, … , valueN); * Adding Table Rows (cont..)When entering values, notice that:Row contents are entered between parenthesesCharacter and date values are entered between apostrophesNumerical entries are not enclosed in apostrophesAttribute entries are separated by commasA value is required for each columnUse NULL for unknown values
  • 30. * Saving Table ChangesChanges made to table contents are not physically saved on disk until:Database is closedProgram is closedCOMMIT command is usedSyntax:COMMIT [WORK];Will permanently save any changes made to any table in the database * Listing Table RowsSELECT Used to list contents of tableSyntax: SELECT columnlistFROM tablename;Columnlist represents one or more attributes, separated by commasAsterisk can be used as wildcard character to list all attributes Listing Table Rows (cont..) * * Updating Table RowsUPDATE Modify data in a tableSyntax: UPDATE tablename SET columnname = expression [, columnname = expression] [WHERE conditionlist];If more than one attribute is to be updated in row, separate corrections with commas
  • 31. * Restoring Table ContentsROLLBACKUsed to restore database to its previous conditionOnly applicable if COMMIT command has not been used to permanently store changes in databaseSyntax:ROLLBACK;COMMIT and ROLLBACK only work with manipulation commands that are used to add, modify, or delete table rows * Deleting Table RowsDELETE Deletes a table rowSyntax: DELETE FROM tablename [WHERE conditionlist ];WHERE condition is optionalIf WHERE condition is not specified, all rows from specified table will be deleted * Inserting Table Rows with a SELECT SubqueryINSERTInserts multiple rows from another table (source)Uses SELECT subquerySubquery: query that is embedded (or nested) inside another querySubquery is executed firstSyntax: INSERT INTO tablename SELECT columnlist FROM tablename; *
  • 32. SELECT QueriesFine-tune SELECT command by adding restrictions to search criteria using:Conditional restrictionsArithmetic operatorsLogical operatorsSpecial operators * Selecting Rows with Conditional RestrictionsSelect partial table contents by placing restrictions on rows to be included in outputAdd conditional restrictions to SELECT statement, using WHERE clauseSyntax: SELECT columnlist FROM tablelist [ WHERE conditionlist ] ; Selecting Rows with Conditional Restrictions (continued) * Selecting Rows with Conditional Restrictions (continued)
  • 33. * * Selecting Rows with Conditional Restrictions (cont..) Selecting Rows with Conditional Restrictions (continued) * Selecting Rows with Conditional Restrictions (cont..) * Selecting Rows with Conditional Restrictions (continued)
  • 34. * Selecting Rows with Conditional Restrictions (continued) * Selecting Rows with Conditional Restrictions (cont..) * Selecting Rows with Conditional Restrictions (continued) *
  • 35. Selecting Rows with Conditional Restrictions (continued) * * Arithmetic Operators: The Rule of PrecedencePerform operations within parenthesesPerform power operationsPerform multiplications and divisionsPerform additions and subtractionsTable 8.7 in your book in T * Logical Operators: AND, OR, and NOTSearching data involves multiple conditionsLogical operators: AND, OR, and NOTCan be combinedParentheses placed to enforce precedence orderConditions in parentheses always executed firstBoolean algebra: mathematical field dedicated to use of logical operatorsNOT negates result of conditional expression *
  • 36. Special OperatorsBETWEEN: checks whether attribute value is within a rangeIS NULL: checks whether attribute value is nullLIKE: checks whether attribute value matches given string patternIN: checks whether attribute value matches any value within a value listEXISTS: checks if subquery returns any rows * Advanced Data Definition CommandsAll changes in table structure are made by using ALTER commandThree optionsADD adds a columnMODIFY changes column characteristicsDROP deletes a columnCan also be used to: Add table constraintsRemove table constraints * Changing a Column’s Data TypeALTER can be used to change data typeSome RDBMSs do not permit changes to data types unless column is empty Changing a Column’s Data CharacteristicsUse ALTER to change data characteristicsChanges in column’s characteristics permitted if changes do not alter the existing data type * Adding a Column Dropping a ColumnUse ALTER to add columnDo not include the NOT NULL clause for new columnUse ALTER to drop columnSome RDBMSs impose restrictions on the deletion of an attribute
  • 37. * SummarySQL commands can be divided into two overall categories: Data definition language commands Data manipulation language commandsThe ANSI standard data types are supported by all RDBMS vendors in different waysBasic data definition commands allow you to create tables, indexes, and views * Summary (cont..)DML commands allow you to add, modify, and delete rows from tablesThe basic DML commands:SELECT, INSERT, UPDATE, DELETE, COMMIT, and ROLLBACKSELECT statement is main data retrieval command in SQL * Summary (cont..)WHERE clause can be used with SELECT, UPDATE, and DELETE statementsAggregate functionsSpecial functions that perform arithmetic computations over a set of rowsORDER BY clauseUsed to sort output of SELECT statementCan sort by one or more columnsAscending or descending order * Summary (cont..)Join output of multiple tables with SELECT statementJoin performed every time you specify two or more tables in FROM clauseIf no join condition specified, DBMX performs Cartesian productNatural join uses join condition to match only rows with equal values in specified columnsRight
  • 38. outer join and left outer join select rows with no matching values in other related table * Advanced Data UpdatesUPDATE command updates only data in existing rowsIf relationship between entries and existing columns, can assign values to slotsArithmetic operators useful in data updatesIn Oracle, ROLLBACK command undoes changes made by last two UPDATE statements * Advanced Data Updates * Copying Parts of TablesSQL permits copying contents of selected table columnsData need not be reentered manually into newly created table(s)First create the table structureNext add rows to new table using table rows from another table Copying Parts of Tables (cont..) * *
  • 39. Adding Primary and Foreign Key DesignationsWhen table is copied, integrity rules do not copyPrimary and foreign keys manually defined on new tableUser ALTER TABLE commandSyntax: ALTER TABLE tablename ADD PRIMARY KEY (fieldname);For foreign key, use FOREIGN KEY in place of PRIMARY KEY * Deleting a Table from the DatabaseDROPDeletes table from databaseSyntax: DROP TABLE tablename;Can drop a table only if it is not the “one” side of any relationshipOtherwise RDBMS generates an error messageForeign key integrity violation * Advanced SELECT QueriesLogical operators work well in the query environmentSQL provides useful functions that:CountFind minimum and maximum valuesCalculate averages, etc.SQL allows user to limit queries to:Entries having no duplicatesEntries whose duplicates may be grouped * Ordering a ListingORDER BY clause useful when listing order importantSyntax: SELECT columnlist FROM tablelist [WHERE conditionlist] [ORDER BY columnlist [ASC | DESC]];Ascending order by default
  • 40. Ordering a Listing * Ordering a Listing (cont..) * Ordering a Listing (cont..) * * Listing Unique ValuesDISTINCT clause produces list of only values that are different from one anotherExample: SELECT DISTINCT V_CODE FROM PRODUCT;Access places nulls at the top of the listOracle places it at the bottomPlacement of nulls does not affect list contents
  • 41. Listing Unique Values * * Aggregate FunctionsCOUNT function tallies number of non-null values of an attributeTakes one parameter: usually a column nameMAX and MIN find highest (lowest) value in a tableCompute MAX value in inner queryCompare to each value returned by the querySUM computes total sum for any specified attributeAVG function format similar to MIN and MAX Aggregate Functions * Aggregate Functions (cont..) Figure 8.21 COUNT function output examples *
  • 42. Aggregate Functions (cont..) Figure 8.22 MIN and MAX Output Examples * Aggregate Functions (cont..) Figure 8.23 The total values of all items in the PRODUCT table * Aggregate Functions (cont..) Figure 8.24 AVG Function Output Examples * * Grouping DataFrequency distributions created by GROUP BY clause within SELECT statementSyntax: SELECT columnlist FROM tablelist [WHERE conditionlist] [GROUP BY columnlist] [HAVINGconditionlist] [ORDER BY columnlist [ASC | DESC] ] ;
  • 43. Grouping Data Figure 8.25 GROUP BY Clause Output Examples * Grouping Data (cont..) Figure 8.27 An application of the HAVING clause * * Virtual Tables: Creating a ViewView is virtual table based on SELECT queryCreate view by using CREATE VIEW commandSpecial characteristics of relational view:Name of view can be used anywhere a table name is expectedView dynamically updatedRestricts users to only specified columns and rowsViews may be used as basis for reports Virtual Tables: Creating a View (cont..) Figure 8.28 Creating a virtual table using the CREATE VIEW command
  • 44. * * Joining Database TablesAbility to combine (join) tables on common attributes is most important distinction between relational database and other databasesJoin is performed when data are retrieved from more than one table at a timeEquality comparison between foreign key and primary key of related tablesJoin tables by listing tables in FROM clause of SELECT statementDBMS creates Cartesian product of every table Joining Database Tables (cont..) * Joining Database Tables (cont..) * * Joining Tables with an AliasAlias identifies the source table from which data are takenAlias can be used to identify source tableAny legal table name can be used as aliasAdd alias after
  • 45. table name in FROM clauseFROM tablename alias Joining Database Tables (cont..) * * Recursive Joins - Outer JoinsAlias especially useful when a table must be joined to itselfRecursive queryUse aliases to differentiate the table from itselfTwo types of outer joinLeft outer joinRight outer join Recursive Joins * Recursive Joins (cont..) *
  • 46. Outer Joins * Outer Joins (cont..) * Grouping Data (cont..) Figure 8.26 Incorrect and Correct use of the GROUP BY Clause * Lect10-Conceptual, Logical and Physical.ppt 9 * Database Principles: Fundamentals of Design, Implementations and Management Lecture 10 - CHAPTER 11: CONCEPTUAL, LOGICAL AND PHYSICAL DATABASE DESIGN
  • 47. * 9 * In this chapter, you will learn:About the three stages of database design: conceptual, logical and physical.How to design a conceptual model to represent the business and its key functional areas.How the conceptual model can be transformed into a logically equivalent set of relations.How to translate the logical data model into a set of specific DBMS table specifications.About different types of file organization.How indexes can be applied to improve data access and retrieval.How to estimate data storage requirements. * 9 * Database DesignNecessary to focus on the dataMust concentrate on the data characteristics required to build database modelAt this point there are two views of data within system:Business view of data as an information sourceDesigner’s view of the data structure, its access, and
  • 48. activities required to transform data into information 9 * Database Design (cont..) 9 * Database Design (cont..) To complete the design phase, we must remember these points:The process of database design is loosely related to analysis and design of larger system The data component is only one element of a larger systemSystems analysts or systems programmers are in charge of designing other system componentsTheir activities create procedures that will help transform data within database into useful informationThe Database Design does not constitute a sequential processIterative process that provides continuous feedback designed to trace previous steps 9 * Database Design (cont..) 9 * 3 Stages of Database Design
  • 49. * 9 * I. Conceptual Design (CD)In the CD, Data modeling is used to create an abstract database structure that represents real-world objects in most realistic way possibleThe CD must embody clear understanding of business and its functional areasEnsure that all data needed are in the model, and that all data in the model are neededRequires four steps:Data analysis and requirementsEntity relationship modeling and normalisationData model verificationDistributed database design 9 * I. Conceptual Design (cont..)Data Analysis and Requirements First step is to discover the data element characteristicsObtains characteristics from different sourcesMust take into account the business rulesDerived from the description of operations which is a Document that provides precise, detailed, up-to-date, and thoroughly reviewed description of activities that define organization’s operating environment 9 *
  • 50. I. Conceptual Design (cont...)Entity Relationship (ER) Modeling and Normalization Designer must communicate and enforce appropriate standards to be used in documentation of designUse of diagrams and symbolsDocumentation writing styleLayoutOther conventions to be followed during documentation 9 * I. Conceptual Design (cont..) * 9 * I. Conceptual Design (cont..) Fig 11.2 in your book 9 * I. Conceptual Design (cont..)
  • 51. 9 * I. Conceptual Design (cont..) * 9 * I. Conceptual Design (cont..) * 9 * I. Conceptual Design (cont..)Entity Relationship (ER) Modeling and Normalization (cont…)Data dictionary Defines all objects (entities, attributes, relations, views, and so on) Used in tandem with the normalization process to help eliminate data anomalies and redundancy problems
  • 52. 9 * I. Conceptual Design (cont..)The Data Model Verification The ER Model must be verified against the proposed system processes to corroborate (confirm) that the intended processes can be supported by the database modelA revision of the original design starts with careful reevaluation of the entities, followed by the detailed examination of the attributes that describe these entitiesDefine design’s major components as modules:A module is an information system component that handles a specific function 9 * I. Conceptual Design (cont..) * 9 * I. Conceptual Design (cont..) *
  • 53. 9 * I. Conceptual Design (cont..)Data Model Verification (cont..)Verification process starts with:Selecting a central (most important) entityWhich is defined in terms of its participation in most of the model’s relationshipsThe next step is to identify the module or subsystem to which central entity belongs and to define boundaries and scopeOnce the module is identified, the central entity is placed within module’s framework 9 * I. Conceptual Design (cont..)Distributed Database DesignPortions of the database may reside in different physical locationsDesigner must also develop data distribution and allocation strategies 9 * II. DBMS Software SelectionThe selection of the software is critical to an information system’s smooth operationAdvantages and disadvantages should be carefully studiedSome common factors that may affect the purchasing decision are:CostDBMS features and toolsUnderlying model: Hierarchical, network, relational etc…PortabilityDBMS requirements
  • 54. 9 * III. Logical DesignUsed to translate the conceptual design into internal model for selected database management systemLogical design is software-dependentRequires that all objects in the model be mapped to specific constructs used by selected database software 9 * III. Logical Design (cont..)Used to translate the conceptual design into internal model for the selected database management systemLogical design is software-dependentThe logical design stage consists of the following phases: Creating the logical data model. Validating the logical data model using normalization. Assigning and validating integrity constraints. Merging logical models constructed for different parts for the database together. Reviewing the logical data model with the user. * 9 * III. Logical Design (cont..)
  • 55. 9 * III. Logical Design (cont…) 9 * Review the complete logical model with the userReviewing the completed logical model with the users to ensure that all the data requirements have been modelled Ensure that all the transactions are supported within the different user views. This stage is very important as any problems need to be solved before beginning the physical database design stage. * 9 * IV. Physical Database DesignPhysical database design requires the definition of specific storage or access methods that will be used by the database. Involves the translation of the logical model into a set of specific DBMS specifications for storing and accessing data.The ultimate goal must be to ensure that data storage is effective to ensure integrity and security and efficient in terms of query response time.
  • 56. * 9 * IV. Physical Design (cont..)Is the process of selecting data storage and data access characteristics of the databaseThe storage characteristics are a function of device types supported by the hardware, the type of data access methods supported by the system, and DBMSParticularly important in older hierarchical and network modelsBecomes more complex when data are distributed at different locations 9 * IV. Physical Database Design (cont..) The following information needs to have been collected: A set of normalized relations devised from the ER model and the normalization process. An estimate of the volume of data which will be stored in each database table and the usage statistics. An estimate of the physical storage requirements for each field (attribute) within the database. The physical storage characteristics of the DBMS that are being used *
  • 57. 9 * Stages of Physical Database Design Analysing data volume and database usage. Translate each relation identified in the logical data model into a table. Determine a suitable file organization. Define indexes. Define user views. Estimate data storage requirements. Determine database security for users. Additional slides are after the summary * 9 * Analysing Data Volume and Database UsageThe steps required to carrying out this phase are: Identifying the most frequent and critical transactions. Analysis of critical transactions to determine which relations in the database participate in these transactions. *
  • 58. 9 * Analysing Data Volume and Database Usage (cont….)Data volume and data usage statistics are usually shown on a simplified version of the ERD. This diagram is known as a composite usage map or a transaction usage map. * 9 * Analysing Data Volume and Database Usage (cont….) * 9 * Translate logical relations into tables Identify the primary and any foreign keys for each table.
  • 59. Identify those attributes which are not allowed to contain NULL values and those which should be UNIQUE. You can exclude the primary key attribute(s) here as the PRIMARY KEY constraint automatically imposes the NOT NULL and UNIQUE constraints. * 9 * Translate logical relations into tablesFor each relation you should: Identify each attribute name and its domain from the data dictionary. Note any attributes which require DEFAULT values to be inserted into the attribute whenever new rows are inserted into the database. Determine any attributes that require a CHECK constraint in order to validate the value of the attribute. * 9 * Translate logical relations into tables (continued)
  • 60. * 9 * Translate logical relations into tables (cont..) * 9 * Determine Suitable File OrganisationSelecting the most suitable file organization is very important to ensure that the data is stored efficiently and data can be retrieved as quickly as possible.To do this the DBMS must know where this record is stored and how it can identify it. Look at the future growth of the database and whether the type of file organization provides some protection against data loss. *
  • 61. 9 * Determine Suitable File Organisation (cont..)There are three categories of file organizations:files which contain randomly ordered records known as heap filesfiles which are sorted on one or more fields such as file organizations which are based on indexesfiles hashed on one or more fields known as hash files. * 9 * Determine Suitable File Organisation (cont..)Sequential File OrganizationsRecords are stored in a sequence based on the value of one or more fields which is often the primary key. In order to locate a specific record the whole file must be searched and every record in the file must be read in turn until the required record is located. * 9
  • 62. * Determine Suitable File Organisation (cont..)Heap File OrganizationsRecords are unordered and inserted into the file as they come. Only used when a large quantity of data needs to be inserted into a table for the first time. * 9 * Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..)Indexed File OrganizationsRecords can be stored in a sorted or unsorted sequence and an index is created locate specific records quickly.
  • 63. * 9 * Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..)Types of IndexesPrimary index —these indexes are placed on unique fields such as the primary key.Secondary index —these indexes can be placed on any field in the file that is unordered.Multi- level index —is used where one index becomes too large and so is split into a number of separate indexes in order to reduce the search. * 9
  • 64. * Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..)B-treesBalanced or B-trees and are used to maintain an ordered set of indexes or data to allow efficient operations to select, delete and insert data.A special kind of B-tree is known as the B+-tree where all keys reside in the leaves. This tree is mostoften used to represent indexes which act as a ‘road_map’ so that each index can be quickly located * 9 * Determine Suitable File Organisation (cont..)
  • 65. * 9 * Determine Suitable File Organisation (cont..) * 9 * Conceptual Design of the DVD rental store * 9 * Determine Suitable File Organisation (cont..) *
  • 66. 9 * Determine Suitable File Organisation (cont..)Bitmap IndexesBitmap indexes are usually applied to attributes which are sparse in their given domain.A two-dimensional array is constructed. One column is generated for every row in the table which we want to index with each column representing a distinct value within the bitmapped index. The two-dimensional array represents each value within the index multiplied by the number of rows in the table. * 9 * Determine Suitable File Organisation (cont..) * 9 *
  • 67. Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..)Bitmap indexes are usually used when:A column in the table has low cardinality. The table is not used often for data manipulation activities and is large.Specific SQL queries reference a number of low cardinality values in their where clauses. * 9 * Determine Suitable File Organisation (cont..)Join IndexCan be applied to columns from two or more tables whose values come from the same domain. It is often referred to as a bitmap join index and it is a way of saving space by reducing the volume of data that must be joined. The bitmap join stores the ROWIDS of corresponding rows in a separate table.
  • 68. * 9 * Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..) * 9 * Determine Suitable File Organisation (cont..)Hashed File OrganizationsUses a hashing algorithm to map a primary key
  • 69. value onto a specific record address in the file. Records are stored in a random order throughout the file. Often referred to as random or direct files. * 9 * Define Indexes (cont..)In SQL, indexes are created using the CREATE INDEX statement. For example, if we wanted to create a primary index on the DVD_ID primary key field from the DVDs table the SQL would be: CREATE UNIQUE INDEX DVDINDEX ON DVD(DVD_ID) * 9 * Define Indexes (cont..)As a general rule, indexes are likely to be used:When an indexed column appears by itself in a search criteria of a WHERE or HAVING clause.When an indexed column appears by itself in a GROUP BY or ORDER BY clause.When a MAX or MIN function is applied to an indexed
  • 70. column.When the data sparsity on the indexed column is high. * 9 * Guidelines for creating IndexesCreate indexes for each single attribute used in a WHERE, HAVING, ORDER BY, or GROUP BY clause.Do not use indexes in small tables or tables with low sparsity.Declare primary and foreign keys so the query optimizer within a specific DBMS can use the indexes in join operations.Declare indexes in join columns other than PK/FK. * 9 * Define User ViewsDuring the conceptual design stage the different user views required for the database are determined.Using the relations defined in the logical data model, these views must now be defined. Views are often defined taking database security into account as they can help to define the roles of different types of users.
  • 71. * 9 * Estimate Data Storage Requirements * 9 * SecurityData must be protected from access by unauthorized usersMust provide for following: Physical securityPassword securityAccess rightsAudit trailsData encryptionDiskless workstations 9 * Determine database security for usersDuring physical database design security requirements must be implementedDatabase privileges for users will need to be established. For example, privileges may include selecting rows from specified tables or views, being able to modify or delete data in specified tables
  • 72. etc. * 9 * Determine database security for usersDuring physical database design security requirements must be implementedDatabase privileges for users will need to be established. For example, privileges may include selecting rows from specified tables or views, being able to modify or delete data in specified tables etc. * 9 * Security in ORACLEThe SQL commands GRANT and REVOKE are used to authorize or withdraw privileges on specific user accounts. For example, the following two SQL statements grant the account with the username ‘Craig’ the ability to select rows from the DVD table and the ability to create tables. GRANT SELECT ON DVD TO Craig; GRANT CREATE TABLE TO Craig;
  • 73. * 9 * Security in ORACLE (cont..)Removing these privileges can be done using the following SQL statements: REVOKE SELECT ON MOVIE FROM Craig; REVOKE CREATE TABLE FROM Craig; * 9 * Security in ORACLE (cont..)A role is simply a collection of privileges referred to under a single name. The major benefit of roles is that a DBA can add or revoke privileges from a role at any time. These changes will then automatically apply to all the users who have been assigned that role. *
  • 74. 9 * Security in ORACLE (cont..)For example, in the DVD rental store, the sales staff need to perform SELECT and UPDATE operations on the CUSTOMER table. The SQL command CREATE ROLE is used to create the role STAFF_CUSTOMER_ROLE:CREATE ROLE STAFF_CUSTOMER_ROLE;Once created, privileges can then be granted on selected database objects to the new role. * 9 * Security in ORACLE (cont..)For example: GRANT SELECT ON CUSTOMERS TO STAFF_CUSTOMER_ROLE; GRANT UPDATE ON CUSTOMERS TO STAFF_CUSTOMER_ROLE;The last stage then involves granting the role to individual users accounts, e.g. Frank: GRANT STAFF_CUSTOMER_ROLE TO Frank; *
  • 75. 9 * SummaryConceptual database design is where the conceptual representation of the database is created by producing a data model which identifies the relevant entities and relationships within the system. * 9 * Summary (cont..)Logical database design is the second stage in the Database Life Cycle, where relations are designed based on each entity and its relationships within the conceptual model. * 9 *
  • 76. Summary (cont..)Physical database design is where the logical data model is mapped onto the physical database tables to be implemented in the chosen DBMS. The ultimate goal must be to ensure that data storage is used effectively, to ensure integrity and security and to improve efficiency in terms of query response time. * 9 * Summary (cont…)Selecting a suitable file organization is important for fast data retrieval and efficient use of storage space.Indexes are crucial in speeding up data access. Indexes facilitate searching, sorting, and using aggregate functions and even join operations. * Chap 2.pptx Database Principles: Fundamentals of Design, Implementations and Management CHAPTER 2: DATA MODELS
  • 77. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 20/03/2017 1 In this chapter, you will learn: Why data models are important About the basic data-modeling building blocks What business rules are and how they influence database design How the major data models evolved How data models can be classified by level of abstraction Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 2 20/03/2017 The Importance of Data Models Data models Relatively simple representations, usually graphical, of complex real-world data structures Facilitate interaction among the designer, the applications programmer, and the end user End-users have different views and needs for data Data model organizes data for various users Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA
  • 78. 3 20/03/2017 Data Model Basic Building Blocks Entity - anything about which data are to be collected and stored Attribute - a characteristic of an entity Relationship - describes an association among entities One-to-many (1:*) relationship Many-to-many (*:*) relationship One-to-one (1:1) relationship Constraint - a restriction placed on the data Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 4 20/03/2017 Business Rules A business rule is a brief, precise, and unambiguous descriptions of a policies, procedures, or principles within a specific organization Apply to any organization that stores and uses data to generate information Description of operations that help to create and enforce actions within that organization’s environment Must be rendered in writing Must be kept up to date Sometimes are external to the organization Must be easy to understand and widely disseminated
  • 79. Describe characteristics of the data as viewed by the company Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 5 20/03/2017 Discovering Business Rules Sources of Business Rules: Company managers Policy makers Department managers Written documentation Procedures Standards Operations manuals Direct interviews with end users Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 6 20/03/2017 Translating Business Rules into Data Model Components Standardize company’s view of data Constitute a communications tool between users and designers Allow designer to understand the nature, role, and scope of data Allow designer to understand business processes
  • 80. Allow designer to develop appropriate relationship participation rules and constraints Promote creation of an accurate data model Generally, nouns translate into entities Verbs translate into relationships among entities Relationships are bi-directional Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 7 20/03/2017 The Evolution of Data Models Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 8 20/03/2017 The Evolution of Data Models (cont..) Hierarchical Network Relational Entity relationship Object oriented (OO) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA
  • 81. 9 20/03/2017 The Hierarchical Model Developed in the 1960s to manage large amounts of data for complex manufacturing projects Basic logical structure is represented by an upside-down “tree” The hierarchical structure contains levels, or segments Depicts a set of one-to-many (1:*) relationships between a parent and its children segments Each parent can have many children each child has only one parent Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 10 20/03/2017 The Hierarchical Model (cont…) Advantages Many of the hierarchical data model’s features formed the foundation for current data models Its database application advantages are replicated, though in a different form, in current database environments Generated a large installed (mainframe) base, created a pool of programmers who developed numerous tried-and-true business applications Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
  • 82. © 2013 Cengage Learning EMEA 11 Albeit= Bien que , quoique que , though 20/03/2017 The Hierarchical Model (cont..) Disadvantages Complex to implement Difficult to manage Lacks structural independence Implementation limitations Lack of standards Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 12 20/03/2017 The Network Model Created to Represent complex data relationships more effectively than the hierarchical model Improve database performance Impose a database standard While the Network model is not used today, the definitions of standard database concepts are still used by modern data models such as: Schema Conceptual organization of entire database as viewed by the database administrator
  • 83. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 13 20/03/2017 The Network Model (cont..) Subschema Defines database portion “seen” by the application programs that actually produce the desired information from data contained within the database Data Management Language (DML) Defines the environment in which data can be managed and is used to work with the data in the database Schema Data Definition Language (DDL) Enables database administrator to define schema components Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 14 20/03/2017 The Network Model (cont..) Disadvantages Too cumbersome The lack of ad hoc query capability put heavy pressure on programmers Any structural change in the database could produce havoc in all application programs that drew data from the database
  • 84. Many database old-timers can recall the interminable information delays Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 15 20/03/2017 The Relational Model Developed by Codd (IBM) in 1970 Considered ingenious but impractical in 1970 Conceptually simple Computers lacked power to implement the relational model Today, microcomputers can run sophisticated Relational Database Software called Relational Database Management System (RDBMS)- Ex: Oracle : mainframe relational software Performs same basic functions provided by hierarchical and network DBMS systems, in addition to a host of other functions Most important advantage of the RDBMS is its ability to hide the complexities of the relational model from the user Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 16 20/03/2017 The Relational Model (cont..) Table Matrix consisting of a series of row/column intersections
  • 85. Related to each other through sharing a common entity characteristic Tables, also called relations are related to each other through the sharing of a common field Relational diagram Is a representation of relational database’s entities, attributes within those entities, and relationships between those entities Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 17 20/03/2017 The Relational Model (cont..) Relational Table Stores a collection of related entities Resembles a file Relational table is purely a logical structure How data are physically stored in the database is of no concern to the user or the designer This property became the source of a real database revolution Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 18 20/03/2017 The Relational Model (cont..)
  • 86. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 19 20/03/2017 The Relational Model (continued) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 20 20/03/2017 The Relational Model (cont..) Another raison for the database model’s rise to dominance is its powerful and flexible query language Structured Query Language (SQL) allows the user to specify what must be done without specifying how it must be done SQL-based relational database application involves 3 parts: User interface A set of tables stored in the database SQL engine Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 21 20/03/2017
  • 87. The Entity Relationship Model Widely accepted and adapted graphical tool for data modeling Introduced by Peter Chen in 1976 It was the graphical representation of entities and their relationships in a database structure. More recently the class diagram component of the Unified Modeling Language (UML) has been used to produce entity relationship models. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 22 20/03/2017 The Entity Relationship Model (cont..) Entity relationship diagram (ERD) Uses graphic representations to model database components Entity is mapped to a relational table Entity instance (or occurrence) is a row in table Each entity is described by a set of attributes that describe particular characteristics of the entity Entity set is collection of like entities Connectivity labels types of relationships (1-1, 1- M, M-M) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 23 20/03/2017
  • 88. The Entity Relationship Model (cont..) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 24 20/03/2017 The Entity Relationship Model (cont..) Fig 2.4 The basic Crow’s foot ERD Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 25 20/03/2017 Data Models: A Summary Each new data model capitalized on the shortcomings of previous models Common characteristics that data models must have in order to be widely accepted: Conceptual simplicity without compromising the semantic completeness of the database Represent the real world as closely as possible Representation of real-world transformations (behavior) must comply with consistency and integrity characteristics of any data model
  • 89. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 26 20/03/2017 Data Models: A Summary (cont..) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 27 20/03/2017 Degrees of Data Abstraction Way of classifying data models Many processes begin at high level of abstraction and proceed to an ever-increasing level of detail Designing a usable database follows the same basic process Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 28 20/03/2017 Degrees of Data Abstraction (cont..) In the early 1970s, the American National Standards Institute
  • 90. (ANSI) Standards Planning and Requirements Committee (SPARC) Defined a framework for data modeling based on degrees of data abstraction: External Conceptual Internal Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 29 20/03/2017 Degrees of Data Abstraction (cont..) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 30 20/03/2017 The External Model End users’ view of the data environment Requires that the modeler subdivide set of requirements and constraints into functional modules that can be examined within the framework of their external models Advantages: Easy to identify specific data required to support each business unit’s operations Facilitates designer’s job by providing feedback about the
  • 91. model’s adequacy Creation of external models helps to ensure security constraints in the database design Simplifies application program development Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 31 20/03/2017 The External Model (cont..) Fig 2.9 External Models for Tiny College Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 32 20/03/2017 The External Model (cont..) Fig 2.9 External Models for Tiny College Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 33
  • 92. 20/03/2017 The Conceptual Model Represents global view of the entire database Representation of data as viewed by the entire organization The conceptual is the basis for identification and high-level description of main data objects, avoiding details Most widely used conceptual model is the entity relationship (ER) model Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 34 20/03/2017 The Conceptual Model (cont..) Fig 2.10 The Conceptual Model for Tiny College Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 35 20/03/2017 The Conceptual Model (cont..) First, the CM provides a relatively easily understood macro level view of data environment Second, the CM is independent of both software and hardware
  • 93. Does not depend on the DBMS software used to implement the model Does not depend on the hardware used in the implementation of the model Changes in either hardware or DBMS software have no effect on the database design at the conceptual level Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 36 20/03/2017 The Internal Model Is the representation of the database as “seen” by the DBMS The internal model should map the conceptual model to the DBMS The internal schema depicts a specific representation of an internal model Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 37 20/03/2017 Fig 2.11 An Internal Model for Tiny College Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA
  • 94. 38 20/03/2017 The Physical Model Operates at lowest level of abstraction, describing the way data are saved on storage media such as disks or tapes Software and hardware dependent Requires that database designers have a detailed knowledge of the hardware and software used to implement database design Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 39 20/03/2017 The Physical Model (cont..) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 40 20/03/2017 Summary A data model is a (relatively) simple abstraction of a complex real-world data environment Basic data modeling components are: Entities
  • 95. Attributes Relationships Constraints Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 41 20/03/2017 Summary (cont..) Hierarchical model Depicts a set of one-to-many (1:*) relationships between a parent and its children segments Network data model Uses sets to represent 1:* relationships between record types Relational model Current database implementation standard ER model is a popular graphical tool for data modeling that complements the relational model Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 42 20/03/2017 Summary (cont..) Object is basic modeling structure of object oriented data model The relational model has adopted many object-oriented extensions to become the extended relational data model (ERDM)
  • 96. Data modeling requirements are a function of different data views (global vs. local) and level of data abstraction NoSQL databases are a new generation of databases that do not use the relational model and are geared to support the very specific needs of Big Data organizations Additional slides are next Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 43 20/03/2017 The Object Oriented Model Modeled both data and their relationships in a single structure known as an object Object-oriented data model (OODM) is the basis for the object- oriented database management system (OODBMS) OODM is said to be a semantic data model Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 44 20/03/2017 The Object Oriented Model (cont..) Object described by its factual content Like relational model’s entity Includes information about relationships between facts within object, and relationships with other objects
  • 97. Unlike relational model’s entity Subsequent OODM development allowed an object to also contain all operations Object becomes basic building block for autonomous structures Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 45 20/03/2017 The Object Oriented Model (cont..) Object is an abstraction of a real-world entity Attributes describe the properties of an object Objects that share similar characteristics are grouped in classes Classes are organized in a class hierarchy Inheritance is the ability of an object within the class hierarchy to inherit the attributes and methods of classes above it Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 46 20/03/2017 The Object Oriented Model (cont..) Fig 2.5 A comparison of the OO model and the ER model Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA
  • 98. 47 20/03/2017 Other Models Extended Relational Data Model (ERDM) Semantic data model developed in response to increasing complexity of applications DBMS based on the ERDM often described as an object/relational database management system (O/RDBMS) Primarily geared to business applications Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 48 20/03/2017 Emerging Data Models: Big Data and NoSQL Big Data refers to a movement to find new and better ways to manage large amounts of Web-generated data and derive business insight from it, while simultaneously providing high performance and scalability at a reasonable cost. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA Emerging Data Models: Big Data and NoSQL (cont…) The relational approach does not always match the needs of organizations with Big Data challenges. It is not always possible to fi t unstructured, social media data into the conventional relational structure of rows and columns. Adding millions of rows of multi-format (structured and
  • 99. nonstructured) data on a daily basis will inevitably lead to the need for more storage, processing power, and sophisticated data analysis tools that may not be available in the relational environment. The type of high-volume implementations required in the RDBMS environment for the Big Data problem comes with a hefty price tag for expanding hardware, storage, and software licenses. Data analysis based on OLAP tools has proven to be very successful in relational environments with highly structured data. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA Database Models and the Internet Internet drastically changed role and scope of database market OODM and ERDM-O/RDM have taken a backseat to development of databases that interface with Internet Dominance of Web has resulted in growing need to manage unstructured information Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA 51 20/03/2017 NoSQL Databases NoSQL to refer to a new generation of databases that address the specific challenges of the Big Data era. They have the following general characteristics: Not based on the relational model, hence the name NoSQL.
  • 100. Supports distributed database architectures. Provides high scalability, high availability, and fault tolerance. Supports very large amounts of sparse data. Geared toward performance rather than transaction consistency. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA NoSQL Databases (cont..) The key-value data model is based on a structure composed of two data elements: a key and a value, in which every key has a corresponding value or set of values. The key-value data model is also referred to as the attribute- value or associative data model. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA NoSQL Databases (cont…) Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA NoSQL Databases (cont..) The data type of the “value” column is generally a long string to accommodate the variety of actual data types of the values placed in the column. To add a new entity attribute in the relational model, you need to modify the table definition. To add a new attribute in the key-value store, you add a row to the key-value store, which is why it is said to be “schema-less.” NoSQL databases do not store or enforce relationships among entities. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett
  • 101. © 2013 Cengage Learning EMEA NoSQL Databases (cont..) NoSQL databases use their own native application programming interface (API) with simple data access commands, such as put, read, and delete. Indexing and searches can be difficult. Because the “value” column in the key-value data model could contain many different data types, it is often difficult to create indexes on the data. At the same time, searches can become very complex. Database Principles 2nd Ed., Coronel, Morris, Rob & Crockett © 2013 Cengage Learning EMEA Lecture7_ch07.ppt Database Principles: Fundamentals of Design, Implementations and Management CHAPTER 7 Normalizing Database Designs * ObjectivesIn this chapter, you will learn:What normalization is and what role it plays in the database design processAbout the normal forms 1NF, 2NF, 3NF, BCNF, and 4NFHow normal forms can be transformed from lower normal forms to higher normal formsThat normalization and ER modeling are used concurrently to produce a good database
  • 102. designThat some situations require denormalization to generate information efficiently * Database Tables and NormalizationNormalization Process for evaluating and correcting table structures to minimize data redundanciesReduces data anomaliesWorks through a series of stages called normal forms: First normal form (1NF)Second normal form (2NF)Third normal form (3NF) * Database Tables and Normalization (cont..)Normalization (cont..)2NF is better than 1NF; 3NF is better than 2NFFor most business database design purposes, 3NF is as high as needed in normalizationHighest level of normalization is not always most desirableDenormalization produces a lower normal formPrice paid for increased performance is greater data redundancy * The Need for NormalizationExample: company that manages building projectsCharges its clients by billing hours spent on each contractHourly billing rate is dependent on employee’s positionPeriodically, report is generated that contains information such as displayed in Table 5.1 The Need for Normalization *
  • 103. The Need for Normalization * * The Need for Normalization (cont..)Structure of data set in Figure 7.1 does not handle data very wellTable structure appears to work; report generated with easeUnfortunately report may yield different results depending on what data anomaly has occurredRelational database environment suited to help designer avoid data integrity problems * The Normalization ProcessEach table represents a single subjectNo data item will be unnecessarily stored in more than one tableAll attributes in a table are dependent on the primary keyEach table void of insertion, update, deletion anomalies Void = depourvu de * The Normalization Process (cont..) *
  • 104. * The Normalization Process (cont..)Objective of normalization is to ensure all tables in at least 3NFHigher forms not likely to be encountered in business environmentNormalization works one relation at a timeProgressively breaks table into new set of relations based on identified dependencies * Conversion to First Normal FormRepeating groupDerives its name from the fact that a group of multiple entries of same type can exist for any single key attribute occurrenceRelational table must not contain repeating groupsNormalizing table structure will reduce data redundanciesNormalization is three-step procedure * Conversion to First Normal Form (cont.)Step 1: Eliminate the Repeating Groups Present data in tabular format, where each cell has single value and there are no repeating groupsEliminate nulls: each repeating group attribute contains an appropriate data value Step 2: Identify the Primary Key Primary key must uniquely identify attribute valueNew key must be composed Conversion to First Normal Form (cont..) *
  • 105. Conversion to First Normal Form (cont..) * Conversion to First Normal Form (cont..)Step 3: Identify All Dependencies Dependencies can be depicted with help of a diagramDependency diagram: Depicts all dependencies found within given table structureHelpful in getting bird’s-eye view of all relationships among table’s attributesMakes it less likely that will overlook an important dependency * Conversion to First Normal Form (cont..) * * Conversion to First Normal Form (cont.)First normal form describes tabular format in which:All key attributes are definedThere are no repeating groups in the tableAll attributes are dependent on primary keyAll relational tables satisfy 1NF requirementsSome tables contain partial
  • 106. dependenciesDependencies based on part of the primary keySometimes used for performance reasons, but should be used with cautionStill subject to data redundancies Conversion to Second Normal FormRelational database design can be improved by converting the database into second normal form (2NF)Two steps * * Conversion to Second Normal Form (cont..)Step 1: Write Each Key Component on a Separate Line Write each key component on separate line, then write original (composite) key on last lineEach component will become key in new table Step 2: Assign Corresponding Dependent Attributes Determine those attributes that are dependent on other attributesAt this point, most anomalies have been eliminated Conversion to Second Normal Form (cont..) *
  • 107. * Conversion to Second Normal Form (cont..)Table is in second normal form (2NF) when:It is in 1NF and It includes no partial dependencies:No attribute is dependent on only portion of primary key * Conversion to Third Normal FormData anomalies created are easily eliminated by completing three stepsStep 1: Identify Each New Determinant For every transitive dependency, write its determinant as PK for new tableDeterminant: any attribute whose value determines other values within a row Conversion to Third Normal Form (cont..)Step 2: Identify the Dependent Attributes Identify attributes dependent on each determinant identified in Step 1 and identify dependency Name table to reflect its contents and function * * Conversion to Third Normal Form (cont.)Step 3: Remove the Dependent Attributes from Transitive Dependencies Eliminate all dependent attributes in transitive relationship(s) from each of the tablesDraw new dependency diagram to show all tables defined in Steps 1–3Check new tables as well as tables modified in Step 3 to make sure that:Each table has a determinant and thatNo table contains inappropriate dependencies
  • 108. Conversion to Third Normal Form (cont..) * * Conversion to Third Normal Form (cont.)A table is in third normal form (3NF) when both of the following are true:It is in 2NFIt contains no transitive dependencies * Improving the DesignTable structures are cleaned up to eliminate troublesome initial partial and transitive dependencies Normalization cannot, by itself, be relied on to make good designs It is valuable because its use helps eliminate data redundancies * Improving the Design (cont..)Issues to address in order to produce a good normalized set of tables: Evaluate PK AssignmentsEvaluate Naming ConventionsRefine Attribute AtomicityIdentify New AttributesIdentify New RelationshipsRefine Primary Keys as Required for Data GranularityMaintain Historical AccuracyEvaluate Using Derived Attributes
  • 109. Improving the Design (cont..) * Improving the Design (cont..) * Improving the Design (cont..) * * Surrogate Key ConsiderationsWhen primary key is considered to be unsuitable, designers use surrogate keysData entries in Table 7.3 are inappropriate because they duplicate existing recordsYet there has been no violation of either entity integrity or referential integrity * Higher-Level Normal FormsTables in 3NF perform suitably in business transactional databasesHigher order normal forms useful on occasionTwo special cases of 3NF:Boyce-Codd normal form (BCNF)Fourth normal form (4NF)
  • 110. * The Boyce-Codd Normal Form (BCNF)Every determinant in table is a candidate keyHas same characteristics as primary key, but for some reason, not chosen to be primary keyWhen table contains only one candidate key, the 3NF and the BCNF are equivalentBCNF can be violated only when table contains more than one candidate key * The Boyce-Codd Normal Form (BCNF) (cont..)Most designers consider the BCNF as special case of 3NFTable is in 3NF when it is in 2NF and there are no transitive dependenciesTable can be in 3NF and fails to meet BCNFNo partial dependencies, nor does it contain transitive dependenciesA nonkey attribute is the determinant of a key attribute The Boyce-Codd Normal Form (BCNF) (cont...) * The Boyce-Codd Normal Form (BCNF) (cont..) *
  • 111. The Boyce-Codd Normal Form (BCNF) (cont..) * * SummaryNormalization is used to minimize data redundanciesFirst three normal forms (1NF, 2NF, and 3NF) are most commonly encounteredTable is in 1NF when:All key attributes are definedAll remaining attributes are dependent on primary key * Summary (continued)Table is in 2NF when it is in 1NF and contains no partial dependenciesTable is in 3NF when it is in 2NF and contains no transitive dependenciesTable that is not in 3NF may be split into new tables until all of the tables meet 3NF requirementsNormalization is important part—but only part—of the design process * Summary (continued)Table in 3NF may contain multivalued dependencies Numerous null values or redundant dataConvert 3NF table to 4NF by:Splitting table to remove multivalued dependenciesTables are sometimes denormalized to yield less I/O, which increases processing speed Additional SlidesPlease have a look a the following slides
  • 112. * * Fourth Normal Form (4NF)Table is in fourth normal form (4NF) when both of the following are true:It is in 3NF No multiple sets of multivalued dependencies4NF is largely academic if tables conform to following two rules:All attributes dependent on primary key, independent of each otherNo row contains two or more multivalued facts about an entity Fourth Normal Form (4NF) (continued) * * Fourth Normal Form (4NF) Fourth Normal Form (4NF) * * Normalization and Database DesignNormalization should be part of the design processMake sure that proposed entities meet
  • 113. required normal form before table structures are createdMany real-world databases have been improperly designed or burdened with anomaliesYou may be asked to redesign and modify existing databases * Normalization and Database Design (cont.)ER diagram Identify relevant entities, their attributes, and their relationshipsIdentify additional entities and attributesNormalization procedures Focus on characteristics of specific entitiesMicro view of entities within ER diagramDifficult to separate normalization process from ER modeling processTwo techniques should be used concurrently Figure 7.13 in your book * Normalization and Database Design (cont.) Figure 7.13 in your book * Normalization and Database Design (cont.) Figure 7.14 in your book Figure 7.14 in your book * Figure 7.15 in your book Normalization and Database Design (cont.) Figure 7.15 in your book
  • 114. Normalization and Database Design (continued) * Normalization and Database Design (continued) * Normalization and Database Design (continued) * * * Void = depourvu de * * * * *
  • 116. Database Principles: Fundamentals of Design, Implementations and Management Lecture9-CHAPTER 10 : Database Development Process In this chapter, you will learn: That successful database design must reflect the information system of which the database is a part That successful information systems are developed within a framework known as the Systems Development Life Cycle (SDLC) That within the information system, the most successful databases are subject to frequent evaluation and revision within a framework known as the Database Life Cycle (DBLC) How to conduct evaluation and revision within the SDLC and DBLC frameworks 2 In this chapter, you will learn (cont..): About database design strategies: top-down vs. bottom-up design and centralized vs. decentralized design Common threats to the security of the data and what security measures could be put in place The importance of the database administration in an organization The technical and managerial roles of the database administrator (DBA)
  • 117. 3 The Information System Provides for data collection, storage, and retrieval Composed of people, hardware, software, database(s), application programs, and procedures Systems analysis Is the process that establishes the need for and extent of an information system Systems development Is the process of creating information system 4 The Information System (cont..) Applications Transform data into information that forms the basis for decision making Usually produce the following: Formal report Tabulations Graphic displays Composed of following two parts: Data Code by which data are transformed into information 5
  • 118. The Information System (cont..) 6 The Information System (cont..) Information system performance depends on triad of factors: Database design and implementation Application design and implementation Administrative procedures Database development Is the process of database design and implementation The primary objective is to create complete, normalized, non- redundant (to the extent possible), and fully integrated conceptual, logical, and physical database models 7 The Systems Development Life Cycle (SDLC) Traces history (life cycle) of information system Provides “big picture” within which database design and application development can be mapped out and evaluated Divided into following five phases: Planning Analysis Detailed systems design Implementation Maintenance Iterative rather than sequential process
  • 119. 8 The Systems Development Life Cycle (SDLC) (cont..) 9 Planning Yields a general overview of the company and its objectives Is an initial assessment made of information-flow-and-extent requirements Must begin to study and evaluate alternate solutions Technical aspects of hardware and software requirements System cost 10 Analysis The problems defined during planning phase are examined in greater detail during analysis Thorough audit of user requirements The existing hardware and software systems are studied Goal is a better understanding of : system’s functional areas, The actual and potential problems, and opportunities
  • 120. 11 Analysis (cont..) Includes the creation of logical system design Must specify appropriate conceptual data model, inputs, processes, and expected output requirements Might use tools such as data flow diagrams (DFDs), hierarchical input process output (HIPO) diagrams, and entity relationship (ER) diagrams Yields functional descriptions of system’s components (modules) for each process within database environment 12 Detailed Systems Design The designer completes the design of the system’s processes Includes all necessary technical specifications The steps are laid out for conversion from old to new system The training principles and methodologies are also planned Submitted for management approval 13 Implementation Hardware, DBMS software, and application programs are
  • 121. installed, and the database design is implemented The system enters into: A cycle of coding, Testing, and debugging continues until it is ready to be delivered The actual database is created and the system is customized by creation of tables and views, and user authorizations 14 Maintenance Maintenance activities can be grouped into three types: Corrective maintenance in response to systems errors Adaptive maintenance due to changes in business environment Perfective maintenance to enhance system Computer-assisted systems engineering (CASE) Make it possible to produce better systems within reasonable amount of time and at reasonable cost CASE-produced applications are structured, documented, standardized 15 16 The Database Life Cycle (DBLC) Six phases: Database initial study
  • 122. Database design Implementation and loading Testing and evaluation Operation Maintenance and evolution The Database Life Cycle (DBLC) 17 The Database Initial Study Overall purpose: Analyze company situation Define problems and constraints Define objectives Define scope and boundaries Fig 10.4 in the next slide depicts the interactive and iterative processes required to complete first phase of DBLC successfully 18 The Database Initial Study (cont..) Fig 10.4 in your book 19
  • 123. Analyze the Company Situation Analysis–To break up any whole into its parts so as to find out their nature, function, and so on Company situation General conditions in which company operates, its organizational structure, and its mission Analyze company situation Discover what company’s operational components are, how they function, and how they interact 20 Define Problems and Constraints Managerial view of company’s operation is often different from that of end users The Database Designer must continue to carefully probe to generate additional information that will help define problems within larger framework of company operations Finding precise answers is important Defining problems does not always lead to perfect solution 21 Define Objectives Designer must ensure that database system objectives correspond to those envisioned by end user(s) Designer must begin to address following questions:
  • 124. What is proposed system’s initial objective? Will system interface with other existing or future systems in the company? Will system share data with other systems or users? 22 Define Scope and Boundaries Scope Defines extent of design according to operational requirements Helps define required data structures, type and number of entities, and physical size of database Boundaries Limits external to system Often imposed by existing hardware and software 23 Database Design Necessary to concentrate on data Characteristics required to build database model Two views of data within system: Business view of data as information source Designer’s view of data structure, its access, and activities required to transform data into information 24
  • 125. Database Design (cont..) Fig 10.5 in your book 25 Database Design (cont..) Loosely related to analysis and design of larger system The Systems analysts or systems programmers are in charge of designing other system components Their activities create procedures that will help transform data within database into useful information Does not constitute sequential process Iterative process that provides continuous feedback designed to trace previous steps 26 Database Design (cont..) 27 I. Conceptual Design Overview
  • 126. Data modeling used to create an abstract database structure that represents real-world objects in most realistic way possible Must embody clear understanding of business and its functional areas Ensure that all data needed are in model, and that all data in the model are needed 28 I. Conceptual Design Overview (cont..) Requires four steps Data analysis and requirements Discover data element characteristics Obtains characteristics from different sources Take into account business rules Derived from description of operations Entity relationship modeling and normalization Designer enforces standards in design documentation Use of diagrams and symbols, documentation writing style, layout, other conventions 29 30 I. Conceptual Design Overview (cont..) 3. Data model verification Verified against proposed system processes Revision of original design Careful reevaluation of entities
  • 127. Detailed examination of attributes describing entities Define design’s major components as modules: Module: information system component that handles specific function 31 I. Conceptual Design Overview (cont..) Data model verification (cont…) Verification process Select central (most important) entity Defined in terms of its participation in most of model’s relationships Identify module or subsystem to which central entity belongs and define boundaries and scope Place central entity within module’s framework 32 I. Conceptual Design Overview(cont..) Distributed database design Portions of the database may reside in different physical locations Processes accessing the database vary from one location to another The Designer must also develop data distribution and allocation strategies II. DBMS Software Selection Critical to information system’s smooth operation Common factors affecting purchasing decisions: Cost DBMS features and tools Underlying model
  • 128. Portability DBMS hardware requirements Advantages and disadvantages should be carefully studied 33 III. Logical Design Overview Used to translate conceptual design into internal model for selected database management system Logical design is software-dependent Requires that all objects in model be mapped to specific constructs used by selected database software Definition of attribute domains, design of required tables, access restriction formats Tables must correspond to entities in conceptual design Translates software-independent conceptual model into software-dependent logical model 34 III. Logical Design Overview (cont..) The logical design stage consists of the following phases: Creating the logical data model. Validating the logical data model using normalization. Assigning and validating integrity constraints. Merging logical models constructed for different parts for the
  • 129. database together. Reviewing the logical data model with the use 35 IV. Physical Design Overview Is the Process of selecting data storage and data access characteristics of database Storage characteristics are function of device types supported by hardware, type of data access methods supported by system, and DBMS Particularly important in older hierarchical and network models Becomes more complex when data are distributed at different locations 36 IV. Physical Design Overview (cont..) Physical database design can be broken down into a number of stages: Analyze data volume and database usage. Translate each relation identified in the logical data model into tables. Determine a suitable file organization. Define indexes. Define user views. Estimate data storage requirements. Determine database security for users.
  • 130. 37 Implementation and Loading New database implementation requires creation of special storage-related constructs to house end-user tables 38 Performance Is one of the most important factors in certain database implementations Not all DBMSs have performance-monitoring and fine-tuning tools embedded in their software Performance evaluation is rendered more difficult as there is no standard measurement for database performance 39 Backup and Recovery Database can be subject to data loss through unintended data deletion and power outages Data backup and recovery procedures Create safety valve Allow database administrator to ensure availability of consistent
  • 131. data Integrity Enforced through proper use of primary and foreign key rules 40 Company Standards May partially define database standards Database administrator must implement and enforce such standards Database Security Data must be protected from access by unauthorized users Establish security goals - What are we trying to protect the database from? - What security related problems are we trying to prevent? The most common security goals relate to the integrity, confidentiality and the availability of data. 41 Data Security Measures Physical security allows only authorized personnel physical access to specific areas. User authentication is a way of identifying the user and verifying that the user is allowed to access some restricted data or application. achieved through the use of passwords and access rights. Audit trails are usually provided by the DBMS to check for access violations.
  • 132. 42 Data Security Measures (cont..) Data encryption Can be used to render data useless to unauthorised users. ORACLE DBMS has a Transparent Data Encryption User-defined policies and procedures Backup and recovery strategies should be in place in the event of a disaster occurring Antivirus software Firewalls are systems comprising of hardware devices or software applications which act as gatekeepers to an organisation’s network. For more details on security measures read the slides after the chapter summary 43 Testing and Evaluation This phase occurs in parallel with applications programming Programmers use database tools to prototype applications during coding of the programs If the DB implementation fails to meet some of system’s evaluation criteria, several options may be considered to enhance the system: Fine-tune specific system and DBMS configuration parameters Modify physical design
  • 133. Modify logical design Upgrade or change DBMS software and/or hardware platform 44 Operation Once the database has passed the evaluation stage, it is considered operational The beginning of the operational phase starts the process of system maintenance and evolution 45 Maintenance and Evolution Required periodic maintenance: Preventive maintenance (backup) Corrective maintenance (recovery) Adaptive maintenance Assignment of access permissions and their maintenance for new and old users Generation of database access statistics Periodic security audits Periodic system-usage summaries 46 Parallel Activities in the DBLC and the SDLC
  • 134. 47 Summary Information system is designed to facilitate transformation of data into information and to manage both data and information SDLC traces history (life cycle) of an application within the information system DBLC describes history of database within the information system Database design and implementation process moves through series of well-defined stages Conceptual portion of design may be subject to several variations, based on two design philosophies 48 Summary (cont..) Threats to database security include the loss of integrity, confidentiality and availability of data. The database administrator (DBA) is responsible for managing the corporate database. The development of the data administration strategy is closely related to the company’s mission and objectives. 49
  • 135. Threats to Security Threats are any set of circumstances that have the potential to cause loss, misuse or harm to the system and/or its data. Threats can cause: The loss of the integrity of data through unauthorized modification. For example a person gaining unauthorized access to a bank account and removing some money from the account. 50 Threats to Security The loss of availability of the data. For example some adversary causes the database system from being operational which stops authorized users of the data from accessing it. The loss of confidentiality of the data (also referred to as the privacy of data). This could be caused by a person gaining access to private information such as a password or a bank account balance. 51 Examples of Threats Theft and fraud of data. Human error which causes accidental loss of data.
  • 136. Electronic infections Viruses Email Viruses Worms Trojan Horses 52 Examples of Threats (cont..) The occurrence of natural disasters such as hurricanes, fires or floods. Unauthorized access and modification of data. Employee sabotage is concerned with the deliberate acts of malice against the organization. Poor database administration. 53 Examples of Threats (cont..) 54 Database Design Strategies Two classical approaches to database design: Top-down design
  • 137. Identifies data sets Defines data elements for each of those sets Bottom-up design Identifies data elements (items) Groups them together in data sets 55 Database Design Strategies Top-down vs. bottom-up design sequencing 56 Centralized vs. Decentralized Design Database design may be based on two very different design philosophies: Centralized design Productive when data component is composed of relatively small number of objects and procedures Decentralized design Used when data component of system has considerable number of entities and complex relations on which very complex operations are performed 57
  • 138. Centralized vs. Decentralized Design Centralized Design 58 Decentralized Design 59 Centralized vs. Decentralized Design (cont..) Aggregation process Requires designer to create single model in which various aggregation problems must be addressed: Synonyms and homonyms Entity and entity subtypes Conflicting object definitions 60 Centralized vs. Decentralized Design Summary of aggregation problems 61
  • 139. Database Administration Data management is a complex job Led to the development of the database administration function. The person responsible for the control of the centralized and shared database is the database administrator (DBA). 62 DBA Activities Database planning, including the definition of standards, procedures and enforcement. Database requirements gathering and conceptual design. Database logical design and transaction design. 63 DBA Activities (cont..) Database physical design and implementation. Database testing and debugging. Database operations and maintenance, including installation, conversion and migration. Database training and support. 64
  • 140. The DBA in the Organisation 65 DBA Skills 66 The Managerial Role of the DBA 67 The Managerial Role of the DBA (cont..) End-User Support Gathering user requirements Building end-user confidence. Resolving conflicts and problems. Finding solutions to information needs. Ensuring quality and integrity of applications and data. Managing the training and support of DBMS users. 68
  • 141. The Managerial Role of the DBA (cont..) Policies, Procedures and Standards Policies are general statements of direction or action that communicate and support DBA goals. Standards are more detailed and specific than policies and describe the minimum requirements of a given DBA activity. Procedures are written instructions that describe a series of steps to be followed during the performance of a given activity. 69 The Managerial Role of the DBA (cont..) Data Security, Privacy and Integrity Protecting the security and privacy of the data in the database is a function of authorization management. Authorization management defines procedures to protect and guarantee database security and integrity. Includes: user access management, view definition, DBMS access control and DBMS usage monitoring. 70 The Managerial Role of the DBA (cont..) Data Backup and Recovery Many DBA departments have created a position staffed by the database security officer (DSO).
  • 142. The DSO’s activities are often classified as disaster management. Disaster management includes all of the DBA activities designed to secure data availability following a physical disaster or a database integrity failure. Disaster management includes all planning, organizing and testing of database contingency plans and recovery procedures. 71 The Managerial Role of the DBA (cont..) Data Distribution and Use The DBA is responsible for ensuring that the data are distributed to the right people, at the right time and in the right format. 72 The Technical Role of the DBA Evaluating, selecting and installing the DBMS and related utilities. Designing and implementing databases and applications. Testing and evaluating databases and applications. Operating the DBMS, utilities and applications. Training and supporting users. Maintaining the DBMS, utilities and applications.
  • 143. 73 Evaluating, Selecting and Installing the DBMS and Utilities (DBA) Covers the selection of the database management system, utility software and supporting hardware for use in the organization. Must be based primarily on the organization’s needs The DBA would be wise to develop a checklist of desired DBMS features. 74 Designing and Implementing Databases and Applications (DBA) Covers data modelling and design services to the end-user community Determine and enforce standards and procedures to be used. DBA then provides the necessary assistance and support during the design of the database at the conceptual, logical and physical levels 75 Testing and Evaluating Databases and Applications (DBA) The DBA must also provide testing and evaluation services for all of the database and end-user applications. Those services are the logical extension of the design, development and implementation services.