<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.ormfoundation.org/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Conceptual modeling</title><link>http://www.ormfoundation.org/forums/84.aspx</link><description>This forum is for discussing issue at the "conceptual" level of modeling.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2668.aspx</link><pubDate>Wed, 25 May 2011 17:48:23 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2668</guid><dc:creator>hughdarwen</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2668.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2668</wfw:commentRss><description>&lt;p&gt;In response to Clifford, in great haste because I&amp;#39;m about to be away and out of communication until next Tuesday:&lt;/p&gt;&lt;p&gt;(a) At the physical layer anything goes.&amp;nbsp; If some kind of &amp;quot;sparse matrix&amp;quot; gives desired performance while a more direct representation of the logical schema doesn&amp;#39;t, then go for it.&amp;nbsp; (I have often made this point.)&amp;nbsp; But the things representing the gaps wouldn&amp;#39;t be called NULL because that has semantics in the language (SQL) in which it is defined.&amp;nbsp; Nor would the storage and retrieval mechanism have to deal with 3-valued logic etc.&lt;/p&gt;&lt;p&gt;(b) Well, standard SQL has had NATURAL JOIN since 1992--what&amp;#39;s more I was the one that put it there!&amp;nbsp; (It also has JOIN ... USING ..., which ought to be natural join with protection from inadvertently joining on the wrong attributes but alas it isn&amp;#39;t, quite.)&lt;/p&gt;&lt;p&gt;In Business System 12 and &lt;b&gt;Tutorial D&lt;/b&gt;, when you&amp;#39;re confident that the attribute names are as you want them, you can write JOIN{r1, r2, ... rn} (though in BS12 the braces were parens) in place of r1 JOIN r2 JOIN ... JOIN rn.&amp;nbsp; (This thanks to JOIN&amp;#39;s commutativity and associativity, of course.)&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Hugh &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2658.aspx</link><pubDate>Wed, 25 May 2011 07:13:22 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2658</guid><dc:creator>Clifford Heath</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2658.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2658</wfw:commentRss><description>&lt;p&gt;Dear Mr Darwen:&lt;/p&gt;

&lt;p&gt;The only perjorative in my intent was against those who have come to think the SQL is a good example of the relational model! That is, I used the word &amp;quot;purist&amp;quot; to avoid confusion with the popular misunderstanding of &amp;quot;relational&amp;quot;.&lt;/p&gt;

&lt;p&gt;I bet you get very tired of being drawn into this kind of debate, with people who aren&amp;#39;t equipped to understand your arguments. Nevertheless, that&amp;#39;s not the case here, and I&amp;#39;d &lt;b&gt;really&lt;/b&gt; like your comments on my previous discussion of the different requirements of conceptual vs physical layers, and the need for NULLs at the physical layer, hidden under a pure conceptual layer.&lt;/p&gt;

