当子查询返回的列的值是多个值,那么就不能使用比较运算符(> < = !=),使用关键字in

语法:

select …..from …..where 表达式 in (子查询)

常用in替换等于(=)d的比较子查询。

1. in使用 : in关键字可以使父查询匹配子查询返回的多个列值。

2. not in 将父查询条件中的表达式与子查询返回的结果进行比较,吧不匹配的信息显示出来。

in语句列如

use addbd

GO

Select name,ID from book where id in (10,11,20)子查询

随机推荐

  1. Major OSL changes to catch up

    flat_map optimization for runtime specialization: https://github.com/imageworks/OpenShadingLanguage/ ...

  2. sublime 插件安装之sublime highlight 如何优雅拷贝代码到word

      首先:打开preference => Package Control,输入 Add Repository ,用它来为Sublime 添加插件安装源, https://github.com/n ...

  3. coderfoces D. Gourmet choice

      D. Gourmet choice time limit per test 2 seconds memory limit per test 256 megabytes   题目链接: https: ...

  4. OCP认证052新加的考试题及答案整理-21

    21.Which two are true about roles? A) A role can be password-protected. B) A role can be granted to ...

  5. codis__简介

    参考文档 https://github.com/wandoulabs/codis 中文简介 https://github.com/wandoulabs/codis/blob/master/doc/tu ...

  6. Vim寄存器

    (cut && copy && paste) VS ( delete && yank && put ) "" 无名寄 ...

  7. replace函数结合正则表达式实现转化成驼峰与转化成连接字符串的方法

    //连接符转成驼峰写法 function toCamel(str){ var reg=/-(\w)/g; return str.replace(reg,function(){ return argum ...

  8. javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection timed out: connect

    本地测试向服务器中ActiveMQ添加队列数据,报错连接超时 解决: 查看服务器端口号是否存在,(最好是0.0.0.0格式的,虽然暂时还不知道为啥得这个格式) 通过telnet测试该端口不通(6161 ...

  9. 日志一直打印 DEBUG o.s.amqp.rabbit.listener.BlockingQueueConsumer

    <?xml version="1.0" encoding="UTF-8"?> <configuration> <logger na ...

  10. 自己动手——快速搭建Android应用服务器

    1.服务器搭建方案选择 我们用:MySQL + Java Web + Tomcat + Volley 来实现我们的服务器. 其中:①MySQL是开源的数据库软件:②Java Web是遵循Java语言风 ...