003 mysql中exists的使用

匿名 (未验证) 提交于 2019-12-02 22:02:20

mysql中exists可以使用在两个地方,一个是在创建库或者表的时候,配合if 使用,一个是在子查询中。

# 和if一起使用,对库或表都可以使用 create database if not exists yaco charset utf8; drop database if exists yaco;   # 在子查询中使用,返回True或者False,条件满足时执行前面的代码 select * from tb1 where exists(select id from tb2 where name = 'yaco');
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!