zoukankan      html  css  js  c++  java
  • 23-10 条件查询

    --------------------带条件查询---------------------
    --select  列
    --from  表
    --where  条件
    
    
    --查询没有及格的学生的学号(假设:数学或英语,只要有一门没有及格就叫做没有及格)
    select tsId from TblScore 
    select tsId from TblScore where tEnglish<60 or tMath<60
    
    
    --查询年龄在20-30岁之间的男学生(包含20和30)
    select * from TblStudent 
    select * from TblStudent where tsage>=20 and tsage<=30 and tsGender=''
    
    --Between...and ...   在...之间,(闭区间,包含两个端点值)
     select * from TblStudent where between 20 and 30 and tsGender=''
    
     --查询math成绩在80-90分之间的所有学生
     select * from TblScore where tsmath between 80 and 90
    
    
    
     ------------------
    select *  from TblStudent
    --查询出所有班级Id为3,4,5的那些学生
    select *  from TblStudent where tsclassId=3 or tsclassId=4 or tsclassId=5
    select *  from TblStudent where tsclassId in (3,4,5)
    --对于in或者or 查询,如果查询中的条件是连续的几个数字,最好使用>=  <= 或者between...and...,不用使用or 或者in,提高效率
    select *  from TblStudent where tsclassId>=3 and tsclassId<=5
  • 相关阅读:
    短信验证倒计时60s
    jquery select省市区三级联动
    C# 遍历文本框
    html formData 数据 提交和 .netMVC接收
    jq遍历table 下的 td 添加类
    jq 替换DOM layeui 不刷新
    jq 获取表单所有数据
    js 二级联动
    MVC 下载文件
    MVC 上传文件
  • 原文地址:https://www.cnblogs.com/Strugglinggirl/p/7198598.html
Copyright © 2011-2022 走看看