<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Beyond SELECT &#8212; Part 1: Constraints</title>
	<atom:link href="http://mathieu.fenniak.net/beyond_select_part1/feed/" rel="self" type="application/rss+xml" />
	<link>http://mathieu.fenniak.net/beyond_select_part1/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Mar 2009 04:37:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: omul</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-92</link>
		<dc:creator>omul</dc:creator>
		<pubDate>Mon, 27 Aug 2007 08:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-92</guid>
		<description>Since I finally understood the constraint basics, I find it very useful. Thanks!</description>
		<content:encoded><![CDATA[<p>Since I finally understood the constraint basics, I find it very useful. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brandon mcginty</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-91</link>
		<dc:creator>brandon mcginty</dc:creator>
		<pubDate>Sun, 24 Dec 2006 16:14:53 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-91</guid>
		<description>Wonderful job.
Have been looking for this kind of tutorial for quite a long time.
Thanks Much!</description>
		<content:encoded><![CDATA[<p>Wonderful job.<br />
Have been looking for this kind of tutorial for quite a long time.<br />
Thanks Much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peteris Krumins</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-90</link>
		<dc:creator>Peteris Krumins</dc:creator>
		<pubDate>Sat, 19 Aug 2006 06:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-90</guid>
		<description>I wear socks with sandles and I have no idea why it is considered geeky.
It is much more comfortable with socks than without.</description>
		<content:encoded><![CDATA[<p>I wear socks with sandles and I have no idea why it is considered geeky.<br />
It is much more comfortable with socks than without.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathieu Fenniak</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-89</link>
		<dc:creator>Mathieu Fenniak</dc:creator>
		<pubDate>Mon, 14 Aug 2006 14:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-89</guid>
		<description>Reinier - Thank you for your comments.

Regarding keys - I have stated multiple times in this article that integer primary keys are a useful tool and that I would recommend them in a variety of scenarios.  In fact, I even showed the use of a secondary key by using an integer primary key and a unique constraint on the SSN field, just as you suggested.

Regarding CHECK - I am aware that it is not supported in all database engines.  As far as I know, it is not supported in MySQL, as already stated in this article.  I believe the place for this kind of verification is in the database, in the middleware if applicable, and in the client application.  Data integrity is more important to me than &#039;portable&#039; SQL.

I do not appreciate your comment, &quot;Google for &#039;database normal form&#039; and learn something useful&quot;.  I do know many useful things.  I know how to tie my shoes.  I know how to purchase velcro shoes to avoid tying my shoes.  I know how to buy sandles to avoid using velcro.  I know not to wear socks with sandles (my wife taught me).  And I know what database normal forms are.

And finally, notice that this is part 1 of a series of articles.  Part 1 is entitled &quot;Constraints&quot;.  I intend to write a great deal more that includes many of the topics you have suggested.  I do not intend to write about database normalization -- it does not fit in with this article&#039;s topic of just-past-basic SQL.

And yes, Oracle certainly does have the dumbest implementation (or lack-thereof) of LIMIT/OFFSET -- at least we agree on that. ;)</description>
		<content:encoded><![CDATA[<p>Reinier &#8211; Thank you for your comments.</p>
<p>Regarding keys &#8211; I have stated multiple times in this article that integer primary keys are a useful tool and that I would recommend them in a variety of scenarios.  In fact, I even showed the use of a secondary key by using an integer primary key and a unique constraint on the SSN field, just as you suggested.</p>
<p>Regarding CHECK &#8211; I am aware that it is not supported in all database engines.  As far as I know, it is not supported in MySQL, as already stated in this article.  I believe the place for this kind of verification is in the database, in the middleware if applicable, and in the client application.  Data integrity is more important to me than &#8216;portable&#8217; SQL.</p>
<p>I do not appreciate your comment, &#8220;Google for &#8216;database normal form&#8217; and learn something useful&#8221;.  I do know many useful things.  I know how to tie my shoes.  I know how to purchase velcro shoes to avoid tying my shoes.  I know how to buy sandles to avoid using velcro.  I know not to wear socks with sandles (my wife taught me).  And I know what database normal forms are.</p>
<p>And finally, notice that this is part 1 of a series of articles.  Part 1 is entitled &#8220;Constraints&#8221;.  I intend to write a great deal more that includes many of the topics you have suggested.  I do not intend to write about database normalization &#8212; it does not fit in with this article&#8217;s topic of just-past-basic SQL.</p>
<p>And yes, Oracle certainly does have the dumbest implementation (or lack-thereof) of LIMIT/OFFSET &#8212; at least we agree on that. <img src='http://mathieu.fenniak.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reinier Zwitserloot</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-88</link>
		<dc:creator>Reinier Zwitserloot</dc:creator>
		<pubDate>Fri, 11 Aug 2006 23:42:49 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-88</guid>
		<description>I don&#039;t particularly like this tutorial. First you do away with a simple integer counter as primary key, and then later you convolute the primary key into a combination of SSN and country. That&#039;s -really- annoying: Let&#039;s say I want to pass a reference to a person around in my application. Whatever way you turn this, the easiest thing you can possibly do here is to just pass the tuple (tableName, integer) which uniquely identifies -ANY- record so long as all records always have a primary key that&#039;s an integer, and that has a unique field name (Let&#039;s say, they are always called &#039;unid&#039;). Now if this new bit of code actually needs the data, a simple select will get it, quickly, because the primary key is guaranteed to be indexed (and ints index quickest and with the smallest overhead, computers being what they are).

That&#039;s simply not a useful abstraction - you&#039;re gaining a tiny amount of speed and size (but in some cases actually you lose some, ie with a composite primary key) but you are making development a lot more difficult. You can always add a different type of constraint (like a second key on the SSN/country pair to ensure they remain unique) or you can build this constraint outside of the dbase server. Whatever happends to work nicest.

Moving on, stuff like &#039;CHECK&#039; doesn&#039;t work in all database engines and where it does, notation tends to be different. The nice thing about just making a simple SELECT and doing whatever extra checks you need outside the dbase schema is that you end up with very simple &#039;portable&#039; SQL. For high load huge schemas at some point you will just have to start designing to the strengths of the specific dbase app you are using, or commit to adding a LOT of metadata for some big iron middle layer like Java Hibernate or some such. Once you elect to go middleware these tutorials become effectively pointless.

Google for &#039;database normal form&#039; and learn something useful. Alternatively, talk about basic dbase calculations in the form of SUM and JOIN - both of those, once you grok them, can help really speed up queries significantly, something that using the natural key as primary key never will. Also talk about how you can add indices to speed up selects on those specific fields, and perhaps hint at using the database local variant of TOP/LIMIT, which restricts output to a limited number of fields, just in case you actually just put in a query for an entire (huge) dbase table, freezing up the system for quite a hwile. (unfortunately the exact keyword tends to differ between dbase engines. Extra points for oracle for being the dumbest implementation of that ever. It&#039;s something like WHERE columnid  100 and columnid</description>
		<content:encoded><![CDATA[<p>I don&#8217;t particularly like this tutorial. First you do away with a simple integer counter as primary key, and then later you convolute the primary key into a combination of SSN and country. That&#8217;s -really- annoying: Let&#8217;s say I want to pass a reference to a person around in my application. Whatever way you turn this, the easiest thing you can possibly do here is to just pass the tuple (tableName, integer) which uniquely identifies -ANY- record so long as all records always have a primary key that&#8217;s an integer, and that has a unique field name (Let&#8217;s say, they are always called &#8216;unid&#8217;). Now if this new bit of code actually needs the data, a simple select will get it, quickly, because the primary key is guaranteed to be indexed (and ints index quickest and with the smallest overhead, computers being what they are).</p>
<p>That&#8217;s simply not a useful abstraction &#8211; you&#8217;re gaining a tiny amount of speed and size (but in some cases actually you lose some, ie with a composite primary key) but you are making development a lot more difficult. You can always add a different type of constraint (like a second key on the SSN/country pair to ensure they remain unique) or you can build this constraint outside of the dbase server. Whatever happends to work nicest.</p>
<p>Moving on, stuff like &#8216;CHECK&#8217; doesn&#8217;t work in all database engines and where it does, notation tends to be different. The nice thing about just making a simple SELECT and doing whatever extra checks you need outside the dbase schema is that you end up with very simple &#8216;portable&#8217; SQL. For high load huge schemas at some point you will just have to start designing to the strengths of the specific dbase app you are using, or commit to adding a LOT of metadata for some big iron middle layer like Java Hibernate or some such. Once you elect to go middleware these tutorials become effectively pointless.</p>
<p>Google for &#8216;database normal form&#8217; and learn something useful. Alternatively, talk about basic dbase calculations in the form of SUM and JOIN &#8211; both of those, once you grok them, can help really speed up queries significantly, something that using the natural key as primary key never will. Also talk about how you can add indices to speed up selects on those specific fields, and perhaps hint at using the database local variant of TOP/LIMIT, which restricts output to a limited number of fields, just in case you actually just put in a query for an entire (huge) dbase table, freezing up the system for quite a hwile. (unfortunately the exact keyword tends to differ between dbase engines. Extra points for oracle for being the dumbest implementation of that ever. It&#8217;s something like WHERE columnid  100 and columnid</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Lai</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-87</link>
		<dc:creator>Jason Lai</dc:creator>
		<pubDate>Fri, 11 Aug 2006 21:16:49 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-87</guid>
		<description>Pretty good introduction. I&#039;m looking forward to the next installment.</description>
		<content:encoded><![CDATA[<p>Pretty good introduction. I&#8217;m looking forward to the next installment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Elisei</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-86</link>
		<dc:creator>Ryan Elisei</dc:creator>
		<pubDate>Fri, 11 Aug 2006 19:52:54 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-86</guid>
		<description>This is a great tutorial, especially for PostgreSQL.

I think it&#039;s a good idea to also introduce the concept that data validation often happens at the application level. Perhaps even discuss the pro&#039;s and con&#039;s.

Very nice work.</description>
		<content:encoded><![CDATA[<p>This is a great tutorial, especially for PostgreSQL.</p>
<p>I think it&#8217;s a good idea to also introduce the concept that data validation often happens at the application level. Perhaps even discuss the pro&#8217;s and con&#8217;s.</p>
<p>Very nice work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Sparks</title>
		<link>http://mathieu.fenniak.net/beyond_select_part1/comment-page-1/#comment-85</link>
		<dc:creator>Ian Sparks</dc:creator>
		<pubDate>Fri, 11 Aug 2006 19:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://mathieu.fenniak.net/beyond_select_part1/#comment-85</guid>
		<description>Nice tutorial. I think it&#039;s important to stress that constraints are part of your business logic and you should be careful not to add them prematurely. They can also be a pain during data migrations or changes to the schema because they will require you to enter a row in tableA before you can add any rows to tableB and that can be very inconvenient and limit your options.

If you&#039;re building a database for an application and you know what the business rules are go ahead and put in your constraints. If you&#039;re still feeling your way and the busines rules are not really known yet, stay loose - you can always add them in later once the requirements are firm.</description>
		<content:encoded><![CDATA[<p>Nice tutorial. I think it&#8217;s important to stress that constraints are part of your business logic and you should be careful not to add them prematurely. They can also be a pain during data migrations or changes to the schema because they will require you to enter a row in tableA before you can add any rows to tableB and that can be very inconvenient and limit your options.</p>
<p>If you&#8217;re building a database for an application and you know what the business rules are go ahead and put in your constraints. If you&#8217;re still feeling your way and the busines rules are not really known yet, stay loose &#8211; you can always add them in later once the requirements are firm.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
