{"id":3495,"date":"2012-02-17T06:23:00","date_gmt":"2012-02-17T06:23:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/normalisation-and-anima-notitia-copia-soul-of-the-database\/"},"modified":"2016-07-28T10:50:43","modified_gmt":"2016-07-28T10:50:43","slug":"normalisation-and-anima-notitia-copia-soul-of-the-database","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/normalisation-and-anima-notitia-copia-soul-of-the-database\/","title":{"rendered":"Normalisation and &#8216;Anima notitia copia&#8217; (Soul of the Database)"},"content":{"rendered":"<p><i>(A Guest Editorial for Simple-Talk)<\/i><\/p>\n<p>The other day, I was staring&#160; at the <b>sys.syslanguages<\/b>&#160; table in SQL Server with  slightly-raised eyebrows . <\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/blogbits\/philf\/SyssLanguages.PNG\" alt=\"SyssLanguages.PNG\" \/><\/p>\n<p>I&#8217;d just been reading Chris Date&#8217;s&#160; interesting book &#8216;SQL and Relational Theory&#8217;. He&#8217;d  made the point that you&#8217;re not necessarily doing relational database operations by using a SQL Database product.&#160;  The same general point was recently made by Dino Esposito<a href=\"https:\/\/www.red-gate.com\/simple-talk\/dotnet\/asp.net\/a-testing-perspective-of-controllers-and-orchestrators\/\"> about ASP.NET MVC<\/a>.&#160; The use of ASP.NET MVC doesn&#8217;t  guarantee you a good application design: It merely makes it possible to test it. The way I&#8217;d describe the sentiment in  both cases is &#8216;you can hit someone over the head with a frying-pan but you can&#8217;t call it cooking&#8217;. <\/p>\n<p>SQL enables you to create relational databases. However,&#160; even if it smells bad, it is no  crime to do hideously un-relational things with a SQL Database just so long as it&#8217;s necessary and you can tell the  difference; not only that but also only if you&#8217;re aware of the risks and implications. Naturally, I&#8217;ve never knowingly  created a database that Codd would have frowned at, but around the edges are interfaces and data feeds I&#8217;ve written&#160;  that have caused hissy fits amongst the Normalisation fundamentalists. Part of the problem for those who agonise about  such things&#160; is the misinterpretation of Atomicity.&#160; An atomic value is one for which, in the strange virtual  universe you are creating in your database, you don&#8217;t have any interest in any of its component parts.&#160; If you  aren&#8217;t interested in the electrons, neutrinos,&#160; muons,&#160; or&#160; taus, then&#160; an atom is ..er.. atomic. In  the same way, if you are passed a JSON string or XML, and required to store it in a database, then all you need to do is  to ask yourself, in your role as <span class=\"hps\"><em>Anima notitia copia <\/em> <\/span>(Soul of the database) &#8216;have I any interest in the contents of this item of information?&#8217;.&#160; If the  answer is &#8216;No!&#8217;, or &#8216;<em>nequequam<\/em>! Then it is an atomic value, however complex it may be.&#160; After all, you would never  have the urge to store the pixels of images individually, under the misguided idea that these are the atomic values  would you?&#160; I would, of course,&#160; ask the &#8216;<span class=\"hps\">Anima  notitia copia&#8217; rather than the application developers, since there may be more than one application, and the  applications developers may be designing the application in the absence of full domain knowledge, (&#8216;or by the seat of  the pants&#8217; as the technical term used to be). If, on the other hand, the answer is &#8216;sure, and we want to index the XML  column&#8217;, then we may be in for some heavy XML-shredding sessions to get to store the &#8216;atomic&#8217; values and ensure future  harmony as the application develops.<\/span><\/p>\n<p>I went back to looking at the <b>sys.syslanguages<\/b> table. It has a <b>months<\/b> column with the  months in a delimited list <\/p>\n<p>January,February,March,April,May,June,July,August,September,October,November,December<\/p>\n<p>This is an ordered list. Wicked? I seem to remember that this value, like <b>shortmonths <\/b>and <b> days<\/b>, is treated as a &#8216;thing&#8217;. It is merely passed off to an external&#160; C++ routine in order to format a date in  a particular language, and never accessed directly within the database. As far as the database is concerned, it is an  atomic value.&#160; There is more to normalisation than meets the eye.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(A Guest Editorial for Simple-Talk) The other day, I was staring&#160; at the sys.syslanguages&#160; table in SQL Server with slightly-raised eyebrows . I&#8217;d just been reading Chris Date&#8217;s&#160; interesting book &#8216;SQL and Relational Theory&#8217;. He&#8217;d made the point that you&#8217;re not necessarily doing relational database operations by using a SQL Database product.&#160; The same general&#8230;&hellip;<\/p>\n","protected":false},"author":154613,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-3495","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/154613"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=3495"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3495\/revisions"}],"predecessor-version":[{"id":42125,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3495\/revisions\/42125"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=3495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=3495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=3495"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=3495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}