<?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: a sql quiz + is a lower hourly rate cheaper?	</title>
	<atom:link href="https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/</link>
	<description>Java/J2EE Software Development and Technology Discussion Blog</description>
	<lastBuildDate>Thu, 21 Apr 2011 21:25:34 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>
	<item>
		<title>
		By: Jeanne Boyarsky		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3571</link>

		<dc:creator><![CDATA[Jeanne Boyarsky]]></dc:creator>
		<pubDate>Thu, 03 Mar 2011 02:56:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3571</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3570&quot;&gt;Hauke Ingmar&lt;/a&gt;.

I don&#039;t know that I&#039;d use an interview question that I posted the answer to on the internet, but good idea.  Or maybe it would show research skills :).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3570">Hauke Ingmar</a>.</p>
<p>I don&#8217;t know that I&#8217;d use an interview question that I posted the answer to on the internet, but good idea.  Or maybe it would show research skills :).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hauke Ingmar		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3570</link>

		<dc:creator><![CDATA[Hauke Ingmar]]></dc:creator>
		<pubDate>Wed, 02 Mar 2011 23:39:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3570</guid>

					<description><![CDATA[If you want to use this test in other situations (e.g. interview) you could split the SQL string into different strings for the select clause, the from clause and so on, e.g. String selectClause =&quot;select count(*)&quot;, fromClause = &quot;from table2&quot;; String sql = selectClause + fromClause;
This is not uncommon (as long as building SQL queries with strings within the code is common), does not look wrong at the first glance and it obscures the missing space problem nicely - the unneeded string concatenation draws attention.]]></description>
			<content:encoded><![CDATA[<p>If you want to use this test in other situations (e.g. interview) you could split the SQL string into different strings for the select clause, the from clause and so on, e.g. String selectClause =&#8221;select count(*)&#8221;, fromClause = &#8220;from table2&#8221;; String sql = selectClause + fromClause;<br />
This is not uncommon (as long as building SQL queries with strings within the code is common), does not look wrong at the first glance and it obscures the missing space problem nicely &#8211; the unneeded string concatenation draws attention.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jeanne Boyarsky		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3567</link>

		<dc:creator><![CDATA[Jeanne Boyarsky]]></dc:creator>
		<pubDate>Tue, 01 Mar 2011 00:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3567</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3566&quot;&gt;Ulf&lt;/a&gt;.

You&#039;re right!  I was all set to &quot;prove&quot; it throws &quot;resultset already closed&quot; exception.  But it doesn&#039;t.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3566">Ulf</a>.</p>
<p>You&#8217;re right!  I was all set to &#8220;prove&#8221; it throws &#8220;resultset already closed&#8221; exception.  But it doesn&#8217;t.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ulf		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3566</link>

		<dc:creator><![CDATA[Ulf]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 07:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3566</guid>

					<description><![CDATA[Switching around stmt.close() and rs.close() doesn&#039;t provide anything functionally, though. Closing the Statement also closes the underlying ResultSet, and trying to close an already closed ResultSet doesn&#039;t harm. So maybe having &quot;rs.close()&quot; in there at all is wrong (although not an error).]]></description>
			<content:encoded><![CDATA[<p>Switching around stmt.close() and rs.close() doesn&#8217;t provide anything functionally, though. Closing the Statement also closes the underlying ResultSet, and trying to close an already closed ResultSet doesn&#8217;t harm. So maybe having &#8220;rs.close()&#8221; in there at all is wrong (although not an error).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jeanne Boyarsky		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3565</link>

		<dc:creator><![CDATA[Jeanne Boyarsky]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 01:40:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3565</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3563&quot;&gt;EFH&lt;/a&gt;.

EFH: True.  Let&#039;s assume that the person was told to use a PreparedStatement either by a corporate coding standard or by copy/paste reuse :).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3563">EFH</a>.</p>
<p>EFH: True.  Let&#8217;s assume that the person was told to use a PreparedStatement either by a corporate coding standard or by copy/paste reuse :).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: EFH		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3563</link>

		<dc:creator><![CDATA[EFH]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 01:36:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3563</guid>

					<description><![CDATA[The person truly new to JDBC would not have used PreparedStatement, but put the query together with string catenation -- probably having even more errors with spaces and quotes and such!]]></description>
			<content:encoded><![CDATA[<p>The person truly new to JDBC would not have used PreparedStatement, but put the query together with string catenation &#8212; probably having even more errors with spaces and quotes and such!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jeanne Boyarsky		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3562</link>

		<dc:creator><![CDATA[Jeanne Boyarsky]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 01:28:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3562</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3561&quot;&gt;Hauke Ingmar&lt;/a&gt;.

Hauke: Good ones!  I didn&#039;t think about that when I obscured away the real table names.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3561">Hauke Ingmar</a>.</p>
<p>Hauke: Good ones!  I didn&#8217;t think about that when I obscured away the real table names.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hauke Ingmar		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3561</link>

		<dc:creator><![CDATA[Hauke Ingmar]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 01:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3561</guid>

					<description><![CDATA[&quot;table&quot; and &quot;column&quot; are reserved SQL keywords and should either be quoted when used as identifiers or will not work at all, depending on the database system used.]]></description>
			<content:encoded><![CDATA[<p>&#8220;table&#8221; and &#8220;column&#8221; are reserved SQL keywords and should either be quoted when used as identifiers or will not work at all, depending on the database system used.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sqlfreek		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3560</link>

		<dc:creator><![CDATA[sqlfreek]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 00:35:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3560</guid>

					<description><![CDATA[1. &quot;from tablewhere&quot; is not going to work
2. The first statement/resultset is not closed
3. finally might raise a NullPointerException in some cases where the first prepareStatement failed.]]></description>
			<content:encoded><![CDATA[<p>1. &#8220;from tablewhere&#8221; is not going to work<br />
2. The first statement/resultset is not closed<br />
3. finally might raise a NullPointerException in some cases where the first prepareStatement failed.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jeanne Boyarsky		</title>
		<link>https://www.selikoff.net/2011/02/27/a-sql-quiz-is-a-lower-hourly-rate-cheaper/comment-page-1/#comment-3559</link>

		<dc:creator><![CDATA[Jeanne Boyarsky]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 00:29:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.selikoff.net/?p=2731#comment-3559</guid>

					<description><![CDATA[SQL quiz answers:
1) The sql statements are missing a space before the word &quot;where&quot;.  SQL doesn&#039;t know we&#039;ve ended the table name without that space.
2) Missing rs.next() before calling rs.getInt()
3) The first statement is never closed.  Waiting for the garbage collector is risky because we could run out or resources first.
4) If the code fails before the statement and/or resultset are created, the finally block will fail with a null pointer - obscuring the real error.
5) The stmt and rs close calls are in the wrong order.]]></description>
			<content:encoded><![CDATA[<p>SQL quiz answers:<br />
1) The sql statements are missing a space before the word &#8220;where&#8221;.  SQL doesn&#8217;t know we&#8217;ve ended the table name without that space.<br />
2) Missing rs.next() before calling rs.getInt()<br />
3) The first statement is never closed.  Waiting for the garbage collector is risky because we could run out or resources first.<br />
4) If the code fails before the statement and/or resultset are created, the finally block will fail with a null pointer &#8211; obscuring the real error.<br />
5) The stmt and rs close calls are in the wrong order.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