&lt;p&gt;I&amp;#39;d also be delighted if you had time to comment on the conceptual difficulty (for ordinary mortals!) of expressing joins... I think SQL makes this stupidly difficult and have shown how it can be much easier in a more sensible query language. I think this is a mandatory requirement before we can expect people to normalise the NULLs out of their database design, whether or not we provide hidden conceptual-&amp;gt;physical mapping intelligence.</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2655.aspx</link><pubDate>Tue, 24 May 2011 17:38:17 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2655</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2655.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2655</wfw:commentRss><description>&lt;p&gt;Well said! Thanks, Mr. Darwen!&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2654.aspx</link><pubDate>Tue, 24 May 2011 17:32:25 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2654</guid><dc:creator>hughdarwen</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2654.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2654</wfw:commentRss><description>&lt;p&gt;Just to say that I don&amp;#39;t mind being called a relational purist.&amp;nbsp; After all, I can hardly deny it.&amp;nbsp; I claim, of course, that a &amp;quot;relationally pure&amp;quot; language, if well-designed by all other criteria of good language design, will be of more practical use than one that is impure (like SQL) and also well-designed by all other criteria of good language design (unlike SQL!).&amp;nbsp; Those who disagree with me will say, &amp;quot;The trouble with you is, your a relational purist and that&amp;#39;s why I don&amp;#39;t like your proposals&amp;quot;.&amp;nbsp; So they attach some pejorative connotation to the term, but that doesn&amp;#39;t make it ad hominem (unless of course it&amp;#39;s meant to be taken that way).&amp;nbsp; It&amp;#39;s relational purity they don&amp;#39;t like.&amp;nbsp; I like it and my reasons for liking it are thoroughly practical as well as aesthetic. Some claim that NULL is thoroughly practical.&amp;nbsp; I disagree.&amp;nbsp; It&amp;#39;s a judgment call.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Regards, &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hugh &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2652.aspx</link><pubDate>Tue, 24 May 2011 15:22:45 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2652</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2652.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2652</wfw:commentRss><description>&lt;p&gt;Hi Ken,&lt;/p&gt;
&lt;p&gt;If it matters, I&amp;nbsp;still think Clifford&amp;#39;s terminology is less problematic: First, &amp;quot;purist&amp;quot; does not necessarily carry any negative connotation. I doubt that Mr. Date would object to the characterisation of himself as a relational purist; in fact, I think he&amp;#39;d happily agree with the characterisation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Second, the assumption that we agree on the meaning of &amp;quot;relational conformance&amp;quot; is guaranteed to lead to confusion, in a context where not even Ted Codd and Chris Date (and Hugh Darwen) can agree on what conforms to the (true) &amp;quot;relational model&amp;quot;. So I fail to see the usefulness of that term at all, in the kind of disagreement we&amp;#39;re in which guarantees we don&amp;#39;t agree on the meaning of that term!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Andy&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2651.aspx</link><pubDate>Tue, 24 May 2011 15:12:40 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2651</guid><dc:creator>Ken Evans</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2651.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2651</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Andy Carver:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;P.S. So I don&amp;#39;t appear too biased for some people&amp;#39;s tastes, I offer up an additional&amp;nbsp;link, which at least gives both sides equal time -- in the persons of Messers Date and Codd:&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hi Andy,&lt;/p&gt;&lt;p&gt;Thanks for this. I will defer my response until I have read the 2010 book &amp;quot;Database Explorations&amp;quot; (by Chris Date and Hugh Darwen) which arrived by courier just one hour ago.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Ken&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2650.aspx</link><pubDate>Tue, 24 May 2011 15:09:27 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2650</guid><dc:creator>Ken Evans</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2650.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2650</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Andy Carver:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;You complained about Clifford&amp;#39;s use of the term &amp;quot;relational purist&amp;quot;, and preferred us to use the term &amp;quot;relational conformist&amp;quot;. I demur. I think Clifford&amp;#39;s term is somewhat more accurate.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hi Andy,&lt;/p&gt;&lt;p&gt;Again I confess to a lack of rigour in my use of language.&lt;br /&gt;For clarification, I think that it is better to discuss the truth or falsity of one or more conjectures than to resort to ad hominem reasoning.&lt;br /&gt;This (I now realise) is what was behind my objection to the term &amp;quot;purist&amp;quot;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So it seems to me better to discuss the topic of &amp;quot;relational conformance&amp;quot; in terms of whether a particular solution &amp;quot;conforms&amp;quot; rather than talk about the properties of any particular person who might propose the solution. &lt;/p&gt;&lt;p&gt;Ken &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2642.aspx</link><pubDate>Mon, 23 May 2011 12:41:51 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2642</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2642.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2642</wfw:commentRss><description>&lt;p&gt;Ken,&lt;/p&gt;
&lt;p&gt;P.S. So I don&amp;#39;t appear too biased for some people&amp;#39;s tastes, I offer up an additional&amp;nbsp;link, which at least gives both sides equal time -- in the persons of Messers Date and Codd:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dbdebunk.com/page/page/1706814.htm"&gt;http://www.dbdebunk.com/page/page/1706814.htm&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2641.aspx</link><pubDate>Mon, 23 May 2011 07:39:19 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2641</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2641.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2641</wfw:commentRss><description>&lt;p&gt;Hi Ken,&lt;/p&gt;
&lt;p&gt;You complained about Clifford&amp;#39;s use of the term &amp;quot;relational purist&amp;quot;, and preferred us to use the term &amp;quot;relational conformist&amp;quot;. I demur. I think Clifford&amp;#39;s term is somewhat more accurate.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; The reason I say this is that I cannot get my head around the idea that E.F. Codd was not a &amp;quot;relational conformist&amp;quot; (seeing as how he came up with the whole approach in the first place:-). But if he was indeed a &amp;quot;conformist&amp;quot; to the relational model, then we can&amp;#39;t use this term to refer to people who abhor the use of nulls. For he himself argued strongly against their position,&amp;nbsp;insisting that nulls were an important part of the relational model! You might wish to have a read of the following 1986 paper by him:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://148.247.202.2/~jtj/courses/dbs/relatedpapers/Missing%20information%20(applicable%20and%20inapplicable)%20in%20relational%20databases.pdf"&gt;http://148.247.202.2/~jtj/courses/dbs/relatedpapers/Missing%20information%20(applicable%20and%20inapplicable)%20in%20relational%20databases.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Andy&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2640.aspx</link><pubDate>Mon, 23 May 2011 06:27:59 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2640</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2640.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2640</wfw:commentRss><description>&lt;p&gt;Hi Mr. Darwen, 
&lt;p&gt;Although my wad is shot, I do notice I omitted to&amp;nbsp;respond to a few questions and&amp;nbsp;comments from you. Please allow me to do so below, in-line like 
&lt;p&gt;&amp;gt;&amp;gt; this.&amp;nbsp; 
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;hughdarwen:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;&amp;lt;snip&amp;gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here I just want to respond further to this, from you:&lt;/p&gt;
&lt;p&gt;&amp;quot;The reason why nulls are GOOD is precisely that the bag functions (e.g. AVG) which the system provides, are&amp;nbsp;TRAINED to ignore rows&amp;nbsp;containing nulls!&amp;quot;&lt;/p&gt;
&lt;p&gt;You seem to be arguing that NULL is good because AVG (etc.) treat it this way.&amp;nbsp; Surely you see that if NULL didn&amp;#39;t exist, AVG (etc.) would still work just fine--I would say even finer--especially when used in conjunction with the SUMMARIZE ... PER ... relational operator proposed by myself and Date as an improvement on SQL&amp;#39;s GROUP BY.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; Well, if NULLS don&amp;#39;t exist, then it&amp;#39;s either because you&amp;#39;re using some other, user-chosen default values&amp;nbsp;to represent that &amp;quot;info is missing here&amp;quot;, or&amp;nbsp;else you don&amp;#39;t have to worry about potential missing information because you&amp;#39;ve chose to put each elementary fact type into its own table (as in your&amp;nbsp;&amp;quot;6NF&amp;quot;). But this latter alternative, I think Clifford has persuasively shown to be, at present anyway, too inefficient.&amp;nbsp;Which leaves us with the former alternative,&amp;nbsp;default values chosen by the user but which the system doesn&amp;#39;t know are to represent &amp;quot;info is missing here&amp;quot;. And&amp;nbsp;in that scenario,&amp;nbsp;I&amp;#39;d say No, AVG (etc.) do NOT &amp;quot;work just fine&amp;quot;, in fact they become&amp;nbsp;a royal pain to use-- which is my whole point here.&amp;nbsp;Now, it may be that you and Mr. Date have come up with a substitute for GROUP BY that, to some extent anyway, relieves the painfulness involved. I&amp;#39;d certainly be interested in reading up on your &amp;quot;SUMMARIZE ... PER ...&amp;quot; Where would I find the best introductory discussion, if I may ask?&lt;/p&gt;
&lt;p&gt;Of course I agree that if NULL exists, then SQL&amp;#39;s treatment of it in aggregate functions is sensible.&amp;nbsp; But then I would add, in that case (a) why isn&amp;#39;t the sum of no values at all zero, as it should be (zero being the identity value under addition) , and (b) why isn&amp;#39;t 1+NULL equal to 1, considering that SUM(x) = 1 when the bag represented by x here is {1,NULL}?&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; These examples can only make one chuckle, and indeed if there is any part of these SQL functions&amp;#39; behaviour that is NOT &amp;quot;sensible&amp;quot;, then SUM&amp;#39;s treatment of nulls, and addition&amp;#39;s treatment of them, are prime candidates for that dishonour.&lt;/p&gt;
&lt;p&gt;Not supporting NULL means the book doesn&amp;#39;t have to say anything about its treatment (in every operation).&amp;nbsp; William of Occam would have approved. &lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; Well, I like Occam&amp;#39;s Razor as much as the next philosopher. But honestly, what scares me more than teaching students about 3VL (which I last did about two weeks ago), is the thought of teaching them how to, and that they must, do all the aggregation operations without benefit of NULLs.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hugh&lt;/p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2638.aspx</link><pubDate>Mon, 23 May 2011 02:35:36 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2638</guid><dc:creator>Clifford Heath</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2638.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2638</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;hughdarwen:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;performance is a characteristic of the implementation, not the language&lt;/div&gt;&lt;/BLOCKQUOTE&gt;

