数据库理论及基础面试题.docx
《数据库理论及基础面试题.docx》由会员分享,可在线阅读,更多相关《数据库理论及基础面试题.docx(24页珍藏版)》请在冰点文库上搜索。
数据库理论及基础面试题
数据库理论及基础面试题
问题:
数据库理论及基础面试题回答:
1.WhatisdatabaseAdatabaseisalogicallycoherentcollectionofdatawithsomeinherentmeaning,representingsomeaspectofrealworldandwhichisdesigned,builtandpopulatedwithdataforaspecificpurpose.
2.WhatisDBMSItisacollectionofprogramsthatenables
usertocreateandmaintainadatabase.Inotherwordsitisgeneral-purposesoftwarethatprovidestheuserswiththeprocessesofdefining,constructingandmanipulatingthedatabaseforvariousapplications.
3.WhatisaDatabasesystemThedatabaseandDBMSsoftwaretogetheriscalledasDatabasesystem.
4.AdvantagesofDBMSRedundancyis
controlled.Unauthorisedaccessisrestricted.Providingmultiple
userinterfaces.Enforcingintegrityconstraints.Providing
backupandrecovery.
5.DisadvantageinFileProcessingSystemData
redundancyinconsistency.Difficultinaccessingdata.Data
isolation.Dataintegrity.Concurrentaccessisnotpossible.SecurityProblems.
6.DescribethethreelevelsofdataabstractionTheare
threelevelsofabstraction:
Physicallevel:
Thelowestlevelofabstractiondescribeshowdataarestored.Logicallevel:
Thenexthigherlevelofabstraction,describeswhatdataarestoredindatabaseandwhatrelationshipamongthosedata.Viewlevel:
Thehighestlevelofabstractiondescribesonlypartofentiredatabase.7.DefinetheintegrityrulesTherearetwoIntegrityrules.
EntityIntegrity:
Statesthat“PrimarykeycannothaveNULLvalue”ReferentialIntegrity:
Statesthat“ForeignKeycan
beeitheraNULLvalueorshouldbePrimaryKeyvalueofotherrelation.
8.WhatisextensionandintensionExtension-
Itisthenumberoftuplespresentinatableatanyinstanee.Thisistimedependent.
Intension-
Itisaconstantvaluethatgivesthename,structureoftableandtheconstraintslaidonit.
9.WhatisSystemRWhatareitstwomajorsubsystemsSystemRwasdesignedanddevelopedoveraperiodof1974-79atIBMSanJoseResearchCenter.ItisaprototypeanditspurposewastodemonstratethatitispossibletobuildaRelationalSystemthatcanbeusedinareallifeenvironmenttosolvereallifeproblems,withperformaneeatleastcomparabletothatofexistingsystem.
Itstwosubsystemsare
ResearchStorageSystemRelationalDataSystem.
10.HowisthedatastructureofSystemRdifferentfrom
therelationalstructureUnlikeRelationalsystemsinSystemR
DomainsarenotsupportedEnforcementofcandidatekeyuniquenessisoptionalEnforcementofentityintegrityis
optionalReferentialintegrityisnotenforced
11.WhatisDataIndependenceDataindependence
meansthat“theapplicationisindependentofthestorage
structureandaccessstrategyofdata”.Inotherwords,Theabilitytomodifytheschemadefinitioninonelevelshouldnot
affecttheschemadefinitioninthenexthigherlevel.
TwotypesofDataIndependence:
PhysicalDataIndependence:
Modificationinphysicallevelshouldnotaffectthelogicallevel.LogicalDataIndependence:
Modificationinlogicallevelshouldaffecttheviewlevel.NOTE:
LogicalDataIndependenceismoredifficulttoachieve
12.WhatisaviewHowitisrelatedtodataindependence
Aviewmaybethoughtofasavirtualtable,thatis,atablethatdoesnotreallyexistinitsownrightbutisinsteadderivedfromoneormoreunderlyingbasetable.Inotherwords,thereisnostoredfilethatdirectrepresentstheviewinsteadadefinitionofviewisstoredindatadictionary.
Growthandrestructuringofbasetablesisnotreflectedin
views.Thustheviewcaninsulateusersfromtheeffectsofrestructuringandgrowthinthedatabase.Henceaccountsforlogicaldataindependence.
13.WhatisDataModelAcollectionofconceptualtoolsfordescribingdata,datarelationshipsdatasemanticsandconstraints.
14.WhatisE-RmodelThisdatamodelisbasedonrealworldthatconsistsofbasicobjectscalledentitiesandofrelationshipamongtheseobjects.Entitiesaredescribedinadatabasebyasetofattributes.
15.WhatisObjectOrientedmodelThismodelisbasedon
collectionofobjects.Anobjectcontainsvaluesstoredininstaneevariableswithintheobject.Anobjectalsocontainsbodiesofcodethatoperateontheobject.Thesebodiesofcodearecalledmethods.Objectsthatcontainsametypesofvaluesandthesamemethodsaregroupedtogetherintoclasses.
16.WhatisanEntityItisathingintherealworldwithan
independentexistenee.
17.WhatisanEntitytypeItisaeolleetion(set)ofentities
thathavesameattributes.
18.WhatisanEntitysetItisaeolleetionofallentitiesofparticularentitytypeinthedatabase.
19.WhatisanExtensionofentitytypeTheeolleetionsofentitiesofapartieularentitytypearegroupedtogetherintoanentityset.
20.WhatisWeakEntitysetAnentitysetmaynothavesuffieientattributestoformaprimarykey,anditsprimarykeyeompromisesofitspartialkeyandprimarykeyofitsparententity,thenitissaidtobeWeakEntityset.
21.WhatisanattributeItisapartieularproperty,whiehdeseribestheentity.
22.WhatisaRelationSehemaandaRelationArelationSehemadenotedbyR(A1,A2,…,An)ismadeupoftherelationnameRandthelistofattributesAithatitcontains.A
relationisdefinedasasetoftuples.Letrbetherelationwhiehcontainssettuples(t1,t2,t3,,tn).Eaehtupleisanorderedlistofn-valuest=(v1,v2,,vn).
23.WhatisdegreeofaRelationItisthenumberofattributeofitsrelationschema.
24.WhatisRelationshipItisanassociationamongtwoormoreentities.
25.WhatisRelationshipsetThecollection(orset)of
similarrelationships.
26.WhatisRelationshiptypeRelationshiptypedefinesa
setofassociationsorarelationshipsetamongagivensetofentitytypes.
27.WhatisdegreeofRelationshiptypeItisthenumberofentitytypeparticipating.
25.WhatisDDL(DataDefinitionLanguage)AdatabaseschemaisspecifiesbyasetofdefinitionsexpressedbyaspeciallanguagecalledDDL.
26.WhatisVDL(ViewDefinitionLanguage)Itspecifies
userviewsandtheirmappingstotheconceptualschema.
27.WhatisSDL(StorageDefinitionLanguage)ThisIanguageistospecifytheinternalschema.ThisIanguagemayspecifythemappingbetweentwoschemas.
28.WhatisDataStorageDefinitionLanguageThestoragestructuresandaccessmethodsusedbydatabasesystemarespecifiedbyasetofdefinitioninaspecialtypeofDDLcalled
datastorage-definitionIanguage.
29.WhatisDML(DataManipulationLanguage)ThisIanguagethatenableusertoaccessormanipulatedataasorganisedbyappropriatedatamodel.
ProceduralDMLorLowlevel:
DMLrequiresausertospecifywhatdataareneededandhowtogetthosedata.Non-ProceduralDMLorHighlevel:
DMLrequiresausertospecifywhatdataareneededwithoutspecifyinghowtogetthosedata.
31.WhatisDMLCompilerIttranslatesDMLstatementsin
aqueryIanguageintolow-levelinstructionthatthequery
evaluationenginecanunderstand.
32.WhatisQueryevaluationengineItexecuteslow-level
instructiongeneratedbycompiler.
33.WhatisDDLInterpreterItinterpretsDDLstatements
andrecordthemintablescontainingmetadata.
34.WhatisRecord-at-a-timeTheLowlevelorProcedural
DMLcanspecifyandretrieveeachrecordfromasetofrecords.
ThisretrieveofarecordissaidtobeRecord-at-a-time.
35.WhatisSet-at-a-timeorSet-orientedTheHighlevelor
Non-proceduralDMLcanspecifyandretrievemanyrecordsinasingleDMLstatement.Thisretrieveofarecordissaidtobe
Set-at-a-timeorSet-oriented.
36.WhatisRelationalAlgebraItisproceduralqueryIanguage.Itconsistsofasetofoperationsthattakeoneortworelationsasinputandproduceanewrelation.
37.WhatisRelationalCalculusItisanappliedpredicatecalculusspecificallytailoredforrelationaldatabasesproposed
byE.F.Codd.E.g.ofIanguagesbasedonitareDSLALPHA,QUEL.
38.HowdoesTuple-orientedrelationalcalculusdiffer
fromdomain-orientedrelationalcalculusThetuple-oriented
calculususesatuplevariablesi.e.,variablewhoseonlypermittedvaluesaretuplesofthatrelation.E.g.QUEL
Thedomain-orientedcalculushasdomainvariablesi.e.,variablesthatrangeovertheunderlyingdomainsinsteadofoverrelation.E.g.ILL,DEDUCE.
39.WhatisnormalizationItisaprocessofanalysingthe
givenrelationschemasbasedontheirFunctional
Dependencies(FDs)andprimarykeytoachievetheproperties
MinimizingredundancyMinimizinginsertion,deletionandupdateanomalies.
40.WhatisFunctionalDependencyAFunctional
dependencyisdenotedbyXYbetweentwosetsofattributes
XandYthataresubsetsofRspecifiesaconstraintonthe
possibletuplethatcanformarelationstaterofR.Theconstraintisforanytwotuplest1andt2inrift1[X]=t2[X]thentheyhavet1[Y]=t2[Y].ThismeansthevalueofXcomponentofatupleuniquelydeterminesthevalueof
componentY.
41.WhenisafunctionaldependencyFsaidtobeminimal
EverydependencyinFhasasingleattributeforitsrighthandside.WecannotreplaceanydependencyXAinFwithadependencyYAwhereYisapropersubsetofXandstillhaveasetofdependencythatisequivalenttoF.WecannotremoveanydependencyfromFandstillhavesetofdependencythatisequivalenttoF.
42.WhatisMultivalueddependencyMultivalueddependencydenotedbyXYspecifiedonrelationschemaR,
whereXandYarebothsubsetsofR,specifiesthefollowingconstraintonan