《数据库运维形考任务2.docx》由会员分享,可在线阅读,更多相关《数据库运维形考任务2.docx(10页珍藏版)》请在三一办公上搜索。
1、实验2 MySQL数据库对象管理(预备知识:第3章;分值:16分;需辅导教师评分)1. 实验目的理解数据字典、表、索引、视图的作用,掌握数据字典的操纵方式,掌握库、表、索引、视 图的操作方法。2. 实验内容【实验2-1】查看INFORMATION_SCHEMA.SCHEMATA表中的信息。【实验2-2】查看INFORMATION_SCHEMA.TABLES表中的信息。【实验2-3】查看INFORMATION_SCHEMA.COLUMNS表中的信息。【实验2-4】查看INFORMATION_SCHEMA.STATISTICS表中的信息。【实验 2-5】查看 INFORMATION_SCHEMA.
2、CHARACTER_SETS 表中的信息。【实验2-6】查看INFORMATION_SCHEMA.COLLATIONS表中的信息。【实验2-7】使用CREATE DABASE语句创建school数据库。【实验2-8】将school数据库的字符集设为utf-8。【实验2-9】在school 数据库下创建stu_info表,包括stuno varchar(10)、stuname varchar(8)、 stubir date、stuage int ;创建表 course,包括 courno varchar(3)、courname varchar(10)、 schyear date、credit i
3、nt ;创建stuandcour表,包括stuno varchar(10)、courno varchar(3)、 grade int。【实验2-10】使用SHOW、DESCRIBE语句查看所建的表。【实验2-11】使用ALTER TABLE语句将stuinfo表的表名改为stuinfo,并且增加stugender varchar(4)字段,将course表中courno字段的类型改为varchar(5)。【实验2-12】将前边建的表复制到test数据库中,如果没有test数据库就新建一个。【实验2-13】删除test数据库中的course表。【实验2-14】创建stuinfo表上stuno的索
4、引。【实验2-15】创建stuandcour表上stuno字段和courno字段上的多列索引。【实验2-16】删除创建的索引。【实验2-17】创建stuinfo表上的单源视图。【实验2-18】创建stuinfo表和stuandcour上的多源视图,包含stuno、stuname、courno、 grade。【实验2-19】分别通过访问information_schema的views表和tables表,查看已经创建好 的视图;使用DESCRIBE语句查看已经创建好的视图。【实验2-20】使用SELECT语句查询创建好的视图。3. 实验要求(1) 所有操作均在命令行或者MySQL Workbenc
5、h中完成。(2) 将操作过程以屏幕抓图的方式复制,形成实验文档,并对照本章内容写出分析报告。3.实验结果M L 5-7 Curiiir ufilJ Urw OiiV. - lAiicudv- LJ XEnxer p?.3STbi:d:H由-riru: tc Ih-Bnwn i t-r. Crwrjindn w:rf_ n厂th -nr h_VOLL WyiL COcliieCHull id is 0牛丁&t匚;oi; b,.I nff 虻或.二工nrnisiTF冲t iffF.)|-:P/rigt (r) DIKI,:潮 1H, CtrcIa and/nF- -:t ; :.n tas. Al
6、 ri gh- f 明二vwd.Ctp-cIa i& a戒捉!口睥H p: n:F Ccrpcrr.ticn nid/c-r its 制 NimL”. hr.it;备旧寸 Uu、辩;ku比;.w X LIk,cner sTjpe h&以,己r 13 脂1口 Ttj c t& cLwt tlw mrriT iw.itn-stl E-elect 年 fron inf onDat icis-rliezig scJt-ereeta CAT?iLOG_VEW邮烦EDIFAU7_ClKTERjLrj:*BME班抑 LLC91 L?TIGXJ7JESQ1_PA7Ndefinf m 陶 t i?Li_sheu
7、aUfCutfS_gwa l_ciJJ11Ldi?rnydbl1 L l n 1.1 m.:_ j r; l_2;Bnxl i .k_c 2心二de-r加如latlAlIk:-沔占区gdnfmisidIfi Li rkllaxinljjwrdELdefperf1H三.,?卫少u-fBrxfS ceLier-o 1 ciKIdr-fri.ik i l.ui .I L f n 11 a. . r 1 _5Bnyl i sh_c:M丈.d&f2VS.心:reV.TfS 场心 1 ciJIQLrii?fwrirldliir i n 1.1nv:l_.Girrd i ?it_c 1 g普 p ef ;
8、n .qfit (0.殂 I Jmyrl dpfMLm ri-ii-lEAk._L皿T1EAdef乩Lvi.r.auu I.3FSL!L_皿LorldJ U Df IIUI2LETorldJO DriiiiisLi:an 5015 i的KULL171717MLLv:r.i飞富工??!is-ar_bv I n %yMLL 一 iZL M-LLv:r.l.MFT.1xSws i ts._s lot 1 上心?.t =i:.ic yML i旬city4住&lb:24:41 NULLCOCRTIV 23&L&:24:42 !ELLzor.LTirla.iae.9811:24:42 NULLI.I1.1
9、XLLLM-LL就1NJLLKULL装前1KULLVTFT?M LLVIEW MLLXI.I.1IN仍;BASEb七If.t i.ii _ sTCd i 3h_c ig.WLL Wl_WLL HLLj Vj-J. 巾 LNUUXLLL 疝最lT.BLE Tn-RcM5LLLTJiBLHMLTrsrxHB 03,aiSE T.B1ZDtiS&36If.t l.il 3Ti?dl3h ciMILLinDe30S ics in *). 09 B-?cJMy5QL5.7 Criiirkid LiiwCliiil -UuiiwJi?gridswiyl 网 fr.ok?.L(r 1)rlott 或1二用t
10、l鼠罕1就.LMLL_t. insert s .ipdaTe.3237 luvs jij st 0. 09 scj5 7Cuirinmnd LineClitrL - UrnLudt君C Lp ina&G ;P LpJutc-i 匚柠吉d&f胸,LduouirrrFl 星ig 取ilJujW3-0L. i. 11,1ft ._ Lijdalu, rulijri-cCt!:1.de-fc-L,.n.-r7ia:,i,.sjrfiL-IL.IU1土卜1只己1. i!,p.ir,.r i.j:d:!l i:-, r- Rjrrr:!1!?.defworldudljibfIm可诅眼rlc;H lH1;l
11、.1.KILl.,r=l ncl, ii5rri Ljdntr-, rr-F-flrnr.rA)237 jo-:li si ;ieuu_ j L n. j _ 11-_ Vy53- 5.7 kuiniii1r Kin.i.RIREdelSEkiles-aff03f.k.iPililAiY_KT1.IETRF.de*s-affLSF.kllElidx iz. itere id_r. r;tr11.;K11.T甬鸵Ed&rEidUllaitdrt_st.k.llaidx 11 ae.Jrtfsa ud1LI ELEHEEdelSVM-S-y d LtKll lJ!0sysJUi 她 I1LI NU
12、LLPJREEdelliLj0D:ld乳曲_LI NULLE7NEEdtlbi tjworldCgudLi vCixIcj,ELI MUBIREE:dtfIduc.iiiLry0巳订血黔LL MJLLEIREEcIdF*D:-1dLG.IIllrY JillLLIi!H.:!uWDCldLI 如 LLB7SEEdi?frcuril ry2;in25jr!H,c!0vur IdFVWigTnLL NULLEI3E;drfwfl-ldrein! ry141wni-ldCcnril ryCrxk!L- NLLLBISEE11帖日宓.5.7 CvrtnixJ UicClierL - Jrvdvz Sr
13、lcr* trcn iufcEQt; WLaiQTW cHu2Ctmr_sm-3;CH混3胡*:二奇NEDEFArirj:OLlArEJ:AME.PF5CRrTK?bi?o1big_di 话xejsiBig5 TiM勇oru -riiHAss1 wdecSJec8_xAicd; i;li_ciDLC 加我 L jr upS Kaiu?i41ckv CbCii-Sl-evul;beEuropol11necc=nrcce_gnril_c i1uucioua:iu 也 i o u*i_$lcl.Ltc KtftM L.iropeidh1“M.K5 NMm) Evmpeg1lulichil j:17
14、_gcntldi_l:iJSQ 8859-13 liall.LIinfSaM迎 hL 睥E S Cniccd4.pL23l.pl2u 1A i:idw; Cvi. 1L ic1utflouH16_g 策少 l_ciVT? IC fcicodeA ruHlGluutri6i L:_*grq_u.LT: -lLL Mhixk,CPL255cpl256._jeneral. ciWinders Arabic1rr.1257cpi257*ini2A: Win:1v.tfJ2utf32_frneral_ciVI= 32 UnicodeJ th i u.irybi ttitrEi n;fv pnn.idn
15、ch;t: sal1f;W3注二wmx&l ?;瓮。SI龄眼:揉,1(伸?cp932_japn r e_t i5J1S Fr Kimzy*-;ggl皿9rc ij)A2ci,j IS ror incOT3 %奖.皿类3- _,gbl 就引).uh i new_u fli ihn icnnl St hndn-J GRI8Q301ul yg in 二 l). !* - r glhE MySQL 5.7 Cn-mmand E me riisnt - Unicodeutfi6_croat ian_ci jtf 1 6_luj i c odc_52 Q_c i u?f IS. fttnaTOPSfi c
16、i u LGle_eneral_ci utfL61e_bin cp256 snera cj cpl256bincp 12or_lithiJ3ni aij_c i cpl257. hin op 12 57_gefieral _c 1 u t f3ra 1_ iLiLf3c: lin u f3c ode_c iu tf32_ icciQjidi c_c i utfSI? latvistn. ci u I f3 2_r uflia i atj_c i j tf32_sopcRL an_c: utf32 pn i sh._xji: ulf32_estyniab_c i utf32_spaui sh_c
17、i urf32,.RWftdi sh ci utf32_lurki&ii_ci i.itf32_cEcch_ci :17 +32 dpn; sli L: utf32_.ithuaainujc i .itf32_31o7,sk_ci tf32 spanishE ci u f32_runicin_ci Li t f32_per s i an_c i utf3ps;peranto ci .it f3 uri elji_c i u t f32_ s i iihfi 1 a_ i uf3S_gHinaan3_ci. u t f3 2_cioa t i atj_c i u t f3 Z_uLjic odo
18、_52 0_c i urt32 vi rnmpjie c.i biiLaiyco3cner f、i_c :b;ncp932_jBpane3e_ci 叩932上inAiif jpniEi japatipfl? c i euc jijni 3_b iij jbl jj030_c iii ne se_c i ?bl8030-bin sblS 030_uni t?de_520_c iuifib itfieu:fL61e Li-fieic g5B epl256 cpl257 -P1257 c:pl257 utf32 .iTf32 u:f32 :itfJ2 232 ar.f32 utf32 ur+33 u
19、:f32 utf32 urf33 hirf32 以3 2 =.itH2:i-f32 ut+32 u:f32 utf32 m成 ycf32 utf32 uf32 utf32 以3, u-f32 binary eostdS 冲戏dB cp932 cp32 puc jptJis euc jpffis 5blS03D ?h18030 jjb!8D301 oo L J j1231245662YesYas.4 create df.tjjcse cJuol.Sjr-T QK, fxit nFffin tad (l. wQmysql 耳Ik荏r心心一,tefaul t dtEiiacter set ui f8
20、- stunaMC varchar (8).一stuti r utu婚白 int心):Query OX, 0 rous sifferted (0. 05 serj67 29 58 59 60 61 160 161 162 163 164 IG5 166 167 IBS LG9 ITO 171 :72 173 !74 175 176 177 178 179 180 LSI LS2 I 3G3 92 93 95 96 97 58 248 249 250& Ycz;YesYesYesYesYts YesYes Yes Ym Ves Yes Ye.q Yt= YeaYgs Yes 铃5 Yes Ye
21、sYes Yes Yes: Yts 站Ygs Ye 3 Ype Yes Yes Yes 心 Yea Yps Yes Ys Y*q Yes Yes Yft.q Yes Yes ypz Ye 3 Yes Yq Yes8 8 1 1 I 1 1 I 1 1 L 8 8 88 no 8 8 a 8 8 9 88 8 888 8 8 8 8 8 8 8 1 L I 1 -I- I 1 I 8mysq1 create table gtu jnfo(- st uno VHXchor (Wi,? stunajiie vauchar E?) i一 ;bi r dit,tLlHJ& Lilt- ): _Qu=i”
22、r 0 poufs(0. flrj c)mysql create tabLo course1:- courn fi v ar char (3)f c o urcitBj e * arc tiEtz : 10).? scliyc-Eir dat(zr-? emdif i nt一;Query QK. 0 l-otfs aEfected D. 04 sec)mysql creciLE, ItbLe 5 luaudcor (/ stunt varchrdt),-十日l史yi日twy己Bar lNJ )Bada inL“4 0 pouf? M十SH早-(0,- 04 spc iBiTEql ?m?s q
23、 I te-sc r i be s tio;FieldType?Null KeyDefault Extras?un.u 5tun.ne stubir 我u日畔4 vows ir| gvat their (10) varchar 1E :, date 加YES YES VES TTESMULLNULLNULL 3IULL 1tft QI n*)m7r3Dl - riescr ibs ccil;t5(?;FieldT瘁Null旅yDfaulLsnrg CdullTlDE schyoar credi tvrchr(3 tghHO) dare imUl)VESYESYES船NULLMLLNLLLNL1
24、LEx Llh4 rois in sot (0. QD zee)iuysol tum户工出皈口少 DEFALTT NVLL, stunnirLe varchar 5? BEFALLT NULL.stubir dte DEF AL LT MLLint(ll) DEF 乩IT NULLEXGIT=InnoDB DEFALLT CJIARSETwfB1 row in set (0. 00= sec):iiysqD stiufc creaLd tahl己comt5elEible Cr-uaLe Lahl?c our 3妃C REATE TABLE couls Cgpiu 昨Tuhjir DKPALLT
25、 NLIX,c.Q.iijTaaie varcLezf flG) DEFAULT NULL-scivai- date DEFALLT NLLL.credit iniUU BEFAtlT NULL)嗷辨瞄部邮.岫回r qiAB瓯E戒1 tow in iel l.CL GO 如亡)iiysr.L wnnw cyRte rahe sri招ritke::EPOR 1146 42S0?) ; Table =ctiooL suuaiidcauz- claesn L niyol/ show create tabl? atEandcoiiY:TableCreateTableSLua.n alter tab I
26、s jzcefp_ oicdiry cDuiGo varchaiti);Jucry OK, 0 rew; a.f ftctc-d (CL JI 非t) enrde: 0 Lhinl it?alesz 0 darninps : 0ii 31| 1 iLiiLJU* Luilii- JLhuvL 5-tuijifu 1.0 test. 3-Tuisif s-ckuul.L9 tsl. CDLki?! :Sicbool. 3-1 Jdndizir tu teti IuhDCuui;ERR4s 1025 (HTiOroi Error on rennn of hool stuinfo to 1 . .t
27、esCXstiinfs (mno: L&5 LnXngi lEeneric? eiTor ron fieineTsT:m 1 create daiahgae itai.9uerf OK. 1 re* affected (0.01 sec) ni73q renane tuble arhool. stuinto to rest. sluinE1 scnooL. course to tsT. ermrss, srhocL stiandcair to t&gr. B-tuAnifcaLir: Qaerv OK, 0 lp、e ffectsd (0.04 ae心 5.7Cuirni!yiYl Lim-C
28、liwi - UriztidBPf-TITKhfo1说奖flM.LL20-3-.t-L 1XlLL*TfNULL=Ltxi 口*NULLM.LLXiLt.defd_LLTelXLLL平:e_m 询 1 nfoutNULL KULLM:L1MLLdD(*Q:ld(?c:3 LJiOTZMSI)2310I-CIKILLdrf1304Cicorn I- Lvigir633 可M-LlrvAr I ViPsr niii nf n :FiflIflIrpR目十1| IOVIfl ILi :lialFliplSJm心d片以idLI ill罚u r.d5 rv艮四加i.41S npfacl- Fst.-jj
29、NU1Z HL1_Nil-NllL1】rcTj in set 10 OU &ec:ivsl ? fHcrim鼻 viF_g-i.-ii nfo.s-TjF.nicorT:ESRDK. ILdfi -?U?;05 : Ian:卜Ltk:. jjiIu制 lit以;udbiiurf L邳Lxv=.l scri* iev_3niJiros zuF.Lour:Field lyyeKullH挥3?f&.jLt Exirfi5.1110varc-hMlp)r;_hinmirvjh.tt.I wltI 8Jcutdovarchai-3jg-iidr1iif (11 *亏 timt i n 上at 1.(). (1(1 pkcJiESKULLWEKUI.LYESMLVRTNIT.InrymqJ.eieMe *Empty set (Q. COfuam vicir_.sfiiinfa: =ac);uysq_*加pty ?.at 10. 00f 匚口田 Y i5 l H1 nf (J_5UX ;hivsc _