&lt;p&gt;While it&amp;#39;s all very well to claim that, real applications must be written with real DBMS.&lt;/p&gt;

&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;hughdarwen:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;some queries of course go faster after decomposition&lt;/div&gt;&lt;/BLOCKQUOTE&gt;

&lt;p&gt;Of course, and the column store proponents have shown some interesting results. I&amp;#39;m wary though of their promotional focus.&lt;/p&gt;

&lt;p&gt;What does concern me is the attitude that the vast numbers of database designs containing NULLs are that way because the creators are somehow ignorant or lazy. That would be an extremely disrespectful attitude to take to the integrity and professionalism of the million DBAs whose daily work is to scrutinise schemas, transaction logs and system performance in order to create acceptable performance. When a schema can be manually manipulated to implement column-store behaviour or to remove NULLs through better normalization, these people will do it... &lt;b&gt;if&lt;/b&gt; it helps instead of hindering. The simple fact is, as I justified in my previous message, in the vast majority of cases, a physical model with NULLs performs better then one without.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m not justifying the use of NULLs in a conceptual model. Far from it. but unless and until we have DBMS that reliably produce the most effective physical schema from a pure conceptual one, we aren&amp;#39;t going to make progress.&lt;/p&gt;

&lt;p&gt;The other requirement for using more highly-normalised schemas is a query language where joins don&amp;#39;t make your eyes bleed. Recently I helped a New Zealander design a model for a trading (swapping) service. The schema was simple: Owneditem is where Person has Item, WantedItem is where Person wants/is wanted by Item, WantedItem is valued in/contains ValueRange (and OwnedItem-ValueRange too). Five tables; Person, Item, WantedItem, OwnedItem, and a static table for ValueCategory. The SQL view for possible trades, using the (less recommended, but more succinct implicit joins) follows:&lt;/p&gt;

