欢迎来到天天文库
浏览记录
ID:57691158
大小:16.00 KB
页数:2页
时间:2020-09-01
《VB数据库SQL语句学习.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.Select*fromstudent查询所有原始记录2.SelectStudentID,StudentNamefromstudent只查询学号和姓名3.SelectStudentIDas学号,StudentNameas姓名,Sexas性别,Classas班级,NormalScoreas平时成绩,ExperimentScoreas实验成绩,ExaminationScoreas考试成绩fromstudent4.Select*fromstudentwheresex=’男’只需要查看男生的成绩5.Select*fromstudentwhereNormalScore>80
2、只需要查看平时成绩大于80分的记录6.Select*fromstudentwherestudentnamelike‘陈%’查询姓陈的同学的记录7.Select*fromstudentorderbyexaminationScore根据考试成绩排序8.Select*fromstudentorderbyexaminationScore排序---降序9.SelectSum(examinationScore)as总成绩fromstudent求总成绩10.SelectAvg(examinationScore)as平均成绩fromstudent求平均成绩11.Selectcoun
3、t(*)as总记录数fromstudent求总记录数12.SelectMax(ExaminationScore)as最高分fromstudent求最高分13.SelectMin(ExaminationScore)as最高低分fromstudent求最低分14.SelectClassas班级,Avg(ExaminationScore)as平均成绩fromstudentgroupbyclass各班级成绩的分类汇总PublicClassfrmMainPrivateObjCnnAsNewOleDbConnectionPrivateObjCmdAsOleDbCommandPr
4、ivateStrDirAsString="D:MIS1025StudentMgr.accdb"PrivateSubfrmMain_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadObjCnn.ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;DataSource="&StrDirObjCnn.Open()ObjCmd=NewOleDbCommandObjCmd.Connection=ObjCnnEndSubP
5、rivateSubFindRecord(ByValStrSQLAsString)ObjCmd.CommandText=StrSQLDimrdAsOleDbDataReader=ObjCmd.ExecuteReaderDimtblAsNewDataTabletbl.Load(rd)DataGridView1.DataSource=tblEndSubPrivateSubCmdFind_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesCmdFind.ClickFindRecord(txtSQ
6、L.Text)EndSub
此文档下载收益归作者所有