Database, Lecture-1.ppt

MatshushimaSumaya 2,717 views 57 slides Nov 25, 2022
Slide 1
Slide 1 of 57
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57

About This Presentation

Organizing Data in a Traditional File Environment
File organization Term and Concepts
Computer system organizes data in a hierarchy
Bit: Smallest unit of data; binary digit (0,1)
Byte: Group of bits that represents a single character
Field: Group of characters as word(s) or number
Record: Group of r...


Slide Content

Database Management
Systems
Dr. Md. Rakibul Hoque
University of Dhaka

Organizing Data in a Traditional
File Environment
•File organization Term and Concepts
•Computer system organizes data in a hierarchy
•Bit:Smallestunitofdata;binarydigit(0,1)
•Byte:Groupofbitsthatrepresentsasingle
character
•Field:Groupofcharactersasword(s)or
number
•Record:Groupofrelatedfields
•File:Groupofrecordsofsametype

Organizing Data in a Traditional
File Environment
•File organization Term and Concepts
•Computer system organizes data in a hierarchy
•Database:Groupofrelatedfiles
•Entity:Person,place,thingonwhichwe
storeinformation.
•Attribute:Eachcharacteristic,orquality,
describingentity
•E.g.,AttributesDateorGradebelongtoentity
COURSE

The Data Hierarchy
A computer system
organizes data in a
hierarchy that starts
with the bit, which
represents either a 0 or
a 1. Bits can be
grouped to form a byte
to represent one
character, number, or
symbol. Bytes can be
grouped to form a field,
and related fields can
be grouped to form a
record. Related records
can be collected to form
a file, and related files
can be organized into a
database.
Organizing Data in a Traditional
File Environment

Traditional File Processing
The use of a traditional approach to file processing encourages each
functional area in a corporation to develop specialized applications and files.
Each application requires a unique data file that is likely to be a subset of the
master file. These subsets of the master file lead to data redundancy and
inconsistency, processing inflexibility, and wasted storage resources.
Organizing Data in a Traditional
File Environment

Database
•Adatabaseisacollectionofinformationthatis
organizedsothatitcaneasilybeaccessed,
managed,andupdated.Inoneview,databases
canbeclassifiedaccordingtotypesofcontent:
bibliographic,full-text,numeric,andimages.
•Adatabaseisalogicallycoherentcollectionofdata
withsomeinherentmeaning,representingsome
aspectofrealworldandwhichisdesigned,builtand
populatedwithdataforaspecificpurpose.A
databaseisnotnecessarilycomputerized.Itcan
begeneratedandmaintainedmanually,oritmaybe
computerized.

Database
Databasesareusedineverypartofday-to-daylife.
Examplesofcommondatabaseuseinclude:depositing
orwithdrawingmoneyfromabank,makingatravel
reservation,accessingalibrarycatalog,buying
somethingfromtheinternetetc.Theseareexamplesof
traditionaldatabaseapplications,wheredataisstored
eitherintextualornumericformat.Lesstraditional
databaseapplicationsthatarestartingtobecomemore
popularincludemultimediadatabases,whichstore
pictures,videoclips,andsounds,Geographic
InformationSystems(GIS)thatstoremaps,satellite
imagesandweatherdata.

Database Management
System
Adatabasemanagement system
(DBMS)isacollectionofinterrelated
dataandasetofprogramstoaccess
thosedata.Thecollectionofdata,
usuallyreferredtoadatabase,contains
informationrelevanttoanenterprise.
DBMSisasystemthatallowsinserting,
updating,deletingandprocessingof
data.

Database Management
System
Adatabasemanagementsystemisa
collectionofprogramsthatenableusersto
createandmaintainadatabase.
-----Elmarsi&Navathe
Adatabasemanagementsystem,or
DBMS,isasoftwaredesignedtoassistin
maintainingandutilizinglargecollectionsof
data.---------Ramakrishnan&Gehrke

