遇到的MYSQL中IF EXISTS的使用方法

exists为存在量词。两种用法举例:
1、用于子查询。带有EXISTS的子查询不返回任何数据,只产生逻辑真值“true”或者逻辑假值“false”。
例如:select 列 from 表1 where exists (select 列 from 表2 where …);
括号中为子查询,当子查询满足条件时,exists(子查询)返回true,父级查询在进行查询,否则,父级查询跳过。
2、drop table if exists 表A;如果存在表A,则删除表A

猜你喜欢

转载自blog.csdn.net/Asteria_qyj/article/details/85344629