<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Interesting SQL Challenge</title>
	<atom:link href="http://blog.onefreevoice.com/2008/11/18/interesting-sql-challenge/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.onefreevoice.com/2008/11/18/interesting-sql-challenge/</link>
	<description>A Blog About Databases and Stuff</description>
	<lastBuildDate>Thu, 02 Feb 2012 04:32:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Gregory Haase</title>
		<link>http://blog.onefreevoice.com/2008/11/18/interesting-sql-challenge/#comment-429</link>
		<dc:creator><![CDATA[Gregory Haase]]></dc:creator>
		<pubDate>Wed, 19 Nov 2008 14:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.onefreevoice.com/?p=122#comment-429</guid>
		<description><![CDATA[I see a couple of issues using the MERGE approach.

First of all, it requires a CREATE statement. Presumably, they would want to add and remove table records on the fly - otherwise there would be no need for a dynamic statement to begin with. I&#039;d be hesitant to have the application DROP and CREATE a table every time a query needs to be run. If you limit the changes to only occurring during a major update - it&#039;s just as easy to skip the whole exercise and just include the UNION in the application itself.

Second, there is no guarantee that the tables have exactly the same column names and indexes.

Regarding the INFORMATION_SCHEMA, you would need to some how identify the tables that you need in the UNION. You might be able to limit it to tables that include some kind of secret/specific column name, but then that&#039;s really a hack! You risk someone coming in and adding that column name to an unrelated table and breaking the query.

Regarding Bill&#039;s comments... after going out and looking up &lt;a href=&quot;http://en.wikipedia.org/wiki/Resource_Description_Framework&quot; rel=&quot;nofollow&quot;&gt;RDF&lt;/a&gt; and &lt;a href=&quot;http://dictionary.reference.com/browse/orthogonally&quot; rel=&quot;nofollow&quot;&gt;orthogonally&lt;/a&gt;...  I come to the conclusion that I&#039;m a.) not storing XML in my database, and b.) not recommending that a developer with only a limited grasp of SQL go out and learn a new meta-language and then go out and learn &lt;a href=&quot;http://en.wikipedia.org/wiki/SPARQL&quot; rel=&quot;nofollow&quot;&gt;SPARQL&lt;/a&gt;.]]></description>
		<content:encoded><![CDATA[<p>I see a couple of issues using the MERGE approach.</p>
<p>First of all, it requires a CREATE statement. Presumably, they would want to add and remove table records on the fly &#8211; otherwise there would be no need for a dynamic statement to begin with. I&#8217;d be hesitant to have the application DROP and CREATE a table every time a query needs to be run. If you limit the changes to only occurring during a major update &#8211; it&#8217;s just as easy to skip the whole exercise and just include the UNION in the application itself.</p>
<p>Second, there is no guarantee that the tables have exactly the same column names and indexes.</p>
<p>Regarding the INFORMATION_SCHEMA, you would need to some how identify the tables that you need in the UNION. You might be able to limit it to tables that include some kind of secret/specific column name, but then that&#8217;s really a hack! You risk someone coming in and adding that column name to an unrelated table and breaking the query.</p>
<p>Regarding Bill&#8217;s comments&#8230; after going out and looking up <a href="http://en.wikipedia.org/wiki/Resource_Description_Framework" rel="nofollow">RDF</a> and <a href="http://dictionary.reference.com/browse/orthogonally" rel="nofollow">orthogonally</a>&#8230;  I come to the conclusion that I&#8217;m a.) not storing XML in my database, and b.) not recommending that a developer with only a limited grasp of SQL go out and learn a new meta-language and then go out and learn <a href="http://en.wikipedia.org/wiki/SPARQL" rel="nofollow">SPARQL</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri K. Cabral</title>
		<link>http://blog.onefreevoice.com/2008/11/18/interesting-sql-challenge/#comment-428</link>
		<dc:creator><![CDATA[Sheeri K. Cabral]]></dc:creator>
		<pubDate>Wed, 19 Nov 2008 10:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.onefreevoice.com/?p=122#comment-428</guid>
		<description><![CDATA[Not a bad hack, though it is a hack, as Bill says.

The biggest issue I see is that you have to update the union_tables data.....I would use a VIEW for that, accessing table names from the INFORMATION_SCHEMA database.

Alternatively, you can also use a MyISAM table for the underlying tables, and a MERGE table for the wrapper table (instead of UNIONs).  There&#039;s still the problem of keeping the MERGE table up to date, but the UNION disappears and now you can also use a fulltext index.]]></description>
		<content:encoded><![CDATA[<p>Not a bad hack, though it is a hack, as Bill says.</p>
<p>The biggest issue I see is that you have to update the union_tables data&#8230;..I would use a VIEW for that, accessing table names from the INFORMATION_SCHEMA database.</p>
<p>Alternatively, you can also use a MyISAM table for the underlying tables, and a MERGE table for the wrapper table (instead of UNIONs).  There&#8217;s still the problem of keeping the MERGE table up to date, but the UNION disappears and now you can also use a fulltext index.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Karwin</title>
		<link>http://blog.onefreevoice.com/2008/11/18/interesting-sql-challenge/#comment-427</link>
		<dc:creator><![CDATA[Bill Karwin]]></dc:creator>
		<pubDate>Tue, 18 Nov 2008 21:29:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.onefreevoice.com/?p=122#comment-427</guid>
		<description><![CDATA[Every time you try to mix data and metadata in SQL, you run into this kind of trouble.  The solutions are fragile and potential security vulnerabilities.  This is not how SQL is intended to be used.

If you want a technology that can query data and metadata orthogonally, use RDF.]]></description>
		<content:encoded><![CDATA[<p>Every time you try to mix data and metadata in SQL, you run into this kind of trouble.  The solutions are fragile and potential security vulnerabilities.  This is not how SQL is intended to be used.</p>
<p>If you want a technology that can query data and metadata orthogonally, use RDF.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

