VB数据库SQL语句学习由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“vb与sql数据库实例”。
1.Select * from student查询所有原始记录
2.Select StudentID, StudentName from student 只查询学号和姓名
3.Select StudentID as 学号, StudentName as 姓名, Sex as 性别,Cla as 班级,NormalScore as 平时成绩,ExperimentScore as 实验成绩, ExaminationScore as 考试成绩 from student
4.Select * from student where sex=’男’只需要查看男生的成绩
5.Select * from student where NormalScore>80只需要查看平时成绩大于80分的记录
6.Select * from student where studentname like ‘陈%’查询姓陈的同学的记录
7.Select * from student order by examinationScore根据考试成绩排序
8.Select * from student order by examinationScore排序---降序
9.Select Sum(examinationScore)as 总成绩 from student求总成绩
10.Select Avg(examinationScore)as 平均成绩 from student求平均成绩
11.Select count(*)as 总记录数 from student求总记录数
12.Select Max(ExaminationScore)as 最高分 from student求最高分
13.Select Min(ExaminationScore)as 最高低分 from student求最低分
14.Select Cla as 班级, Avg(ExaminationScore)as 平均成绩 from student group by cla各班级成绩的分类汇总
Public Cla frmMain
Private ObjCnn As New OleDbConnection
Private ObjCmd As OleDbCommand
Private StrDir As String = “D:MIS1025StudentMgr.accdb”
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)Handles MyBase.Load
ObjCnn.ConnectionString = “Provider=Microsoft.ACE.OLEDB.12.0;Data Source=” & StrDir
ObjCnn.Open()
ObjCmd = New OleDbCommand
ObjCmd.Connection = ObjCnn
End Sub
Private Sub FindRecord(ByVal StrSQL As String)
ObjCmd.CommandText = StrSQL
Dim rd As OleDbDataReader = ObjCmd.ExecuteReader
Dim tbl As New DataTable
tbl.Load(rd)
DataGridView1.DataSource = tbl
End Sub
Private Sub CmdFind_Click(ByVal sender As System.Object,System.EventArgs)Handles CmdFind.Click
FindRecord(txtSQL.Text)
End Sub ByVal e As
SQL数据库编程学习应用语句大全1as 的用处as可以对表和列取别名在开发过程中经常遇到开始给某一个的字段去field1的名称,但后来有感觉field1字段指定不确切,于是又把此字段改......
作业十题1.查询所有学生的基本信息,并按学号降序排列SELECT * FROM STUDENTORDER BY sno DESC;2.查询系别代码为“02”的女同学信息SELECT * FROM STUDENTWHERE ex=’女’ an......
DB2数据库SQL注入语句(精选6篇)由网友“雨后池塘小青蛙”投稿提供,下面是小编给大家带来关于DB2数据库SQL注入语句,一起来看看吧,希望对您有所帮助。篇1:DB2数据库SQL注入语句 以......
一、选择题1、SQL语言是()语言。——(SQL特点)(易)A)层次数据库 B)网络数据库 C)关系数据库D)非数据库答案:C2、SQL语言具有两种使用方式,分别称为交互式SQL和()。——(SQL语言使用方式......
SQL Server 2008 数据库的管理(二)一、T-SQL 概述1.SQL:Structured Query Language:结构化查询语言,现在已经作为国际计算机查询语言的通用标准,92年美国国家标准局ANSI推出ANSI S......