Goals/Purposes of DBMS
TheprimarygoalofaDBMSistoprovide
anenvironmentthatisbothconvenient
andefficientforpeopletousein
retrievingandstoringinformation.
Databasesystemsaredesignedto
managelargebodiesofinformation.
Managementofdatainvolvesboth
definingstructuresforstorageof
informationandprovidingmechanismsfor
manipulationofinformation.

Goals/Purposes of DBMS
Thedatabasesystemmustensurethe
safetyandsecurityoftheinformation
stored,despitesystemcrashesorattempts
atunauthorizedaccess.
Thesystemmustavoidpossible
anomalousresultsifdataaretobeshared
amongseveralusers.

Database System
Applications
Databasesarewidelyused.Some
representativeapplicationsare:
1.Banking:Forcustomerinformation,
accounts,loansandbankingtransactions.
2.Airlines/Railways/RoadTransport:For
ticketreservation,schedulesandroutes.

Database System
Applications
3.Universities:Forstudentinformation,
coursesandgrades(education
management).
4.Creditcardtransaction:For
purchasesoncreditcard,monthly
statementgeneration

Database System
Applications
5.Telecommunication:Forkeeping
recordsofcallmade,generating
monthlybills,maintainingbalanceson
prepaidcallingcards,storing
informationaboutthecommunication
networks.

Database System
Applications
6.Finance:Forstoringinformation
aboutholdings,sales,andpurchases
offinancialinstrumentssuchasstocks
andbonds.
7.Sales:Forcustomer,productand
purchaseinformation.

Database System
Applications
8.Manufacturing:Formanagementof
supplychainsandfortrackingproduction
ofitemsinfactories,inventoriesofitems
inwarehouses/storesandorderforitems.
9.Humanresources:Forinformation
aboutemployees,salaries,payrolltaxes
andbenefitsandforgenerationofpay
checks.

Some Commercial Database
Management Software
For Personal Computers
1. Microsoft Access
2. FoxPro
3. dBase

Some Commercial Database
Management Software
1.Oracle –Oracle 8i, Oracle9i, Oracle 10g, 11g
2. Microsoft SQL Server
3. IBM DB2/DB2UDB
4. Informix
5. Sybase
6. Ingress

Some Open Source Database
Management Software
1. CUBRID
2. Firebird
3. MariaDB
4. MongoDB
5. Postgre SQL
6. MySQL
7. SQLite

Database Systems Vs File
Systems ( Why DBMS?)
Ordinaryfilesystemhasanumberofmajor
drawbacks:
1.Dataredundancyandinconsistency-
Multiplefileformats,duplicationof
informationindifferentfiles.
2.Difficultyin accessing data
-Needtowriteanewprogramtocarryout
eachnewtask

Database Systems Vs File
Systems ( Why DBMS?)
3.Dataisolation
-Multiplefilesand formats
4.Integrityproblems
-Integrityconstraints(e.g.account
balance>0)becomepartofprogram
code
-Hardtoaddnewconstraintsor
changeexistingones.

Database Systems Vs File
Systems ( Why DBMS?)
5.Atomicityproblems
-Failuresmayleavedatabaseinan
inconsistentstatewithpartialupdates
carriedout.E.g.,transferoffundsfrom
oneaccounttoanothershouldeither
completeornothappenatall.

Database Systems Vs File
Systems ( Why DBMS?)
6.Concurrent-accessanomalies
-Neededforsystemperformanceand
usability
-Uncontrolledconcurrentaccesses
canleadtoinconsistencies.E.g.two
peoplereadingabalanceandupdating
itatthesametime.

Database Systems Vs File
Systems ( Why DBMS?)
7.Securityproblems:Noteveryuserof
thedatabasesystemshouldbeableto
accessallthedata.
Databasesystemsoffersolutionsto
alltheseproblems

