資源描述:
《VB數(shù)據(jù)庫(kù)SQL語(yǔ)句學(xué)習(xí).doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、1.Select*fromstudent查詢所有原始記錄2.SelectStudentID,StudentNamefromstudent只查詢學(xué)號(hào)和姓名3.SelectStudentIDas學(xué)號(hào),StudentNameas姓名,Sexas性別,Classas班級(jí),NormalScoreas平時(shí)成績(jī),ExperimentScoreas實(shí)驗(yàn)成績(jī),ExaminationScoreas考試成績(jī)fromstudent4.Select*fromstudentwheresex=’男’只需要查看男生的成績(jī)5.Select*fromstudentwhereNormalScore>80
2、只需要查看平時(shí)成績(jī)大于80分的記錄6.Select*fromstudentwherestudentnamelike‘陳%’查詢姓陳的同學(xué)的記錄7.Select*fromstudentorderbyexaminationScore根據(jù)考試成績(jī)排序8.Select*fromstudentorderbyexaminationScore排序---降序9.SelectSum(examinationScore)as總成績(jī)fromstudent求總成績(jī)10.SelectAvg(examinationScore)as平均成績(jī)fromstudent求平均成績(jī)11.Selectcoun
3、t(*)as總記錄數(shù)fromstudent求總記錄數(shù)12.SelectMax(ExaminationScore)as最高分fromstudent求最高分13.SelectMin(ExaminationScore)as最高低分fromstudent求最低分14.SelectClassas班級(jí),Avg(ExaminationScore)as平均成績(jī)fromstudentgroupbyclass各班級(jí)成績(jī)的分類匯總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