title: SQL: do we need ANY/SOME and ALL keywords?
body: <p>I'm using SQL (SQL Server, PostgreSQL) over 10 years and still I'm never used <code>ANY/SOME</code> and <code>ALL</code> keywords in my production code. All situation I've encountered I could get away with <code>IN</code>, <code>MAX</code>, <code>MIN</code>, <code>EXISTS</code>, and I think it's more readable. </p>
  
  <p>For example:</p>
  
  <pre><code>-- = ANY
  select * from Users as U where U.ID = ANY(select P.User_ID from Payments as P);
  
  -- IN
  select * from Users as U where U.ID IN (select P.User_ID from Payments as P);
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>-- &lt; ANY
  select * from Users as U where U.Salary &lt; ANY(select P.Amount from Payments as P);
  
  -- EXISTS
  select * from Users as U where EXISTS (select * from Payments as P where P.Amount &gt; U.Salary);
  </code></pre>
  
  <p>Using <code>ANY/SOME</code> and <code>ALL</code>:</p>
  
  <ul>
  <li><a href="http://www.postgresql.org/docs/9.1/static/functions-subquery.html#FUNCTIONS-SUBQUERY-ANY-SOME" rel="noreferrer">PostgreSQL</a></li>
  <li><a href="http://msdn.microsoft.com/en-us/library/ms175064.aspx" rel="noreferrer">SQL Server</a></li>
  <li><a href="http://dev.mysql.com/doc/refman/5.0/en/any-in-some-subqueries.html" rel="noreferrer">MySQL</a></li>
  <li><a href="http://sqlfiddle.com/#!12/bfc43/12" rel="noreferrer">SQL FIDDLE with some examples</a></li>
  </ul>
  
  <p>So the question is: am I missing something? is there some situation where <code>ANY/SOME</code> and <code>ALL</code> shine over other solutions?</p>