&lt;pre&gt;
CREATE VIEW PossibleTrade AS
SELECT  p1.person_id AS person1_id,
        o1.item_id AS item1_id
        p2.person_id AS person2_id,
        o2.item_id AS item2_id
FROM    Person AS p1,
        OwnedItem AS o1
        Item AS i1,
        WantedItem AS w1,
        Person AS p2,
        OwnedItem AS o2,
        Item AS i2,
        WantedItem AS w2,
        ValueCategory AS vc
WHERE   p1.person_id = o1.person_id             -- Person1 owns
  AND   o1.item_id = i1.item_id                 -- an Item1
  AND   o1.value_category = vc.id               -- valued in the range VC1
  AND   o1.item_id = w2.item_id                 -- which is wanted
  AND   w2.person_id = p2.person_id             -- by Person2
  AND   p2.person_id = o2.person_id             -- who owns
  AND   o2.item_id = i2.item_id                 -- an Item2
  AND   o2.value_category = vc.id               -- valued in the same range VC1
  AND   o2.item_id = w1.item_id                 -- which is wanted
  AND   w1.person_id = p1.person_id             -- by Person1
&lt;/pre&gt;

&lt;p&gt;Using explicit joins, it&amp;#39;s shorter but harder to read: &lt;/p&gt;

&lt;pre&gt;
CREATE VIEW PossibleTrade AS
SELECT  p1.person_id AS person1_id,
        o1.item_id AS item1_id
        p2.person_id AS person2_id,
        o2.item_id AS item2_id
FROM    Person AS p1
        JOIN OwnedItem AS o1 ON p1.person_id = o1.person_id AND w1.person_id = p1.person_id
        JOIN Item AS i1 ON o1.item_id = i1.item_id
        JOIN ValueCategory AS vc ON o1.value_category = vc.id AND o2.value_category = vc.id
        JOIN WantedItem AS w2 on o1.item_id = w2.item_id
        JOIN Person AS p2 ON w2.person_id = p2.person_id
        JOIN OwnedItem AS o2 ON p2.person_id = o2.person_id
        JOIN Item AS i2 ON o2.item_id = i2.item_id
        JOIN WantedItem AS w1 ON o2.item_id = w1.item_id
&lt;/pre&gt;

&lt;p&gt;In CQL, this ugliness vanishes. Here&amp;#39;s the entire schema, and the PossibleTrades view (derived fact type):&lt;/p&gt;

&lt;pre&gt;
Value Category is written as Integer restricted to {5, 15, 50, 150, 500, 1500};

Item is identified by its Id;
Item has one Name, Name is of Item;

