I realize this is an old post, but I thought it important to add clarity about why one might choose one format over another.
First, as others have pointed out, the database engine is supposed to ignore the Select clause. Every version of SQL Server has/does, Oracle does, MySQL does and so on. In many, many moons of database development, I have only ever encountered one DBMS that did not properly ignore the Select clause: Microsoft Access. Specifically, older versions of MS Access (I can't speak to current versions).
Prior to my discovery of this "feature", I used to use Exists( Select *...
. However, i discovered that MS Access would stream across every column in the subquery and then discard them (Select 1/0
also would not work). That convinced me switch to Select 1
. If even one DBMS was stupid, another could exist.
Writing Exists( Select 1...
is as abundantly clear in conveying intent (It is frankly silly to claim "It's too close to saying "if 'no value' exists" for comfort.") and makes the odds of a DBMS doing something stupid with the Select statement nearly impossible. Select Null
would serve the same purpose but is simply more characters to write.
I switched to Exists( Select 1
to make absolutely sure the DBMS couldn't be stupid. However, that was many moons ago, and today I would expect that most developers would expect seeing Exists( Select *
which will work exactly the same.
That said, I can provide one good reason for avoiding Exists(Select *
even if your DBMS evaluates it properly. It is much easier to find and trounce all uses of Select *
if you don't have to skip every instance of its use in an Exists clause.