计算机科学导论课件:databases.ppt
Chapter9
Databases
ObjectivesUnderstandaDBMSanddefineitscomponents.UnderstandthearchitectureofaDBMSanditslevels.Distinguishbetweendifferentdatabasemodels.Understandtheconceptofrelationaldatabaseoperationsonarelation.UseStructuredQueryLanguage(SQL)todefinesimplerelations.
DatabasesandDBMSAdatabaseisacollectionofdatathatislogically,butnotnecessarilyphysically,coherent.Adatabasemanagementsystemdefines,creates,andmaintainsadatabase.Italsoallowsuserscontrolledaccesstodatainthedatabase.
DBMScomponents
Databasearchitecture
DBmodels-hierarchical
DBmodels–network
DBmodel-relational
RelationArelation,inappearance,isatwo-dementionaltable.
SQLThestructuredquerylanguageisthestandardizedlanguageweusetooperateonrelationaldatabases.Itisadeclarative(notprocedural)language,whichmeansthattheusersdeclarewhattheywantwithouthavingtowriteastep-by-stepprocedure.
Operationsonrelations-insertinsertintoCOURSES
values(“CIS52”,“TCP/IPProtocols”,6)
Operationsonrelations-deletedeletefromCOURSES
whereNo=“CIS19”
Operationsonrelations-updateupdateCOURSES
setUnit=6
whereNo=“CIS51”
Operationsonrelations-selectselect*
fromCOURSES
whereUnit=5
Operationsonrelations-projectselectNo,Unit
fromCOURSES
Operationsonrelations-joinselectNo,Course-Name,Unit,Professor
fromCOURSES,TAUGHT-BY
whereCOURSES.No=TAUGHT-BY.No
Operationsonrelations-unionselect*
fromCIS15-Roster
unionselect*
fromCIS52-Roster
Operationsonrelations-intersectionselect*fromCIS15-Roster
intersection
select*fromCIS52-Roster
Operationsonrelations-differenceselect*fromCIS15-Roster
minusselect*fromCIS52-Roster
ObjectivesUnderstandaDBMSanddefineitscomponents.UnderstandthearchitectureofaDBMSanditslevels.Distinguishbetweendifferentdatabasemodels.Understandtheconceptofrelationaldatabaseoperationsonarelation.UseSt