Person is identified by its Id;
Person has one Name, Name is of Person;

WantedItem is where
    Person wants Item, Item is wanted by Person;
WantedItem is in one Value Category, Value Category contains WantedItem;

OwnedItem is where
    Person has Item, Item is property of Person;
OwnedItem is in one Value Category, Value Category contains OwnedItem;

/*
 *  Derived Fact Types (views)
 */
Person (as Owner) has Item wanted by Person where
    Owner has Item that is wanted by Person;

Possible Trade is where
    Person(1) can trade Item(2) to Person(3) receiving Item(4) in return where
        Person(1) has Item(2) that is wanted by Person(3) that has Item(4) that is wanted by Person(1)
        and Item(2) is in Value Category that contains Item(4);
&lt;/pre&gt;

&lt;p&gt;The last 2 statements contain the same logic as the SQL views above. This schema translates to the same SQL, but is comprehensible to ordinary mortals. I realise that this example doesn&amp;#39;t illustrate the use or avoidance of NULLs, but it does illustrate why the extra normalisation (required to eliminate NULLs) is a problem.
&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2635.aspx</link><pubDate>Sun, 22 May 2011 14:53:07 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2635</guid><dc:creator>hughdarwen</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2635.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2635</wfw:commentRss><description>&lt;p&gt;Clifford wrote: &amp;quot;The problem with SQL is that for the implementations to get reasonable 
performance, facts should be clustered into tables that represent 
composite facts wherever that&amp;#39;s possible.&amp;quot;&lt;/p&gt;&lt;p&gt;That point about performance is frequently made.&amp;nbsp; I always want to remark that performance is a characteristic of the implementation, not the language.&amp;nbsp; I also always want to ask, &amp;quot;performance of what?&amp;quot;, to which the answer tends to be &amp;quot;queries that would require extra joins if we decomposed vertically to avoid nulls&amp;quot;.&amp;nbsp; But some queries of course go faster after decomposition. Also, in recent years there has been much interest in the performance benefits claimed for &amp;quot;column-wise&amp;quot; stores, in some varieties of which vertical decomposition is taken to extremes, under the covers.&amp;nbsp; If those claims are justified, then vertical decomposition at the logical level doesn&amp;#39;t seem such a bad idea, performance-wise, after all&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Hugh &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2633.aspx</link><pubDate>Sun, 22 May 2011 11:15:59 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2633</guid><dc:creator>Ken Evans</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2633.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2633</wfw:commentRss><description>&lt;p&gt;Clifford,&lt;/p&gt;&lt;p&gt;Well, for a&amp;nbsp;&amp;quot;non-expert&amp;quot; you have certainly made a very good articulation of the &amp;quot;null problem&amp;quot;!&lt;/p&gt;&lt;p&gt;One small quibble is your use of the term &amp;quot;purist&amp;quot; as you used it in&amp;nbsp;&amp;quot;relational purists&amp;quot;. &lt;br /&gt;&lt;br /&gt;As I understand it, the term &amp;quot;purist&amp;quot;&amp;nbsp;may be interpreted by many people&amp;nbsp;to have a&amp;nbsp;pejorative connotation.&lt;br /&gt;I suspect that this was not your intention.&lt;/p&gt;&lt;p&gt;Would you agree that &amp;quot;relational conformist&amp;quot; &amp;nbsp;would be better?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here, I draw upon&amp;nbsp;Philip Crosby&amp;#39;s &amp;quot;Quality is Free&amp;quot; book in which he advocates defining quality as &amp;quot;conformance to requirements&amp;quot;.&lt;br /&gt;I feel that the term&amp;nbsp;&amp;quot;relational conformist&amp;quot; eliminates the risk of a pejorative interpretation and also&amp;nbsp;leads to&amp;nbsp;useful questions such as:&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Does this data model conform to the relational model?&lt;br /&gt;Why should I bother to conform to the relational model?&lt;br /&gt;What are the benefits of conforming to the relational model?&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;and so on.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Regarding nulls, we&amp;nbsp;all seem to be agreed that in&amp;nbsp;RDBMS implementations, nulls are a fact of life that have to be handled.&lt;br /&gt;However, that is not the same thing as saying that nulls are OK.&lt;br /&gt;&lt;br /&gt;My original interjection (&lt;a href="http://www.ormfoundation.org/forums/t/839.aspx)"&gt;http://www.ormfoundation.org/forums/t/839.aspx)&lt;/a&gt; was intended to bring out the point that it is good practice to design a data model in a way that minimises the appearance of nulls in the physical implementation. My aim was&amp;nbsp;to show that Marc&amp;#39;s problem could be solved by using a conceptual model that eliminated the need for nulls - &lt;em&gt;in his particular scenario&lt;/em&gt;. &lt;/p&gt;&lt;p&gt;Ken&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2632.aspx</link><pubDate>Sun, 22 May 2011 06:02:50 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2632</guid><dc:creator>Andy Carver</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2632.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2632</wfw:commentRss><description>&lt;p&gt;Clifford&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; That&amp;#39;s extremely well stated, and yes, you&amp;#39;re getting down to at least one of the hubs of this whole issue. I agree that the awkwardness, which we have no choice to deal with, comes from the source that you indicate, and thus (I would add) not from any logical sloppiness or incompetence of the &amp;quot;nulls are OK&amp;quot; crowd. I wanted to bring up the issue of conceptual queries earlier, but I&amp;#39;m glad I&amp;nbsp;waited because you&amp;#39;ve now covered it much more eloquently than I could.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Andy&lt;/p&gt;</description></item><item><title>Re: To Null or not to Null. That is the question!</title><link>http://www.ormfoundation.org/forums/thread/2631.aspx</link><pubDate>Sun, 22 May 2011 02:03:47 GMT</pubDate><guid isPermaLink="false">9d039735-a311-4a8d-9c49-a0bb2572af9e:2631</guid><dc:creator>Clifford Heath</dc:creator><slash:comments>0</slash:comments><comments>http://www.ormfoundation.org/forums/thread/2631.aspx</comments><wfw:commentRss>http://www.ormfoundation.org/forums/commentrss.aspx?SectionID=84&amp;PostID=2631</wfw:commentRss><description>&lt;p&gt;Well, I don&amp;#39;t feel like an expert, but...&lt;/p&gt;

