• Sql Server2008基础使用教程记录子查询(IN表达式)


    子查询(IN表达式)

    用于限制条件表达式

    -- 查询字段为值1,值2,值3的数据
    where 字段名 in(值1,值2,值3,...)
    -- 查询字段不为值1,值2,值3的数据
    where 字段名 not in(值1,值2,值3,...)

    -- 通过子查询来限制主查询
    select * from 表1
    where 字段名 in (select 字段名 from 表2)

    子查询(EXISTS)

    exists 返回的是一个bool类型

    select a.StudentNo, a.StudentName, a.Age, a.Sex from students as a
    -- 返回false不显示 返回true显示
    where exists(select * from student_lesson b where a.StudentNo = b.StudentNo)

  • 相关阅读:
    解决input获取焦点时底部菜单被顶上来问题
    JavaScript学习笔记
    JavaScript表单验证
    js 中{},[]中括号,大括号使用详解
    陀飞轮
    娱乐天空
    左右手
    软测 学习
    git 学习
    spring boot 学习
  • 原文地址:https://www.cnblogs.com/ChiYue/p/16372364.html
Copyright © 2020-2023  润新知