欢迎来到天天文库
浏览记录
ID:41707248
大小:62.73 KB
页数:6页
时间:2019-08-30
《数据库表的创建、查询、插入、删除、视图、索引》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《数据库咅统概论》实验报告题目:交互式sql姓名xxxFI期2016426实验环境:windows2010,mysql实验内容与完成情况:1、创建模式nSFsql>createdatabaseweb;QueryOK.1rowaffected<0.00sec>2、表的创建的和删除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
此文档下载收益归作者所有