&lt;p&gt;The demand to exclude NULLs is for exactly the same reason that fact-based modelling demands elementary form. Whenever you express things in terms of predicates containing composite facts, you have problem when one of those facts is missing; so you need a different kind of expression. When elementary form is used, no fact exists without all roles being fulfilled, so you have no need for NULLs. In this respect, I think relational purists and fact oriented modellers are entirely in agreement, though we use different language to express it.&lt;/p&gt;

&lt;p&gt;The problem with SQL is that for the implementations to get reasonable performance, facts should be clustered into tables that represent composite facts wherever that&amp;#39;s possible. This clustering makes the best use of the physical media&amp;#39;s access characteristics. If the DBMS implementations had instead focussed on correct modeling in highly-normalised form (isomorphic with elementary form), and solved the problems of physical clustering without that affecting the conceptual models, there would be no need for NULLs... except for the NULLs hidden inside the physical model, of course.&lt;/p&gt;

&lt;p&gt;As technology advances and allows data to move progressively into Flash storage, and the rotational latency of the disk drive disappears, there&amp;#39;s less need for physical clustering, so the conceptual and physical models will converge. There&amp;#39;s still some premium on physical clustering due to hardware data transfer protocols, but I predict this will progressively become irrelevant.&lt;/p&gt;

&lt;p&gt;Until that happens, we need to deal with the explicit generation of composite physical models, probably using both SQL and NULL values, and I don&amp;#39;t see that to be a problem... although it could have been hidden by better DBMS design. The great pity isn&amp;#39;t that physical models must be explicitly generated, but that we haven&amp;#39;t built query languages that operate purely at the conceptual level, and hide the mapping to the physical level. Although it&amp;#39;s possible to use SQL views to project a pure conceptual schema from a composite physical schema, it&amp;#39;s a lot more work to construct. Querying it also requires many more joins, and because the SQL join syntax is so awkward and ugly, people avoid that. The result is that physical schemata are hard-wired into database query code in almost every application in existence.&lt;/p&gt;

&lt;p&gt;As it is, we need to solve the conceptual/physical mapping problem &lt;b&gt;outside&lt;/b&gt; the SQL implementations. The goal is to never have to interact with the physical model directly. A number of people besides myself have proposed such solutions to this problem, including the estimable Messrs Darwen and Date. My offering is the Constellation Query Language, which is similar to Terry&amp;#39;s FORML and Conquer. I honestly think that such solutions represent &lt;b&gt;the future of data&lt;/b&gt;.&lt;/p&gt;</description></item></channel></rss>