Reputation
866
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
4 9
Impact
~36k people reached

  • 0 posts edited
  • 0 helpful flags
  • 15 votes cast
Feb
1
comment What is the correct result for this query?
@Kevin did you ask ISO for permission to copy ? :-)
Jan
29
comment What is the correct result for this query?
Well the key issue is whether it's indeed true that "even if the table has no rows at all, it's still one group of 0 rows". And the standard turns out to be explicit about this : "If there are no grouping columns, then ... is the grouped table consisting of T as its only group". (and that holds even if T is empty - so there is indeed a group.) Further on, the having clause specifies that the condition is applied to each group (in the example thus once). They probably defined it this way to make SUM and COUNT return one row even for empty T's.
Jan
29
answered Looking for a scalable relational database
Jan
24
comment How to tackle a large undocumented database
Think before you comment. The OP explicitly stated that he was the ONLY It guy. So who are those developers ? External contractors perhaps, who were paid for nothing more than just the time it took to build the thing ? Why would those be willing to put in their time for additional support, which company X probably has been unwilling to pay for to begin with ? Or were they perhaps former employees who got laid off because they were too expensive ? Why would they put in their time to help out company X with its problems ? And who is going to get hurt by dropping tables ?
Jan
23
answered Reflexivity axiom for inferring functional dependencies
Dec
14
comment Simplify and optimize a complex query
Then you'll have to make the users accept the 35 seconds (and its further degrading as data volumes grow faster than the hardware speeds do). Forewarning them about this (as in : display a rotating clockwork to make it clear that the machine is working at their service) sometimes works miracles in this respect.
Dec
14
answered Simplify and optimize a complex query
Dec
11
comment Searching transaction logs for changes
you'll have to specify which SQL product you're using.
Dec
3
comment How to best encapsulate monetary values in a database
Option 1 is not anti-relational and it is not true that there isn't a "purely relational solution to this". Except then perhaps for extremely perverse interpretations of "purely relational".
Nov
2
comment “Zero” downtime and minimal space requirements for upgrade to PostgreSQL 9.2
Providing only version numbers without naming the product isn't exactly helpful ...
Oct
19
awarded  Enlightened
Oct
11
comment Is there a reason to use extremely abbreviated table names?
If 30 characters aren't enough to be able to come up with unique names for tables, you have a much more serious problem than any DBMS or development environment can solve : you have a problem with the level of expressiveness of your language and/or vocabulary.
Oct
8
answered Merging tables with a 1 to 1 relationship in a database
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
I've typed some stuff in that second link you gave ...
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
The space available in these comments is way too short to discuss all that in the level of detail it deserves. Is there some place else where we can take these discussions to ?
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
@AlexKuznetsov : sorry to say, but what about SUM ( { 1 3 } ) + SUM ( { 1 4 } ) == SUM ( { 1 3 } UNION { 1 4 } ) ? Remember that relational union is supposed to eliminate duplicates !!!
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
@SQL kiwi. Are you forgetting about static type checking ? If expressions like SUM() are handled by the static type checker as if they always return an integer, then obviously it should be impossible for the SUM() invocation to sometimes return something that is not an integer (e.g. an empty relation).
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
@TToni : "especially when you think about possible expansions of the standard" is not the context that the OP was referring to. the OP was very clearly referring to the current version of the standard, which does not include any sort of notion of "dynamic types" or some such. (Oh, and I only commented, but didn't downvote. Apart from that tiny slip I took issue with, nothing in your answer was wrong enough to warrant a downvote. IMO.)
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
@ypercube : Does 'WHERE x >= 5' cause the creation of a specialized type INTGE5, whose lowest value happens to be the value 5 ? Before you answer, ponder whether 'WHERE LN(x) >= 0' would then also cause the creation of a specialized type NUMBER_GE_1. Or the specialized type that would have to be created for 'WHERE EXP(-x*x) > 0.5'.
Oct
5
comment Why does ANSI SQL define SUM(no rows) as NULL?
@ypercube : could you rephrase that first comment ? Either an identity value exists for some binary operator on some type, and then that identity value is a member of the type, or else it just doesn't exist, and then obviously no value can sensibly be returned from an aggregation over an empty set that involves that underlying binary operator. One example is HARMONICMEAN (parallel wiring of resistors), whose identity value is positive infinity, which is a problem for all types that do not include infinity as a value. For HIGHEST and LOWEST, an identity value always exists within the type.