Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Aggregate functions on empty sets in SQL

Aggregate functions on empty sets in SQL

From: Mikito Harakiri <nospam_at_newsranger.com>
Date: Tue, 06 Nov 2001 18:02:17 GMT
Message-ID: <JAVF7.14841$xS6.20943@www.newsranger.com>


The query

SQL> select min(1) from tbl where 1=0;

MIN(1)


returns one row with NULL. 2 questions:

  1. Is it SQL standard?
  2. Is it for any reason better than retuning minimal number in the numeric domain? (Same for dates, strings and other domains with total ordering). Every aggregate function internally starts a loop with some value (for example, sum starts with 0), and that value is the intuitive result of quering the empty set. Besiades, in order to find out the min/max numbers in the domain I would have to make one less trip to the documnetation;-)
Received on Tue Nov 06 2001 - 12:02:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US