View of Data
Adatabasesystemisacollectionof
interrelatedfilesandsetofprograms
thatallowuserstoaccessandmodify
thesefiles.Amajorpurposeofa
databasesystemistoprovideusers
anabstractviewofthedata.Thatis,
thesystemhidescertaindetailsofhow
thedataisstoredandmaintained.

Data Abstraction
Severallevelsofdataabstractionare
maintainedtosimplifyusers’interaction
withthesystem:
1.Physicallevel:Thelowestlevelof
abstractiondescribeshowdataare
actuallystored.Itdescribescomplex
low-leveldatastructuresindetail.

Data Abstraction
2.Logicallevel:Thenexthigherlevel
ofabstractiondescribeswhatdata
storedindatabase,andwhat
relationshipsexistamongthosedata.
Thelogicallevelthusdescribesthe
entiredatabaseintermsofanumberof
relativelysimplestructures.

Data Abstraction
For Example:
create table customer (
customer_id varchar(10),
customer_name varchar (35),
customer_street varchar (20),
salary number (10,2));

Data Abstraction
3.Viewlevel:Thehighestlevelof
abstractiondescribesonlypartofthe
entiredatabase.Computerusersseea
setofapplicationprogramsthathide
detailsofdatatypes.Severalviewsof
databasearedefinedanduserssee
theseviews.Inadditiontohidingdetails,
theviewsalsoprovideasecurity
mechanismtopreventusersfrom
accessingcertainpartofthedatabase.

Data Abstraction

Instances and Schemas
Schema:Theoveralldesignofthe
databaseiscalledthedatabase
schema.Schemas arechanged
infrequently,ifatall.Thiscorresponds
tothevariabledeclaration(withtype
definition)ofaprogramminglanguage.

Instances and Schemas
Schemas are:
1.Physicalschema:Describesthe
databasedesignatphysicallevel
2.Logicalschema:Describesthe
databasedesignatlogicallevel
3.Viewschema:Describesthedatabase
designatviewlevel

Instances and Schemas
Instances:Databaseschangeovertime
asinformationisinsertedanddeleted.The
collectionofinformationstoredinthe
databaseataparticularmomentis
calledaninstanceofthedatabase.While
executing,eachvariableofaprogramming
languagehasaparticularvalueatagiven
instant.Thevaluesofthevariableina
programatapointintimecorrespondto
aninstanceofthedatabaseschema.

Instances and Schemas
PhysicalDataIndependence–The
abilitytomodifythephysicalschema
withoutchangingthelogicalschemais
calledphysicaldataindependence.
-Applicationsdependonthelogical
schema (ortheviewschema)
-Ingeneral,theinterfacesbetweenthe
variouslevelsandcomponentsshouldbe
welldefinedsothatchangesinsome
partsdonotseriouslyinfluenceothers.

Data Models
Adatamodelisacollectionof
conceptualtoolsfordescribingdata,
datarelationship,datasemanticsand
consistencyconstraints.
A.BaseModels:Describesthe
designofthedatabaseatthelogical
level.

Data Models
A.1.Entity-RelationshipModel:This
isahigher-leveldatamodel.Itis
basedonaperceptionofarealworld
thatconsistsofacollectionofbasic
objects,calledentitiesandthe
relationshipamongtheseobjects.

Data Models
Entity:Anentityisa“thing”or“object”
intherealworldthatisdistinguishable
fromallotherobjects.Anentityhasaset
ofproperties,calledattributesandthe
values for some set of
properties/attributesmay uniquely
identifyanentity.Anentitymaybe
concrete,suchasapersonorabook,
oritmaybeabstract,suchasloan,ora
holiday,oraconcept.

Data Models
customer-customer-id,customer-
name,customer-street,customer-city
loan–loan-number,amount

Data Models
Relationship:Arelationshipisan
associationamongseveralentities.A
depositorrelationshipassociatesa
customerwitheachaccountthatheor
shehas.
Thesetofallentitiesofthesametype
andthesetofallrelationshipsofthe
sametypearetermedanentitysetand
relationshipset,respectively

Data Models

