




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(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)兩個(gè)關(guān)系和多個(gè)關(guān)系的連接操作(select*from關(guān)系名列表連接條件。//6、實(shí)現(xiàn)兩個(gè)關(guān)系和多個(gè)關(guān)系的選擇和連接操作(select*fromwhere選擇條件和連接條件7、實(shí)現(xiàn)兩個(gè)關(guān)系和多個(gè)關(guān)系的投影和連接操作(select屬性名列表where連接條件7、實(shí)現(xiàn)多個(gè)關(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’兩個(gè)條件的對應(yīng)記輸入:selectsnum,agefromS =‘M’andsname=實(shí)驗(yàn)結(jié)果:輸出S表中滿足 =‘M’和sname=‘LIU’兩個(gè)條件的對應(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四個(gè) 輸入: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四個(gè)數(shù)據(jù)庫登陸需要用戶輸入用戶名和,均記錄在文件中。每user.permission中。每個(gè)用戶成功登陸后,系統(tǒng)會(huì)記錄當(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)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 IEC 60684-3-282:2025 EN-FR Flexible insulating sleeving - Part 3: Specifications for individual types of sleeving - Sheet 282: Heat-shrinkable,polyolefin sleeving - Stress
- 2025年項(xiàng)目管理專業(yè)考試試卷及答案
- 2025年投資學(xué)基礎(chǔ)知識(shí)考試試卷及答案
- 2025年兒童心理學(xué)與行為發(fā)展考試試題及答案
- 一級建造師題庫及答案
- 全款房屋轉(zhuǎn)讓合同協(xié)議書
- 淄博樓市度白皮書71p
- 護(hù)理職稱答辯要點(diǎn)解析
- 環(huán)保技術(shù)研發(fā)與轉(zhuǎn)化有限合伙投資協(xié)議
- 高層住宅項(xiàng)目施工安全監(jiān)管及責(zé)任劃分協(xié)議
- 2025年糧油倉儲(chǔ)管理員職業(yè)技能競賽參考試題庫(含答案)
- (廣東二模)2025年廣東省高三高考模擬測試(二)語文試卷(含答案解析)
- 2025-2030白酒行業(yè)市場發(fā)展現(xiàn)狀及競爭形勢與投資前景研究報(bào)告
- 成人腸造口護(hù)理-中華護(hù)理學(xué)會(huì)團(tuán)體標(biāo)準(zhǔn)
- 2025年湖北省初中學(xué)業(yè)水平考試地理模擬卷(三)(學(xué)生版)
- 園林綠化安全培訓(xùn)課件
- 2025屆江蘇省南京市南京師范大學(xué)附屬中學(xué)高三下學(xué)期“揚(yáng)帆起航”數(shù)學(xué)試題
- DB14T 3231-2025安全風(fēng)險(xiǎn)分級管控和隱患排查治理雙重預(yù)防機(jī)制建設(shè)通則
- 腔隙性腦梗塞護(hù)理常規(guī)
- 2025年入團(tuán)積極分子培訓(xùn)考試題庫及答案
- 人工智能在價(jià)格預(yù)測中的應(yīng)用-深度研究
評論
0/150
提交評論