/*查询表中所有信息*/
select * from Students_information
/*查询地址是河南的学生的所有信息*/
select * from Students_information where address='河南'
/*查询地址是河南并且Email='1234567@qq.com的学生姓名 and是并且的意思*/
select name from Students_information where address='河南' and Email='1234567@qq.com'
/*查询地址是河南并且Email='1234567@qq.com的学生姓名 or是或者的意思*/
select name from Students_information where address='河南' or Email='1234567@qq.com'
/*查询入学时间是在'2017-01-01' 和 '2018-05-01之间的学生信息 between 是XX与XX之间的意思*/
select * from Students_information where admissiondate between '2017-01-01' and '2018-05-01'
/*查询地址已黄字开头的所有信息 %表示匹配多位 通配符%表示多位 */
select * from Students_information where address like '黄%'
/*查询以李字开头的,后面为一位的姓名 _表示一个字符*/
select * from Students_information where name like '李_'
/*查询StuID的前两行数据*/
select top (2) StuID from Students_information
/*查询百分之五十的StuID*/
select top 50 percent StuID from Students_information
SQL Server详细查询语句
最新推荐文章于 2024-04-14 20:46:48 发布