Beruflich Dokumente
Kultur Dokumente
Introductionto
DatabaseSystems
Chapter1Objectives
Somecommonusesofdatabasesystems.
Characteristicsoffilebasedsystems.
Problemswithfilebasedapproach.
Meaningofthetermdatabase.
MeaningofthetermDatabaseManagementSystem(DBMS).
TypicalfunctionsofaDBMS.
MajorcomponentsoftheDBMSenvironment.
PersonnelinvolvedintheDBMSenvironment.
HistoryofthedevelopmentofDBMSs.
AdvantagesanddisadvantagesofDBMSs.
12/14/15
Chapter1ObjectivesContd
PurposeofthreelevelANSISPARCdatabasearchitecture.
Contentsofexternal,conceptual,andinternallevels.
Purposeofexternal/conceptualandconceptual/internal
mappings.
Meaningoflogicalandphysicaldataindependence.
DistinctionbetweenDDLandDML.
Aclassificationofdatamodels.
ArchitectureforMultiUserDatabaseSystem
12/14/15
Database systems
Today, Databases are essential to
12/14/15
ExamplesofDatabaseApplications
Purchasesfromthesupermarket
Purchasesusingyourcreditcard
Bookingaholidayatthetravelagents
Usingthelocallibrary
Takingoutinsurance
Rentingavideo
ECommerce
Banking
Socialmedia(ingeneraltheWWW)
5
12/14/15
Approaches in
Organizations
Data management passes through the different
12/14/15
Manual Approach
Cards and paper are used for the purpose
Files for as many event and objects as the organization has are used to
store information.
Each of the files containing various kinds of information is labelled and
stored in one or more cabinets.
The cabinets could be kept in safe places for security purpose based on
the sensitivity of the information contained in it ( Cabinet Lockers).
Insertion and retrieval is done by searching first for the right cabinet
then for the right file then the information.
One could have an indexing system to facilitate access to the data
Limitations of the Manual approach
Prone to error
Difficult to update, retrieve, integrate
You
referencing is difficult
12/14/15
FileBasedSystems
Collectionofapplicationprogramsthatperform
servicesfortheendusers(e.g.reports).
Eachprogramdefinesandmanagesitsowndata.
12/14/15
FileBasedProcessing
12/14/15
LimitationsofFileBasedApproach
Separationandisolationofdata
Eachprogrammaintainsitsownsetofdata.
Usersofoneprogrammaybeunawareof
potentiallyusefuldataheldbyotherprograms.
Duplicationofdata
Samedataisheldbydifferentprograms.
Wastedspaceandpotentiallydifferentvalues
and/ordifferentformatsforthesameitem.
10
12/14/15
LimitationsofFileBasedApproach
Datadependence(ProgramDataDependence)
Filestructureisdefinedintheprogramcode.
Anychangeinthedatastructurenecessitatesachangeinthe
programaswell
Incompatiblefileformats
Programsarewrittenindifferentlanguages,andsocannot
easilyaccesseachothersfiles.(C,COBOL)DataStructures
aredifferentfordifferentLanguages
FixedQueries/Proliferationofapplicationprograms
Programsarewrittentosatisfyparticularfunctions.
Anynewrequirementneedsanewprogram.
11
12/14/15
DatabaseApproach
Problemsoffileapproacharosebecause:
Definitionofdatawasembeddedinapplicationprograms,
ratherthanbeingstoredseparatelyandindependentofthe
applications.
Nocontroloveraccessandmanipulationofdatabeyond
thatimposedbyapplicationprograms.
Solution(Result):
ThedatabaseandDatabaseManagementSystem(DBMS).
ThisapproachsolvestheproblemsoftheFilebased
Approach
12
12/14/15
Database
Sharedcollectionoflogicallyrelateddata(anda
descriptionofthisdata),designedtomeetthe
informationneedsofanorganization.
Systemcatalogue(metadata)providesdescription
ofdatatoenableprogramdataindependence.
Logicallyrelateddatacomprisesentities,
attributes,andrelationshipsofanorganizations
information.
13
12/14/15
DatabaseManagementSystem(DBMS)
Asoftwaresystemthatenablesuserstodefine,
create,maintain,andcontrolaccesstothe
database.
(Database)applicationprogram:acomputer
programthatinteractswithdatabasebyissuingan
appropriaterequest(SQLstatement)totheDBMS.
14
12/14/15
DatabaseManagementSystem(DBMS)
15
12/14/15
DatabaseApproachContd..
Datadefinitionlanguage(DDL).
Permitsspecificationofdatatypes,structuresandany
dataconstraints.
Allspecificationsarestoredinthedatabase.
EnablestheCreation,AlterationandRemovalofa
DatabaseObject
Datamanipulationlanguage(DML).
Generalenquiryfacility(querylanguageretrieval)ofthe
data.
Inadditiontoquerying,wecanalsohavemanipulationof
Data(AddingNewinfo,Updatinginfo,Deletinginfo)
16
12/14/15
DatabaseApproachAccessControl
Controlledaccesstodatabasemay
include:(User/Roledefinition,Privilege
Assignment/Revocation,Access
Enforcement)
asecuritysystem
anintegritysystem
aconcurrencycontrolsystem
arecoverycontrolsystem
auseraccessiblecatalogue.
17
12/14/15
DatabaseViews
TheDatabaseApproachintroducesalittle
complexityonthepartoftheenduser.
AlthoughtheDatabaseisasharedcollection,users
areinterestedintheirspecificdataneeds
Aviewallowseachusertohavehisorherown
viewofthedatabase.
Aviewisessentiallysomesubsetofthedatabase.
DataIrrelevanttoauserisnotatallvisible
18
12/14/15
ViewsBenefits
Reducecomplexity
Providealevelofsecurity
Provideamechanismtocustomizetheappearance
ofthedatabase
Presentaconsistent,unchangingpictureofthe
structureofthedatabase,eveniftheunderlying
databasestructureischanged
19
12/14/15
ComponentsofDBMSEnvironment
20
ComponentsofDBMSEnvironment
Hardware
CanrangefromaPCtoanetworkofcomputers.
Includesallthenecessaryinput,output,storage
andbackupdevices
Software
DBMS,operatingsystem,networksoftware(if
necessary)andalsotheapplicationprograms.
Data
Datausedbytheorganizationandadescriptionof
thisdatacalledtheschema.
21
12/14/15
ComponentsofDBMSEnvironment
Procedures
Instructionsandrulesthatshouldbeappliedto
thedesignanduseofthedatabaseandDBMS.
People
DifferentRolestakenbypeoplewhiledesigningand
usingaDatabasesystems
22
12/14/15
RolesintheDatabaseEnvironment
DataAdministrator(DA)
Responsible on management of data resources.
23
12/14/15
Database Designers
DatabaseDesigners(LogicalandPhysical)
Identifies the data to be stored and choose the
12/14/15
Database DesignersContd
Logical and Conceptual DBD
Identifies data (entity, attributes and relationship) relevant to the
organization
Identifies constraints on each data
Understands data and business rules in the organization
Sees the database independent of any data model at conceptual
level and considers one specific data model at logical design
phase.
Physical DBD
Takes logical design specification as input and decide how it
12/14/15
Application Programmers
System analyst determines the user
12/14/15
EndUsers(naiveandsophisticated)
Nave Users:
Sizable proportion of users
Unaware of the DBMS
Only access the database based on their access
level and demand
Use standard and pre-specified types of queries.
Sophisticated Users
Users familiar with the structure of the Database
27
12/14/15
HistoryofDatabaseSystems
Firstgeneration
HierarchicalandNetwork
Secondgeneration
Relational
Thirdgeneration
ObjectRelational
ObjectOriented
28
12/14/15
AdvantagesofDBMSs
Controlofdataredundancy
Dataconsistency
Moreinformationfromthesameamountofdata
Sharingofdata
Improveddataintegrity
Improvedsecurity
Enforcementofstandards
Economyofscale
29
12/14/15
AdvantagesofDBMSs
Balanceconflictingrequirements
Improveddataaccessibilityandresponsiveness
Increasedproductivity
Improvedmaintenancethroughdataindependence
Increasedconcurrency
Improvedbackupandrecoveryservices
30
12/14/15
DisadvantagesofDBMSs
Complexity
Size
CostofDBMS
Additionalhardwarecosts
Costofconversion
Performance
Higherimpactofafailure
31
12/14/15
ObjectivesofThreeLevelANSISPARC
Architecture
Allusersshouldbeabletoaccesssamedata.
Ausersviewisimmunetochangesmadeinother
usersviews.
Usersshouldnotneedtoknowphysicaldatabase
storagedetails.
32
12/14/15
ObjectivesofThreeLevelANSISPARC
Architecture
DBAshouldbeabletochangedatabasestorage
structureswithoutaffectingtheusersviews.
Internalstructureofdatabaseshouldbeunaffected
bychangestophysicalaspectsofstorage.
DBAshouldbeabletochangeconceptualstructure
ofdatabasewithoutaffectingallusers.
33
12/14/15
ANSISPARCThreeLevelArchitecture
34
12/14/15
ANSISPARCThreeLevelArchitecture
ExternalLevel
Usersviewofthedatabase.
Describesthatpartofdatabasethatisrelevanttoa
particularuser.
ConceptualLevel
Communityviewofthedatabase.
Describeswhatdataisstoredindatabaseand
relationshipsamongthedata.
35
12/14/15
ANSISPARCThreeLevelArchitecture
InternalLevel
Physicalrepresentationofthedatabaseonthe
computer.
Describeshowthedataisstoredinthedatabase.
ThisishowtheOSandDBMSviewData
36
12/14/15
DifferencesbetweenThreeLevelsof
ANSISPARCArchitecture
37
12/14/15
DataIndependence
MainConceptisUpperlayersareimmuneto
changesinthelowerlayers
LogicalDataIndependence
Referstoimmunityofexternalschemastochangesin
conceptualschema.
Conceptualschemachanges(e.g.addition/removalof
entities)shouldnotrequirechangestoexternal
schemaorrewritesofapplicationprograms.
Obviouslyparticularuserswillbeaffectedbutnotall
users
38
12/14/15
DataIndependence
PhysicalDataIndependence
Referstoimmunityofconceptualschematochangesin
theinternalschema.
Internalschemachanges(e.g.usingdifferentfile
organizations,storagestructures/devices)shouldnot
requirechangetoconceptualorexternalschemas.
39
12/14/15
Organizational Data
The DBMS is responsible for mapping between these
12/14/15
DataIndependenceandtheANSISPARC
ThreeLevelArchitecture
41
12/14/15
DatabaseLanguages
DataDefinitionLanguage(DDL)
AllowstheDBAorusertodescribeandname
entities,attributes,andrelationshipsrequiredforthe
application
plusanyassociatedintegrityandsecurityconstraints.
42
12/14/15
DatabaseLanguages
DataManipulationLanguage(DML)
Providesbasicdatamanipulationoperationsondata
heldinthedatabase.
ProceduralDML
allowsusertotellsystemexactlyhowtomanipulate
data.
NonProceduralDML
allowsusertostatewhatdataisneededratherthan
howitistoberetrieved.
FourthGenerationLanguages(4GLs)
AutomatedCASEtools
43
12/14/15
DataModel
Defined:Integratedcollectionofconceptsfordescribingdata,relationships
betweendata,andconstraintsonthedatainanorganization.
DataModelcomprises:
astructuralpart;
amanipulativepart;
possiblyasetofintegrityrules.
CanhaveThreetypesofModels(InlinewithANSISPARC)
1. anexternaldatamodel,torepresenteachusersviewofthe
organization,sometimescalledtheUniverseofDiscourse(UoD);
2. aconceptualdatamodel,torepresentthelogical(orcommunity)view
thatisDBMSindependent;
3. aninternaldatamodel,torepresenttheconceptualschemainsuchaway
thatitcanbeunderstoodbytheDBMS.
44
12/14/15
DataModel
Purpose
Torepresentdatainanunderstandableway.
Categoriesofdatamodelsinclude:
Objectbased
Recordbased
Physical.
45
12/14/15
DataModels
ObjectBasedDataModels
basedontheconceptofEntity(distinctobject)
EntityRelationshipConsidersonlythedataaspect
ObjectOrientedconsidersbothdataandbehaviour.
Relational)
basedonfixedformatrecords
Eachrecordhasfixednumberoffields
eachfieldisofafixedlength
PhysicalDataModels
Modelsfordescribingphysicalstoragecharacterstics
Fundamentals of Database Systems (INSY
321)
12/14/15
12/14/15
HierarchicalDataModel
48
12/14/15
12/14/15
NetworkDataModel
50
12/14/15
51
12/14/15
Model for Large Shared Data Banks famous paper of Dr. Edgar F.
Codd
Terminologies originates from the branch of mathematics called set theory and
predicate logic and is based on the mathematical concept called Relation
Can define more flexible and complex relationship
Viewed as a collection of tables called Relations equivalent to collection of
record types
Relation: Two dimensional table
Stores information or data in the form of tables rows and columns
A row of the table is called tuple equivalent to record
A column of a table is called attribute equivalent to fields
Data value is the value of the Attribute
Records are related by the data stored jointly in the fields of records in two
tables or files. The related tables contain information that creates the
relationship
Uses Declarative ( as Opposed to Procedural) approach to Database
Processing
Can Treats Records as a Group (Set)
52
12/14/15
RelationalDataModel
53
12/14/15
PhysicalDataModels
Used in Internal Database Design
structure / Class/ Type Def
54
12/14/15
ConceptualModelling
Conceptualschemaisthecoreofasystemsupportingall
userviews.
Shouldbecompleteandaccuraterepresentationofan
organizationsdatarequirements.
Conceptualmodellingisprocessofdevelopingamodelof
informationuseinanorganizationthatisindependentof
implementationdetailssuchasthetargetDBMS,
applicationprograms,programminglanguages,orany
otherphysicalconsiderations.
Resultisaconceptualdatamodel.
55
12/14/15
Logical Modeling
Conceptual models are also referred to
12/14/15
FunctionsofaDBMS
DataStorage,Retrieval,andUpdate.
AUserAccessibleCatalog.
TransactionSupport.
ConcurrencyControlServices.
RecoveryServices.
57
12/14/15
FunctionsofaDBMS
AuthorizationServices.
SupportforDataCommunication.
IntegrityServices.
ServicestoPromoteDataIndependence.
Utility Services( Import/Export, Task scheduler,
etc)
58
12/14/15
SystemCatalog
Repositoryofinformation(metadata)describing
thedatainthedatabase.
OneofthefundamentalcomponentsofDBMS.
Typicallystores:
names,types,andsizesofdataitems;
constraintsonthedata;
namesofauthorizedusers;
dataitemsaccessiblebyauserandthetypeofaccess;
usagestatistics.
59
12/14/15
ComponentsofaDBMS
60
12/14/15
ComponentsofDatabaseManager(DM)
61
12/14/15
62
12/14/15
Tele-Processing
The traditional architecture for multi-user
63
12/14/15
Disadvantage
Unfortunately, this architecture placed a
64
12/14/15
File-Server Architecture
In a file-server environment, the processing is
12/14/15
File-Server Contd
66
12/14/15
traffic.
(2) A full copy of the DBMS is required on
each workstation.
(3) Concurrency, recovery, and integrity
control are more complex because there
can be multiple DBMSs accessing the same
files at the same time.
67
12/14/15
ClientServer Architecture
To overcome the disadvantages of the first
68
69
12/14/15
70
12/14/15
12/14/15
72
12/14/15