3 ms·
The biggest complaint is that SQL allows "bag output", meaning the result table (output) doesn't necessarily have to have or echo a unique key (singular or comp
by tabtab 8y ago
The biggest complaint is that SQL allows "bag output", meaning the result table (output) doesn't necessarily have to have or echo a unique key (singular or compound). Dr. Codd's definition of "relational" wouldn't allow such. ("Bag" is a type of data structure.)
I've argued there are times when you want to suppress the key, such as giving data to an outside customer where you don't want them to have the internal key. Query languages such as REL that don't allow "bag output" require silly gyrations to remove the key from the output.
As a compromise I have proposed SQL require a clause "ALLOW BAG" before it allows bag output. This would prevent most inadvertent bags. (I'd like similar for "ALLOW CARTESIAN" to prevent inadvertent Cartesian joins. It's a far bigger actual problem than bags, in my experience.) I believe this comprise is good enough and avoids having to totally throw out SQL and start over. (SQL has other annoyances, but REL doesn't solve most in my opinion.)