<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>laserdream</title>
	<atom:link href="http://thealx.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thealx.wordpress.com</link>
	<description>moving from the desired to the desirable</description>
	<lastBuildDate>Mon, 30 Mar 2009 17:57:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='thealx.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>laserdream</title>
		<link>http://thealx.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://thealx.wordpress.com/osd.xml" title="laserdream" />
	<atom:link rel='hub' href='http://thealx.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Non-unique rows in SQL</title>
		<link>http://thealx.wordpress.com/2009/03/30/non-unique-rows-in-sql/</link>
		<comments>http://thealx.wordpress.com/2009/03/30/non-unique-rows-in-sql/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 17:57:42 +0000</pubDate>
		<dc:creator>thealx</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thealx.wordpress.com/?p=15</guid>
		<description><![CDATA[I always forget how to do this for no apparent reason: SELECT row1, row2, count(*) AS instances FROM table GROUP BY row1, row2 HAVING count(*) &#62; 1; The sad part is that I do it on a pretty frequent basis&#8230;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=15&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I always forget how to do this for no apparent reason:</p>
<p>SELECT row1, row2, count(*) AS instances FROM table GROUP BY row1, row2 HAVING count(*) &gt; 1;</p>
<p>The sad part is that I do it on a pretty frequent basis&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thealx.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thealx.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thealx.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=15&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thealx.wordpress.com/2009/03/30/non-unique-rows-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a86d0967d76eb8dbae56123c88483055?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thealx</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Order of Operations</title>
		<link>http://thealx.wordpress.com/2009/03/06/sql-order-of-operations/</link>
		<comments>http://thealx.wordpress.com/2009/03/06/sql-order-of-operations/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 20:33:27 +0000</pubDate>
		<dc:creator>thealx</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thealx.wordpress.com/?p=12</guid>
		<description><![CDATA[I know this is rather easy to find, but writing it down helps me remember it: FROM clause WHERE clause GROUP BY clause HAVING clause SELECT clause ORDER BY clause This is extremely useful to keep in mind when you &#8230; <a href="http://thealx.wordpress.com/2009/03/06/sql-order-of-operations/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=12&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I know this is rather easy to find, but writing it down helps me remember it:</p>
<ol>
<li>FROM clause</li>
<li>WHERE clause</li>
<li>GROUP BY clause</li>
<li>HAVING clause</li>
<li>SELECT clause</li>
<li>ORDER BY clause</li>
</ol>
<p>This is extremely useful to keep in mind when you are writing queries.  It can help you keep things a bit more optimized and it is nice to know where things actually start and end.  It is also very useful to view how sql breaks down your query and goes about processing it.</p>
<p>Along these same lines it is useful to know what happens to a query once you hit enter.  Here is what it does in PostgreSQL:</p>
<ol>
<li>Parsing &#8211; PostgreSQL looks at your query and makes sure it is valid before it even starts looking at the data.</li>
<li class="STEP">Rules and Rewrite &#8211; Postgres uses rules to rewrite your query.  This is straight from the PostgreSQL docs &#8211; I couldn&#8217;t come up with a better way to say it.  The <em class="FIRSTTERM">rewrite system</em> takes       the query tree created by the parser stage and looks for       any <em class="FIRSTTERM">rules</em> (stored in the       <em class="FIRSTTERM">system catalogs</em>) to apply to        the query tree.  It performs the       transformations given in the <em class="FIRSTTERM">rule bodies.</em>One application of the rewrite system is in the realization of       <em class="FIRSTTERM">views</em>.       Whenever a query against a view       (i.e. a <em class="FIRSTTERM">virtual table</em>) is made,       the rewrite system rewrites the user&#8217;s query to       a query that accesses the <em class="FIRSTTERM">base tables</em> given in       the <em class="FIRSTTERM">view definition</em> instead.</li>
<li class="STEP">Planning and Optimization &#8211; Postgres looks at the query it rewrote for you and goes about figuring out the best way to execute and does it the fastest way it can figure out.  Again from the docs: After the cheapest path is determined, a full-fledged     <em class="FIRSTTERM">plan tree</em> is built to pass to the executor.</li>
<li class="STEP">Executer &#8211; Finally your code gets executed and returned recursively to you. From the docs: This is essentially a demand-pull pipeline mechanism. Each time a plan node is called, it must deliver one more row, or report that it is done delivering rows.</li>
</ol>
<p>I am sure I will be updating with more DB things soon.  There is much more detail <a title="postgres internals" href="http://www.postgresql.org/docs/8.3/static/internals.html" target="_blank">here</a> on postgres internals.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thealx.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thealx.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thealx.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=12&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thealx.wordpress.com/2009/03/06/sql-order-of-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a86d0967d76eb8dbae56123c88483055?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thealx</media:title>
		</media:content>
	</item>
		<item>
		<title>sql joins</title>
		<link>http://thealx.wordpress.com/2009/02/25/sql-joins/</link>
		<comments>http://thealx.wordpress.com/2009/02/25/sql-joins/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 20:33:45 +0000</pubDate>
		<dc:creator>thealx</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thealx.wordpress.com/?p=3</guid>
		<description><![CDATA[I have been working on sql much more than I care to lately and I ran across a problem. I had a table that had 2 columns referencing the same table and I needed to do a join on each &#8230; <a href="http://thealx.wordpress.com/2009/02/25/sql-joins/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=3&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been working on sql much more than I care to lately and I ran across a problem. I had a table that had 2 columns referencing the same table and I needed to do a join on each column seperately.</p>
<p>The solution:</p>
<p>select t1.id1, t2a.cell, t1.id2, t2b.cell<br />
from table1 as t1<br />
inner join table2 as t2a on t1.id1 = t2a.id<br />
inner join table2 as t2b on t1.id2 = t2b.id;</p>
<p>Fairly simple after all&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thealx.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thealx.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thealx.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thealx.wordpress.com&amp;blog=6733442&amp;post=3&amp;subd=thealx&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thealx.wordpress.com/2009/02/25/sql-joins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a86d0967d76eb8dbae56123c88483055?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thealx</media:title>
		</media:content>
	</item>
	</channel>
</rss>
