資源描述:
《數(shù)據(jù)庫(kù)表的創(chuàng)建、查詢、插入、刪除、視圖、索引》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、《數(shù)據(jù)庫(kù)咅統(tǒng)概論》實(shí)驗(yàn)報(bào)告題目:交互式sql姓名xxxFI期2016426實(shí)驗(yàn)環(huán)境:windows2010,mysql實(shí)驗(yàn)內(nèi)容與完成情況:1、創(chuàng)建模式nSFsql>createdatabaseweb;QueryOK.1rowaffected<0.00sec>2、表的創(chuàng)建的和刪除mysql>useweb;Databasechangedmysql>createtableERROR1113<42000>:student;Atablemusthaueatleast1columnmysql>createtable->
2、idchar<20>.student<->namechar<20>,->sexchar<5>>;ryOK,0rowsaffected<0.48sec>msFsql>showtables;iTables_in_webiistudent1rowinset<0.00sec>createtablea>;QueryOK.0rowsaffected<0.28sec>nysql>dropQueryOKj.0tablea;rowsaffected<0.19sec〉3、插入、修改和刪除插
3、入:tysql>insertintostudentvalues<92013080103229,9zviJ,9nan9>;ueryOK.1rowaffected<0.07sec>nysql>select*fromstudent;iidinameisex201308010321jyf!nani201308010320izzsinan!201308010317!zy!nan!201308010318!xl!nan!201308010322!zw!nanrowsinset<0.00sec>id=J2013080
4、10322J;修改:r)ysql>updatestudentsetsex=,womenJwhereQueryOK,1rov>affected<0?10sec>”Rowsmatched:1Changed:1Warnings:0?mysql>select*fromstudent;-+-+idinameisex-+-+201308010321!jyfiman201308010320izzsiman201308010317!zyiman201308010318!xliman201308010322iZWiwomen
5、-+-+fcJ5rowsinset<0.00sec>1ysql>deletefromstudentwhereid=J201308010322J;ueryOK.1rowaffected<0.06sec>nysql>select*fromstudent;naneisexC:201308010321!jyf!man!201308010320!zzs!manr:201308010317!zy!man!201308010318!xl!manrowsinset<0.00sec>4、單表和連表查詢<0.00sec>cna
6、mefromcoursewheresid=J201308010321J;hysql>selectidname,cnamefromstudent,coursewherestudent.id=course.sidandcourse.sid=*201308010321J;'id!nameicnamei5201308010321!jyf!math!201308010321!jyf!jaua!201308010321!jyf!ctt5201308010321!jy£!C++4rov/sinset<0.08sec>)n
7、ysql>select*fromcourse;+4!eno!id卜+cnamei!1!201308010321mathi!1!201308010317mathi!1!201308010318mathi!1!201308010320mathi!2!201308010321jauai!2!201308010320jauai!2!201308010317jauai!2!201308010318jauai!3!201308010321ctt!!4!201308010321++4C++i卜+10rowsinset<0
8、.00sec>5、嵌套查詢和集合杳詢嵌套查詢:ysql>selectidj.namefromstudentwhereidin;+id!name201308010321Ijyf201308010320iZZS-?rowsinset<0.11sec>集合查詢:unionselect*fromstudentwherenysql>select*fron