是否有任何SQL查询来检查值是否存在或不存在于数据库表中

是否有任何SQL查询来检查值是否存在或不存在于数据库表中

问题描述:

在我的数据库表中具有此值,我必须检查此电子邮件值'abc@gmail.com'是否存在于数据库中.

In my database table have this value,i have to check this email value 'abc@gmail.com' is exist in the database or not.

abc@gmail.com
edf@dfg.com
xyz@abcinfo.com
12345@fdfg.com

如果数据库表中存在'abc@gmail.com'值,则输出为true,否则为false,那么如何编写查询以实现此目的?

If 'abc@gmail.com' value is exist in the database table, output is true else false, so how to write the query for this to achieve?

谢谢 库马尔

您可以做一些简单的事情 select CASE WHEN count(1) > 0 THEN 'true' ELSE 'false' END from table where email = 'abc@gmail.com'

You can do something as simple as select CASE WHEN count(1) > 0 THEN 'true' ELSE 'false' END from table where email = 'abc@gmail.com'

但是您应该提供更多信息,以获得更出色的答案.

But you should give some more information for a beater answer.