In Mysql, if you wanna test a row exists or not, you could also try EXISTS
:
SELECT EXISTS(SELECT * FROM table1 WHERE ...)
and per the documentation, you can SELECT
anything.
Traditionally, an
EXISTS
subquery starts withSELECT *
, but it could begin withSELECT 5
orSELECT column1
or anything at all. Mysql ignores theSELECT
list in such a subquery, so it makes no difference.
FYI: