tag:blogger.com,1999:blog-9053536529694784563.post569087774248438188..comments2020-05-07T00:33:57.272-07:00Comments on Database Explorer: The Empty Set?Simon Riggshttp://www.blogger.com/profile/06017750505968534813noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-9053536529694784563.post-53487984443550124372010-04-01T19:49:16.835-07:002010-04-01T19:49:16.835-07:00This may be April 1st, but supporting empty sets i...This may be April 1st, but supporting empty sets in the general case is a good feature to have, both for supporting tuples and relations with zero attributes, and for supporting keys ranging over zero attributes, and supporting selecting zero attributes and grouping by zero attributes, etc; placing a key constraint of zero attributes says that a relation may have either zero or one tuple.<br /><br />While I like the support for nullary tuples and relations, I find that the monikers TABLE_DEE and TABLE_DUM to be quite bad and never use them; and I can never remember which is which; rather I prefer the monikers D0C1 and D0C0, which are descriptive (the D and C mean degree and cardinality); plain D0 I use to mean the nullary tuple.<br /><br />Responding to Bill Karwin, you made a mistake regarding D0C0; joining a relation R with D0C0 results in a relation with the same attributes as R but no tuples, not in D0C0 as you said; your observation about D0C1 is correct, the result being just R, so D0C1 is the identity value for relational join.Darren Duncanhttp://www.muldis.comnoreply@blogger.comtag:blogger.com,1999:blog-9053536529694784563.post-11824127775245947852010-04-01T11:14:55.644-07:002010-04-01T11:14:55.644-07:00Great comments guys, thanks.Great comments guys, thanks.Simon Riggshttps://www.blogger.com/profile/06017750505968534813noreply@blogger.comtag:blogger.com,1999:blog-9053536529694784563.post-8043082263534546682010-04-01T10:25:58.702-07:002010-04-01T10:25:58.702-07:00C. J. Date calls these relations TABLE_DUM and TAB...C. J. Date calls these relations TABLE_DUM and TABLE_DEE. TABLE_DUM has zero tuples of degree zero, TABLE_DEE has one tuple of degree zero.<br /><br />The reason these are important is to provide some identity relations with respect to join. Joining any table to TABLE_DEE returns the original table. Joining any table to TABLE_DUM returns TABLE_DUM. You can think of this as analogous to multiplying by 1 or 0.<br /><br />Unfortunately, standard SQL doesn't account for tuples of degree zero. So while it makes sense that relational theory includes these relations for completeness, SQL as written doesn't.Bill Karwinhttps://www.blogger.com/profile/13004667086865377598noreply@blogger.comtag:blogger.com,1999:blog-9053536529694784563.post-16761800785639987352010-04-01T09:20:42.715-07:002010-04-01T09:20:42.715-07:00Here's a table that must be empty:
CREATE tab...Here's a table that must be empty:<br /><br />CREATE table " "(check(false));<br />INSERT INTO " " DEFAULT VALUES;<br />ERROR: new row for relation " " violates check constraint " _check"David Fetterhttps://www.blogger.com/profile/06408194859600882631noreply@blogger.com