Data Models
A.2.RelationalModel:Thisisa
lowerlevelmodel.Itusesacollection
oftablestorepresentbothdataand
relationshipsamongthosedata.
Eachtablehasmultiplecolumns,and
eachcolumnhasauniquename.

Data Models
Therelationalmodelisanexampleofa
record-basedmodel.Thisisbecause
thedatabaseisstructuredinfixed-format
recordsofseveraltypes.Eachtable
containsrecordsofaparticulartype.
Eachrecordtypedefinesafixedno.of
fields,orattributes.Thecolumnsofthe
tablecorrespondtotheattributesofthe
recordtype.

Data Models
Therelationalmodelisthemostwidely
useddatamodelandavastmajorityof
currentdatabasesystemsarebased
on the relationalmodel.
Therelationalmodelisatalowerlevel
ofabstractionthantheE-Rmodel.
Databasedesignsareoftencarriedout
intheE-Rmodelandthentranslated
totherelationalmodel.

Data Models

Data Models
B. Other Models:
B.1.Object-orienteddatamodel:Drawing
increasingattention.Itcanbeseenasextendingof
E-Rmodelwithnotionsofencapsulation,methods
(functions)andobjectidentity.
Anobjectdatabase(alsoobject-oriented
databasemanagementsystem,OODBMS) isa
databasemanagementsysteminwhichinformation
isrepresentedintheformofobjectsasusedin
object-orientedprogramming.Objectdatabases
aredifferentfromrelationaldatabaseswhichare
table-oriented.

Data Models

Data Models
B.2.Object-relationaldatamodel:Combinesthe
featuresofobject-orienteddatamodeland
relationaldatamodel.
Anobject-relationaldatabase(ORD),orobject-
relationaldatabasemanagement system
(ORDBMS),isadatabasemanagementsystem
(DBMS)similartoarelationaldatabase,butwithan
object-orienteddatabasemodel:objects,classes
andinheritancearedirectlysupportedindatabase
schemasandinthequerylanguage.

Data Models
B.3.Semi-structureddatamodel:Permitsthe
specificationofdatawhereindividualdataitemsof
thesametypemayhavedifferentsetsofattributes.
Theextensiblemarkuplanguage(XML)iswidely
usedtorepresentsemi-structureddata.
Thesemi-structuredmodelisadatabasemodel
wherethereisnoseparationbetweenthedataand
theschema,andtheamountofstructureused
dependsonthepurpose.Itcanrepresentthe
informationofsomedatasourcesthatcannotbe
constrainedbyschema.

Data Models

Data Models
C.HistoricalModels:Thesearein
littleusenow.
C.1.Networkdatamodel
C.2.Hierarchicalmodel

Data Models
Thenetworkmodelisadatabasemodel
conceivedasaflexiblewayof
representingobjectsand their
relationships.Itsdistinguishingfeatureis
thattheschema,viewedasagraphin
whichobjecttypesarenodesand
relationshiptypesarearcs,isnot
restrictedtobeingahierarchyorlattice.

Network DBMS:
•Depictsdatalogicallyasmany-to-many
relationships
The Network Data Model
Data Models

TYPES OF RELATIONS
ONE-TO-ONE:STUDENT ID
ONE-TO-MANY:
CLASS
STUDENT
A
STUDENT
B
STUDENT
C
MANY-TO-MANY:
STUDENT
A
STUDENT
B
STUDENT
C
CLASS
1
CLASS
2

Data Models
Ahierarchicaldatabasemodelisa
datamodelinwhichthedatais
organizedintoatree-likestructure.
Thedataisstoredasrecordswhich
areconnectedtooneanotherthrough
links.Arecordisacollectionoffields,
witheachfieldcontainingonlyone
value.

Hierarchical DBMS:
•Organizesdatainatree-likestructure
•Supports one-to-many parent-child
relationships
•Prevalentinlargelegacysystems
Data Models

A Hierarchical Database for a Human Resources
System

Thank
You