數(shù)據(jù)庫系統(tǒng)原理課程設(shè)計總結(jié)報告_第1頁
數(shù)據(jù)庫系統(tǒng)原理課程設(shè)計總結(jié)報告_第2頁
數(shù)據(jù)庫系統(tǒng)原理課程設(shè)計總結(jié)報告_第3頁
數(shù)據(jù)庫系統(tǒng)原理課程設(shè)計總結(jié)報告_第4頁
數(shù)據(jù)庫系統(tǒng)原理課程設(shè)計總結(jié)報告_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1數(shù)據(jù)庫簡單來說,其本身可視為電子化的文件柜,即電子文件的場所,1、關(guān)系數(shù)據(jù)庫SQL2、SQL34567SQL(1)createtable (8)createindex(2)droptable (9)dropindex(3)altertable (10)createview(4)insert (11)dropview(5)delete (12)createuser(6)update (13)grant(7)select (14)revoke的方式檢查是否符合語范。YYcreate dropNNYYdrop createNNYYalter dropNNYY createNNYY YY NNYNYNcreate語 輸入:createtableS(snumchar(10),snamechar(20),ageint,char實(shí)驗(yàn)結(jié)果:tableScreated輸入:createtableS(snumchar(10),snamechar(20),ageint,char實(shí)驗(yàn)結(jié)果:illegalSQL(1)CREATETABLE關(guān)系名屬性名類型,//類型至少支持intchar兩種類型 屬性名類型(2)DROPTABLE關(guān)系名(3)ALTERTABLE關(guān)系名ADD屬性名類型//支持的類型同createtable語句ALTERTABLE關(guān)系名DROP屬性名,……,屬性名(4)INSERTINTO關(guān)系名[(<列名>,,<列名>)]VALUES(<常值>,...,<常值>))(5)DELETEFROM關(guān)系名WHERE條件表達(dá)式]//條件表達(dá)式包括and、or、=、≠、≤、≥(6)UPDATE關(guān)系名SET〈列名〉==〈常值〉WHERE條件表達(dá)式]//delete(7)SELECT*|屬性名列表FROM關(guān)系名列表WHERE條件表達(dá)式//delete(8)CREATEINDEX索引名ON關(guān)系名(屬性名,. ,屬性名(9)DROPINDEX索引名(12)CREATEUSER用戶名IDENTIFIEDBY(13)GRANT權(quán)限列 //自己實(shí)現(xiàn)的所有SQL命令ON關(guān)系名TO用戶列表SQLcreatetabletablename(attribute,int/charproperty.dictdroptabletablenamealtertabletablenameaddattributetablenameattribute_typeproperty.dictNULLaltertabletablenamedrop(1)tablename(2)檢查數(shù)據(jù)字典property.dict中表tablename是否存在屬性insertintotablenamevalues(attribute_value,·);tablenameattribute較少的話則默認(rèn)在其后添加相應(yīng)數(shù)量的null,輸入的attributetablenameupdatetablenamesetattribute1=value1whereattribute2=attribute1attribute2允許where后的條件的操作符使deletetabletablenameattributeopetablenameattributetablename.txtselect*from(1)tablenameNNNY YYNNNYY在YNNNYYYNYNNY在YNNY在NNYNcreatetableS(snumchar(10),snamechar(20),age實(shí)驗(yàn)結(jié)果:tableScreated輸入:createtableS(snumchar(10),snamechar(20),age 實(shí)驗(yàn)結(jié)果:illegalSQL輸入:droptable實(shí)驗(yàn)結(jié)果:tableSdropped輸入:droptableSS的表實(shí)驗(yàn)結(jié)果:tableSisnotexists.輸入:altertableSaddschool實(shí)驗(yàn)結(jié)果:propertyschooladdtotableS輸入:altertableSaddschool實(shí)驗(yàn)結(jié)果:illegalSQL輸入:altertableSdrop實(shí)驗(yàn)結(jié)果:propertyschooldroppedfromtableS輸入:altertableSdrop實(shí)驗(yàn)結(jié)果:propertysageisnotexistintable輸入:insertintoSvalues實(shí)驗(yàn)結(jié)果:recordinsert輸入:insertintoSvalues實(shí)驗(yàn)結(jié)果:toomuch輸入:updateSsetage121wheresnum‘S1’;實(shí)驗(yàn)結(jié)果:updatesuccessfully.輸入:deletetableSsnum‘S1’;實(shí)驗(yàn)結(jié)果:deletesuccessfully.輸入:select*fromS1、為某關(guān)系的主屬性建立索引。//2、為某關(guān)系的非主屬性建立索引。//3B樹索引。//4createindexindex_nameontablenametablenameattributeindex_nameYNNYN作YN輸入:createindexS_indexonS實(shí)驗(yàn)結(jié)果:indexcreated輸入:createindexSC_indexonSC實(shí)驗(yàn)結(jié)果:tableSCisnot輸入:createindexS_indexonS實(shí)驗(yàn)結(jié)果:propertysageisnot輸入:dropindex實(shí)驗(yàn)結(jié)果:indexSdropped1、實(shí)現(xiàn)全關(guān)系選擇操作(select*from關(guān)系名2、實(shí)現(xiàn)單關(guān)系的投影操作(select屬性名列表from關(guān)系名3、實(shí)現(xiàn)單關(guān)系的選擇操作(select*fromwhere條件表達(dá)式4、實(shí)現(xiàn)單關(guān)系的選擇和投影操作(selectfrom選擇條件。//5、實(shí)現(xiàn)兩個關(guān)系和多個關(guān)系的連接操作(select*from關(guān)系名列表連接條件。//6、實(shí)現(xiàn)兩個關(guān)系和多個關(guān)系的選擇和連接操作(select*fromwhere選擇條件和連接條件7、實(shí)現(xiàn)兩個關(guān)系和多個關(guān)系的投影和連接操作(select屬性名列表where連接條件7、實(shí)現(xiàn)多個關(guān)系的選擇、投影和連接操作(selectfrom關(guān)系名列表where條件表達(dá)式select*fromtablenameselectattribute1,attribute2,·fromtablenameattriubuteselect*fromtablenamewhereattribute1=value1andattribute2=value2;tablenameattriubuteselectattribute1,attribute2,·fromtablenamewhereattribute1=value1andattribute2=value2;tablenameattriubuteselect*fromtablename1,tablename2···wheretablename1.attribute=tablename2.attributeandtablename2.attribute=tablename3.attribute;tablenameattriubuteselect*fromtablename1,tablename2···whereStablename1.attribute=tablename2.attributeandtablename2.attribute=tablename3.attributeandtablename1.attribute="value";tablenameattriubute所有表做selectattribute1,attribute2,···fromtablename1,tablename2·whereandtablename2.attribute=tablename3.attribute;tablenameattriubute所有表做selectttribute1,attribute2,···fromtablename1,tablename2···whereStablename1.attribute=tablename2.attributeandtablename2.attribute=tablename3.attributeandtablename1.attribute=‘value’;tablenameattriubute所有表做YNYYNNYNYYNNY作N作Y Y作YN執(zhí) 條件的選選NY作YN N輸入:select*from實(shí)驗(yàn)結(jié)果:顯示S輸入:selectsname,agefrom實(shí)驗(yàn)結(jié)果:輸出Ssnameage輸入:select*fromS =‘M’andsname=實(shí)驗(yàn)結(jié)果:輸出S表中滿 =‘M’和sname=‘LIU’兩個條件的對應(yīng)記輸入:selectsnum,agefromS =‘M’andsname=實(shí)驗(yàn)結(jié)果:輸出S表中滿足 =‘M’和sname=‘LIU’兩個條件的對應(yīng)行所投影出的snum和age兩列輸入:select*fromS,SC,CwhereS.snum=SC.stnum um 實(shí)驗(yàn)結(jié)果輸出S表SC表和C表中滿足條件S.snum=SC.stnum um輸入:select*fromS,SC,CwhereS.snum=SC.stnumand um= andS.snum="S1";實(shí)驗(yàn)結(jié)果輸出S表SC表和C表中滿足條件S.snum=SC.stnum umandS.snum="S1"輸入:selectcname,age, ,gradefromS,SC,CwhereS.snum=SC.stnumandum= 實(shí)驗(yàn)結(jié)果輸出S表SC表和C表中滿足條件S.snum=SC.stnum um的對應(yīng)的行所投影的cname、age、sec、grade輸入:selectcname,age, ,gradefromS,SC,CwhereS.snum=SC.stnumandum= umandSC.grade="70";實(shí)驗(yàn)結(jié)果:輸出S表、SC表和C表中滿足條件S.snum=SC.stnum umandSC.grade70"的對應(yīng)的行所投影的cname、age、sec、grade四個 輸入:selectcname,age,,gradefromS,SC,CwhereS.snum=SC.stnumandum= umandSC.grade="70";實(shí)驗(yàn)結(jié)果輸出S表SC表和C表中滿足條件S.snum=SC.stnum umandSC.grade70"的對應(yīng)的行所投影的cname、age、sec、grade四個數(shù)據(jù)庫登陸需要用戶輸入用戶名和,均記錄在文件中。每user.permission中。每個用戶成功登陸后,系統(tǒng)會記錄當(dāng)前用戶信息。在后續(xù)的過程中,當(dāng)執(zhí)行insert、update、delete操作grantcreateuserusernameidentifiedbygrant權(quán)限列表on關(guān)系名torevoke權(quán)限列表on關(guān)系名fromNNY1輸入:root輸入 實(shí)驗(yàn)結(jié)果:usernot輸入:createusernicaiidentifiedby654321;實(shí)驗(yàn)結(jié)果:里寫入新用戶信息輸入:revokeinsert,delete,updateo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論