<?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: Finding queries with duplicate columns</title>
	<atom:link href="http://www.xaprb.com/blog/2009/08/07/finding-queries-with-duplicate-columns/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2009/08/07/finding-queries-with-duplicate-columns/</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 09:56:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Shlomi Noach</title>
		<link>http://www.xaprb.com/blog/2009/08/07/finding-queries-with-duplicate-columns/#comment-16727</link>
		<dc:creator>Shlomi Noach</dc:creator>
		<pubDate>Sat, 08 Aug 2009 18:08:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1196#comment-16727</guid>
		<description>But in many cases I don&#039;t fetch results automatically into some hash or dictionary, but rather do rs.getString(&quot;Country.Name&quot;); or rs.getString(&quot;City.Name&quot;); (e.g. in Java).
ORM Frameworks also solve this problem.

Therefore, while I&#039;m using fully qualified column names, there are no duplicates. The relational model stays sane.

What I&#039;m saying is that it&#039;s a very common case. How many tables just have &quot;id&quot; for AUTO_INCREMENT? It&#039;s so common and I&#039;m not sure it doesn&#039;t make sense.</description>
		<content:encoded><![CDATA[<p>But in many cases I don&#8217;t fetch results automatically into some hash or dictionary, but rather do rs.getString(&#8220;Country.Name&#8221;); or rs.getString(&#8220;City.Name&#8221;); (e.g. in Java).<br />
ORM Frameworks also solve this problem.</p>
<p>Therefore, while I&#8217;m using fully qualified column names, there are no duplicates. The relational model stays sane.</p>
<p>What I&#8217;m saying is that it&#8217;s a very common case. How many tables just have &#8220;id&#8221; for AUTO_INCREMENT? It&#8217;s so common and I&#8217;m not sure it doesn&#8217;t make sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2009/08/07/finding-queries-with-duplicate-columns/#comment-16726</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Sat, 08 Aug 2009 17:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1196#comment-16726</guid>
		<description>I said it makes no sense because you can&#039;t tell one from the other.  What happens if you fetch a row from the result into a Perl hash or a Python dictionary...?  What if you wanted to get at the data in one of the Name columns but not the other (assuming their contents differ)?

The relational model is saner here IMO: everything is sets, and sets don&#039;t allow duplicates.  &quot;If something is true, saying it twice doesn&#039;t make it more true.&quot;</description>
		<content:encoded><![CDATA[<p>I said it makes no sense because you can&#8217;t tell one from the other.  What happens if you fetch a row from the result into a Perl hash or a Python dictionary&#8230;?  What if you wanted to get at the data in one of the Name columns but not the other (assuming their contents differ)?</p>
<p>The relational model is saner here IMO: everything is sets, and sets don&#8217;t allow duplicates.  &#8220;If something is true, saying it twice doesn&#8217;t make it more true.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shlomi Noach</title>
		<link>http://www.xaprb.com/blog/2009/08/07/finding-queries-with-duplicate-columns/#comment-16725</link>
		<dc:creator>Shlomi Noach</dc:creator>
		<pubDate>Sat, 08 Aug 2009 13:02:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1196#comment-16725</guid>
		<description>Baron,

The problem you describe can also rise from normal SQL queries, for example (using &#039;world&#039; database):

mysql&gt; select * from (select * from Country join City on (Country.code = City.CountryCode)) as sel1;
ERROR 1060 (42S21): Duplicate column name &#039;Name&#039;

It just happens that both tables have a &#039;Name&#039; column. This is still fine, since with SQL I can always say &#039;SELECT City.Name&#039; explicitly.

So I&#039;m not sure this necessarily falls under &quot;things that make no sense&quot;. Rather, perhaps the &quot;SELECT * FROM (...inner query...) is the problematic part, whereas it cannot be guaranteed to succeed.

It is questionable if every single column should be aliased; but even then collisions may occur.

Regards,
Shlomi</description>
		<content:encoded><![CDATA[<p>Baron,</p>
<p>The problem you describe can also rise from normal SQL queries, for example (using &#8216;world&#8217; database):</p>
<p>mysql&gt; select * from (select * from Country join City on (Country.code = City.CountryCode)) as sel1;<br />
ERROR 1060 (42S21): Duplicate column name &#8216;Name&#8217;</p>
<p>It just happens that both tables have a &#8216;Name&#8217; column. This is still fine, since with SQL I can always say &#8216;SELECT City.Name&#8217; explicitly.</p>
<p>So I&#8217;m not sure this necessarily falls under &#8220;things that make no sense&#8221;. Rather, perhaps the &#8220;SELECT * FROM (&#8230;inner query&#8230;) is the problematic part, whereas it cannot be guaranteed to succeed.</p>
<p>It is questionable if every single column should be aliased; but even then collisions may occur.</p>
<p>Regards,<br />
Shlomi</p>
]]></content:encoded>
	</item>
</channel>
</rss>

