| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Counting propositions
>> Speaking of that, I've seen several examples where the writer puts
SELECT COUNT(1) FROM source WHERE (predicate); I've always wondered
whether there are any consequences to that usage, other than
readability? <<
History. COUNT(*) and EXISTS (SELECT * ..) originally meant "pick one column" and not "pick all the columns"; SQL aggregates were defined for columnar subqueries only. But they were also defined only for non-NULLs. So we had to make it a weird exception to behavior for COUNT(*). Unfortunately, some early SQLs (i.e. Oracle) expanded the subquery in its full glory. What COUNT(<constant>) did was tell early optimizers they did not have to look at the whole row. Received on Sun Jun 20 2004 - 18:41:46 CDT
![]() |
![]() |