<?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>ReadVitamin</title>
	<atom:link href="http://readvitamin.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://readvitamin.wordpress.com</link>
	<description>Nutrition For The Brain.</description>
	<lastBuildDate>Sat, 06 Oct 2007 00:02:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='readvitamin.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ReadVitamin</title>
		<link>http://readvitamin.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://readvitamin.wordpress.com/osd.xml" title="ReadVitamin" />
	<atom:link rel='hub' href='http://readvitamin.wordpress.com/?pushpress=hub'/>
		<item>
		<title>What the Boss, seeks in your Resume</title>
		<link>http://readvitamin.wordpress.com/2007/10/05/what-the-boss-seeks-in-your-resume/</link>
		<comments>http://readvitamin.wordpress.com/2007/10/05/what-the-boss-seeks-in-your-resume/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 23:59:04 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/10/05/what-the-boss-seeks-in-your-resume/</guid>
		<description><![CDATA[When I last sat down to update my resume, I Googled a bit and found a lot of good write ups on How to write a good resume, tips on a good resume/profile etc. But I could not find why? Why I should compile a resume and what lies in there which would impress my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=86&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:black;font-family:Verdana;"><font size="2">When I last sat down to update my resume, I Googled a bit and found a lot of good write ups on How to write a good resume, tips on a good resume/profile etc. But I could not find why? Why I should compile a resume and what lies in there which would impress my future Boss. In other wards, what would my future Boss look in for in my resume and get impressed? Looks like a catch 22 situation, well to some extent, it is. But again think of a situation when you want to hire someone, would not you like to pick the best. Same is the case if you want yourself to be chosen.</font></span></p>
<p><span style="color:black;font-family:Verdana;"><font size="2">As you know, a good resume should provide valuable insights about the job applicant which can help the hirer to determine whether she/he should be considered for the given open position. Likewise, when the employer looks at your resume, she/he should be given those ‘valuable insights’ right away, neatly and clearly. When I say clearly, it does not mean big fonts with double spacing, what I mean is “understandably”.</font></span></p>
<p><span style="color:black;font-family:Verdana;"><font size="2">When your future Boss scans through your resume, generally she/he notes down all the striking points which causes her/him to think, “You are really a good fit for the job” but also, sometimes, if the person does not sees that spark in your profile, do not get the impression that your chance is gone, your information might be kept for further analysis. So what is that the Manager looks for, here is a small list of observations.</font></span></p>
<p><span style="color:black;font-family:Verdana;"><span><font size="2">1.</font><span style="font:7pt 'Times New Roman';">  </span></span></span><font size="2"><strong><span style="color:black;font-family:Verdana;">Objective</span></strong><span style="color:black;font-family:Verdana;">: One of the first points that any good employer would be interested in, is what the Objective of the candidate and how specific it is to the rest of the resume. Whether it reflects that you have certain a goal in mind which this job would provide. If your objectives are not clearly mentioned, it would give an indication that you are not sure of what and why you want this job, and it will also send signal that you just applied to take a shot at it.</span></font></p>
<p><span style="color:black;font-family:Verdana;"><span><font size="2">2.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><font size="2"><strong><span style="color:black;font-family:Verdana;">Over all Organization</span></strong><span style="color:black;font-family:Verdana;">: When you have a nicely organized write up and it is easy to read, it helps a lot in making out that you are eager to good communication and you value what you write. Avoid spelling or grammatical errors, as you know a resume are the first communication to the employer, if it does not make any sense from reading, you have almost lost your chance.</span></font></p>
<p><font size="2"><span style="color:black;font-family:Verdana;"></span></font><span style="color:black;font-family:Verdana;"><span><font size="2">3.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">Listing some of your Accomplishments.</font></span></p>
<p><span style="color:black;font-family:Verdana;"></span><span style="color:black;font-family:Verdana;"><span><font size="2">4.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">Showing a consistent growth throughout your career.</font></span></p>
<p><span style="color:black;font-family:Verdana;"></span><span style="color:black;font-family:Verdana;"><span><font size="2">5.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">Demonstrating appropriate professionalism.</font></span></p>
<p><span style="color:black;font-family:Verdana;"></span><span style="color:black;font-family:Verdana;"><span><font size="2">6.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">Worked successfully in a Team.</font></span></p>
<p><span style="color:black;font-family:Verdana;"></span><span style="color:black;font-family:Verdana;"><span><font size="2">7.</font><span style="font:7pt 'Times New Roman';"> </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">Shown Interest in taking responsibility</font></span></p>
<p><span style="color:black;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/86/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/86/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=86&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/10/05/what-the-boss-seeks-in-your-resume/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>How to display multiple Answerset windows in SQL Assistant.</title>
		<link>http://readvitamin.wordpress.com/2007/10/01/how-to-display-multiple-answerset-windows-in-sql-assistant/</link>
		<comments>http://readvitamin.wordpress.com/2007/10/01/how-to-display-multiple-answerset-windows-in-sql-assistant/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 23:44:31 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/10/01/how-to-display-multiple-answerset-windows-in-sql-assistant/</guid>
		<description><![CDATA[If you are new to Teradata SQL Assistant and would like to see your query results appear in multiple answerset windows rather than getting overwritten. Here is a way to do it. 1)     Click on Tools. 2)     Click on Options. 3)     Click on the ‘General’ tab. 4)     Off the 4 check box options, select the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=84&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">If you are new to Teradata SQL Assistant and would like to see your query results appear in multiple answerset windows rather than getting overwritten. Here is a way to do it.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>1)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Click on Tools.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>2)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Click on Options.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>3)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Click on the ‘General’ tab.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>4)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Off the 4 check box options, select the following:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>a.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">Allow Multiple Queries</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>b.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">Close Answerset windows before submitting a new query.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>5)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">You would also see a set of radio button choices with the following label:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>a.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">User Separate Answerset Windows for</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span><span style="font:7pt 'Times New Roman';">                                                              </span>i.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">Each Resultset.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span><span style="font:7pt 'Times New Roman';">                                                             </span>ii.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">Each Query</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span><span style="font:7pt 'Times New Roman';">                                                           </span>iii.<span style="font:7pt 'Times New Roman';">      </span></span></span><span style="font-size:10pt;font-family:Verdana;">Never</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>6)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Choose “Each Resultset”.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>7)<span style="font:7pt 'Times New Roman';">     </span></span></span><span style="font-size:10pt;font-family:Verdana;">Click OK.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Submit the following two queries with semicolon present at the end of 1<sup>st</sup> query.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><em><span style="font-size:10pt;font-family:Verdana;"><span>a.<span style="font:7pt 'Times New Roman';">      </span></span></span></em><em><span style="font-size:10pt;font-family:Verdana;">select date;</span></em></p>
<p><em><span style="font-size:10pt;font-family:Verdana;"></span></em><em><span style="font-size:10pt;font-family:Verdana;"><span>b.<span style="font:7pt 'Times New Roman';">      </span></span></span></em><em><span style="font-size:10pt;font-family:Verdana;">select time</span></em></p>
<p><span style="font-size:10pt;font-family:Verdana;">The result set would be displayed in two separate windows.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">In this “General” tab, you can also specify the string you want to display when a NULL data appears (by default it is ‘?’). Look for the label “Display this string for Null data fields” and put your favorite word in the text box present next to it.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/84/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/84/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=84&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/10/01/how-to-display-multiple-answerset-windows-in-sql-assistant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Outer Joins in Teradata</title>
		<link>http://readvitamin.wordpress.com/2007/09/28/outer-joins-in-teradata/</link>
		<comments>http://readvitamin.wordpress.com/2007/09/28/outer-joins-in-teradata/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 23:13:46 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/09/28/outer-joins-in-teradata/</guid>
		<description><![CDATA[The Outer Join is an extension of the Inner Join which includes both rows that qualify for a simple Inner Join as well as a specified set of rows that do NOT match the join conditions mentioned in the query. This is the reason sometimes it gets a bit complicated to code the Outer Joins [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=83&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">The Outer Join is an extension of the Inner Join which includes both rows that qualify for a </span><span style="font-size:10pt;font-family:Verdana;">simple Inner Join as well as a specified set of rows that do NOT match the join conditions </span><span style="font-size:10pt;font-family:Verdana;">mentioned in the query. This is the reason sometimes it gets a bit complicated to code the Outer Joins correctly. </span><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">There are three types of outer joins:</span><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<ol>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Left Table (Left Outer Join).</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Right Table (Right Outer Join).</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Both Tables (Full Outer Join).</span></li>
</ol>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></p>
<p style="margin:0;" class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">As mentioned before the sole purpose of an OUTER JOIN is to find and return rows that do NOT match at least one row from another table. It is something like an “exception” reporting, but at the same time, it does the INNER JOIN processing too. Therefore, the matching rows are returned along with all rows without a matching value from another table, which might be due to the existence of a NULL or invalid data values.</span></p>
<p style="margin:0;" class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><u><span style="font-size:10pt;font-family:Verdana;">1. Left Table (Left Outer Join).</span></u></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">In any Outer Join it is very important to know which table is Outer table; this is the table that decides the how the rows (matching as well as non-matching) would be returned. In a Left Outer Join, the table that is mentioned at the left position to the key word &#8220;Left Outer Join&#8221; is the outer table. This means the non-matching rows would be returned from this table. For example, </span></span></p>
<p></span></span><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"></p>
<pre><span style="font-family:Verdana;"><font size="2">Table A<span>                             </span><span>        </span><span> </span>Table B</font></span></pre>
<pre><span style="font-family:Verdana;"></span></pre>
<table border="1" align="left" cellPadding="0" cellSpacing="0" style="border-collapse:collapse;border:medium none;margin:auto 6.75pt;" class="MsoTableGrid">
<tr>
<td vAlign="top" style="background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F1</font></span></strong></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:windowtext 1pt solid;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F2</font></span></strong></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:windowtext 1pt solid;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F3</font></span></strong></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">AA</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">1</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">A1</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">BB</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">2</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">B2</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">CC</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">3</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">C3</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">DD</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">4</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">D4</font></span></pre>
</td>
</tr>
</table>
<table border="1" cellPadding="0" cellSpacing="0" style="border-collapse:collapse;border:medium none;margin:auto auto auto 179.6pt;" class="MsoTableGrid">
<tr>
<td vAlign="top" style="background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F1</font></span></strong></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:windowtext 1pt solid;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F2</font></span></strong></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:windowtext 1pt solid;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><strong><span style="font-family:Verdana;"><font size="2">F3</font></span></strong></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">CC</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">3</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">C3</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">DD</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">4</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">D4</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">EE</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">5</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">E5</font></span></pre>
</td>
</tr>
<tr>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:windowtext 1pt solid;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">FF</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">6</font></span></pre>
</td>
<td vAlign="top" style="border-right:windowtext 1pt solid;border-top:#ece9d8;border-left:#ece9d8;border-bottom:windowtext 1pt solid;background-color:transparent;padding:0 5.4pt;">
<pre><span style="font-family:Verdana;"><font size="2">F6</font></span></pre>
</td>
</tr>
</table>
<pre><span style="font-family:Verdana;"> </span></pre>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT A.f1 OuterCol, B.f1 InnerCol</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM A LEFT OUTER JOIN B</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">ON A.f1 = B.f1</span></p>
<pre><span style="font-family:Verdana;"></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">The above query would return:</font></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">OuterCol<span>             </span>InnerCol</font></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">DD<span>         </span><span>            </span>DD</font></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">AA<span>         </span><span>            </span><strong>NULL</strong></font></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">CC<span>         </span><span>            </span>CC</font></span></pre>
<pre><span style="font-family:Verdana;"><font size="2">BB<span>         </span><span>            </span><strong>NULL</strong></font></span></pre>
<p><span style="font-size:10pt;font-family:Verdana;">See the NULL values appearing in the inner table, a further addition of a WHERE condition,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT A.f1 OuterCol, B.f1 InnerCol</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM A LEFT OUTER JOIN B</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">ON<span>  </span>A.f1 = B.f1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">WHERE A.F1 = &#8216;AA&#8217;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Would return the following result.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">OuterCol<span>        </span>InnerCol</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">AA<span>      </span><span>          </span><strong>NULL</strong></span></p>
<p style="margin:0;" class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"></span></span></p>
<p></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"><u><span style="font-size:10pt;font-family:Verdana;">Right Table (Right Outer Join).</span></u><span style="font-size:10pt;font-family:Verdana;"> </span></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">In a Right Outer Join, the table that is mentioned at the right position to the key word “Right Outer Join” is the outer table. This means the non-matching rows would be returned from this table. For example, <br />
</span><span style="font-size:10pt;font-family:Verdana;"> </span></span></span><span style="font-size:10pt;font-family:Verdana;"><span style="font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">SELECT A.f1 OuterCol, B.f1 InnerCol</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM A RIGHT OUTER JOIN B</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">ON A.f1 = B.f1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">OuterCol<span>        </span>InnerCol</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">NULL</span></strong><span style="font-size:10pt;font-family:Verdana;"><span>  </span><span>          </span><strong>FF</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">DD<span>      </span><span>          </span>DD</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">NULL</span></strong><span style="font-size:10pt;font-family:Verdana;"><span>  </span><span>          </span><strong>EE</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">CC<span>      </span><span>          </span>CC</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">But notice that neither of the following queries would return any rows as the value ‘AA’ is not present in the outer table (B).</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><br />
SELECT A.f1 OuterCol, B.f1 InnerCol<br />
FROM A RIGHT OUTER JOIN B<br />
ON A.f1 = B.f1<br />
WHERE A.F1 = &#8216;AA&#8217;</p>
<p>SELECT A.f1 OuterCol, B.f1 InnerCol<br />
FROM A right outer JOIN B<br />
ON A.f1 = B.f1<br />
WHERE B.F1 = &#8216;AA&#8217;</p>
<p></span><u><span style="font-size:10pt;font-family:Verdana;">Both Tables (Full Outer Join).</span></u><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana;">In a Full Outer Join, both the tables that are mentioned at both sides of the key word Full Outer Join are the outer tables. This means the non-matching rows would be returned from both the tables. For example,<br />
 </span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT A.f1 OuterColA, B.f1 OuterColB</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM a full outer JOIN b</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">ON A.f1 = B.f1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">OuterColA<span>      </span>OuterColB</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">NULL<span>   </span>FF</span></strong></p>
<p><strong><span style="font-size:10pt;font-family:Verdana;"></span></strong><span style="font-size:10pt;font-family:Verdana;">DD<span>      </span>DD</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">AA<span>       </span>NULL</span></strong></p>
<p><strong><span style="font-size:10pt;font-family:Verdana;"></span></strong><strong><span style="font-size:10pt;font-family:Verdana;">NULL<span>   </span>EE</span></strong></p>
<p><strong><span style="font-size:10pt;font-family:Verdana;"></span></strong><span style="font-size:10pt;font-family:Verdana;">CC<span>      </span>CC</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">BB<span>       </span>NULL</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana;">Unlike the Right Outer Join, if you run the following query you would see the resulted row which would be similar to that of inner join query. This happens because the table A is also treated as an Outer table.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT A.f1 OuterColA, B.f1 OuterColB</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM a full outer JOIN b</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">ON<span>  </span>A.f1 = B.f1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">WHERE a.F1 = &#8216;AA&#8217;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">OuterCol<span>        </span>OuterColB</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">AA<span>                   </span>NULL</span></strong></p>
<p align="left"><strong><span style="font-size:10pt;font-family:Verdana;"></span></strong></p>
<p></span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/83/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/83/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=83&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/09/28/outer-joins-in-teradata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Inner Joins in Teradata.</title>
		<link>http://readvitamin.wordpress.com/2007/09/06/inner-joins-in-teradata/</link>
		<comments>http://readvitamin.wordpress.com/2007/09/06/inner-joins-in-teradata/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 23:57:11 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/09/06/inner-joins-in-teradata/</guid>
		<description><![CDATA[As discussed previously, in Teradata we have the following types of Inner Joins.  Ordinary Inner Join Cross Join Self-Join  Let’s discuss how they are different from each other and how to use them. Ordinary Inner Join: - As you know, JOIN allows you to select common columns and rows from two or more tables/views, similarly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=82&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">As discussed previously, in Teradata we have the following types of Inner Joins.</span><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<ol>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Ordinary Inner Join</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Cross Join</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Self-Join</span></li>
</ol>
<p><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">Let’s discuss how they are different from each other and how to use them.</span></p>
<p><u><span style="font-size:10pt;font-family:Verdana;">Ordinary Inner Join: -</span></u><span style="font-size:10pt;font-family:Verdana;"> As you know, JOIN allows you to select common columns and rows from two or more tables/views, similarly in an <span>inner </span>join, common data from two or more tables/views are returned which meets this specific common conditions. Let’s understand this concept with the help of SET rules in Algebra. We have the following two sets:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">A = {1, 2, 3, 4, 5}</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">B = {4, 5, 6, 7, 8}</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">When you do a JOIN between A and B considering them as tables, only the common element present in them would be returned. In this case it is {4, 5}. This can be derived by the set rule “Intersection”.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">So, “A JOIN B” is similar to “A intersection B”. Remember that by default all the Joins are Inner Joins. Following are the ways you can code Joins.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT &lt;table_name(s).column name(s)&gt;<br />
FROM &lt; table_name1 &gt; INNER JOIN &lt; table_name2 &gt;<br />
ON &lt;table_name1.column name&gt; = &lt;table_name2.column name&gt;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT &lt;table_name(s).column name(s)&gt;<br />
FROM &lt; table_name1 &gt; JOIN &lt; table_name2 &gt;<br />
ON &lt;table_name1.column name&gt; = &lt;table_name2.column name&gt;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT &lt;column name(s)&gt;<br />
FROM &lt; table_name1 &gt;, &lt; table_name2 &gt;<br />
WHERE &lt; table_name1.column name1&gt; =  &lt; table_name2.column name2&gt;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><u><span style="font-size:10pt;font-family:Verdana;">Cross Join: -</span></u><span style="font-size:10pt;font-family:Verdana;"> Cross Joins are also known as unconstrained joins (where a “WHERE” clause between the joined tables is not specified/needed). The result of an unconstrained join is also referred to as a Cartesian product. Where the collective result set would be a multiplication product of each element of one table with each element of another table. So, for example, if you have two tables with 10 rows each, the CROSS join would return 100 rows as its result set. Imagine tables with 1000’s of rows. This is reason one has to be very careful before performing a Cross Join. One good point to note, Cross Join is not the same as full Outer Join.</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">Syntax:</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">SELECT &lt;column name(s)&gt;</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM &lt; table_name1 &gt; CROSS JOIN &lt; table_name2 &gt;</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">Also the following is valid, note that the key word CROSS JOIN is not used.</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">SELECT &lt;column name(s)&gt;</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM &lt; table_name1 &gt;, &lt; table_name2 &gt;</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><u><span style="font-size:10pt;font-family:Verdana;">Self-Join:-</span></u><span style="font-size:10pt;font-family:Verdana;"> As the name suggests, a self-join combines the information from two or more rows of the “same” table into a single row, effectively joining the table with itself. The usage arises when same column value would be used for comparison. For example, compare sales figure of a sales person with that of another sales person with different designation.</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">Following query can be used.</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">SELECT a.name, a.dept_no, a.sales_amt,</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span> </span><span> </span><span>        </span>b.name, b.dept_no, b.sales_amt</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales a, sales b</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">WHERE a.dept_no = b.dept_no</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">AND a.desig IN (’Sales Executive’, ’Sales Supervisor’)</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">AND a.sales_amt &lt;&gt; b.sales_amt;</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">This particular query would treat the one “sales” tables to two fictitious “sales” table and give the desired result which is done be aliasing the “sales”<span>  </span>table twice once as <strong>a</strong> and again as <strong>b</strong>. This is also called as correlation names / range variables in ANSI. Remember to put the alias names before each column to be selected.</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/82/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/82/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=82&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/09/06/inner-joins-in-teradata/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>JOIN Algorithms in Teradata SQL</title>
		<link>http://readvitamin.wordpress.com/2007/09/05/join-algorithms-in-teradata-sql/</link>
		<comments>http://readvitamin.wordpress.com/2007/09/05/join-algorithms-in-teradata-sql/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 22:21:43 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/09/05/join-algorithms-in-teradata-sql/</guid>
		<description><![CDATA[In a JOIN processing, columns from two or more tables are simulated into a virtual table. In Teradata, we can have as many as 64 table JOINs per query, but in case if you need to JOIN these many tables, you better take good advice from your DBA, to avoid, facing last minute music. Also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=81&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="left"><span style="font-size:10pt;font-family:Verdana;">In a JOIN processing, columns from two or more tables are simulated into a virtual table. In Teradata, we can have as many as 64 table JOINs per query, but in case if you need to JOIN these many tables, you better take good advice from your DBA, to avoid, facing last minute music. Also a JOIN does not have to be with two or more tables, we can also JOIN one single table with itself, which is called “Self Join” where the information from two or more rows of the same table put into a single result row.</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;">There are varieties of JOINS, which are different by the “conditions” specified in the SQL query. We will discuss on the following types:</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">• Natural or Equijoin</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">• Inner</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">• Outer</span><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;"></span><u><span style="font-size:10pt;font-family:Verdana;">Natural or Equijoin</span></u></p>
<p align="left"><u><span style="font-size:10pt;font-family:Verdana;"></span></u><span style="font-size:10pt;font-family:Verdana;">Because Teradata SQL does not support the ANSI SQL-2003 NATURAL JOIN syntax, it treats natural and equijoins as one and the same.</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;">The natural join is an equality join (with = sign) made over a common column set with matching column names such as a primary key-foreign key relationship that is expressed in a WHERE clause. For example,</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;">WHERE A.empnum = B.empnum</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;">While both Natural as well as Equijoin are made over an equality condition (with = sign), the column names on which tables are joined need not match in an equijoin (but data should), while they must match in a natural join. For example, in the WHERE condition above, if there is a column present in table B with matching data and the name is emp_no then we can rewrite the query as follows:</span></p>
<p align="left"><span style="font-size:10pt;font-family:Verdana;">WHERE A.empnum = B.emp_no</span></p>
<p align="left"><u><span style="font-size:10pt;font-family:Verdana;">Inner Joins:</span></u><u><span style="font-size:10pt;font-family:Verdana;"><span style="text-decoration:none;"> </span></span></u><span style="font-size:10pt;font-family:Verdana;">The inner join, most of the time referred as just JOIN, combines only the rows that have specific similarity between the joined tables (employee number in the above example). </span><span style="font-size:10pt;font-family:Verdana;">One good thing about using INNER JOINS is that one can avoid unwanted cross joins. This happens by mistake. Following types of INNER JOINS are used in SQL.</span><u><span style="font-size:10pt;font-family:Verdana;"><span style="text-decoration:none;"> </span></span></u></p>
<ol>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Ordinary Inner Join</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Cross Join</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Self-Join</span></li>
</ol>
<p><span style="font-size:10pt;font-family:Verdana;"> </span><u><span style="font-size:10pt;font-family:Verdana;">Outer Joins:</span></u><u><span style="font-size:10pt;font-family:Verdana;"><span style="text-decoration:none;"> </span></span></u><span style="font-size:10pt;font-family:Verdana;">The outer join is an extension to inner join that returns not only common rows between the tables, but also it returns rows that do NOT have anything in common. This non-matching row might be due to a NULL value or invalid data. Depending on how you code, outer join can return the inner join rows plus any of the no matching rows from the: </span><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<ol>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Left Table (Left Outer Join).</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Right Table (Right Outer Join).</span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Both Tables (Full Outer Join).</span></li>
</ol>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/81/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/81/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=81&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/09/05/join-algorithms-in-teradata-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Examples Of Analytical functions present in Teradata (More.)</title>
		<link>http://readvitamin.wordpress.com/2007/08/29/examples-of-analytical-functions-present-in-teradata-more/</link>
		<comments>http://readvitamin.wordpress.com/2007/08/29/examples-of-analytical-functions-present-in-teradata-more/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 22:41:20 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/08/29/examples-of-analytical-functions-present-in-teradata-more/</guid>
		<description><![CDATA[RANK ():- As the function name implies, RANK returns ranking (ordered) of rows based on the number or expression given in the ORDER BY clause. Note that we do not need to give anything inside the RANK function. Just give it to the ORDER BY clause and things would be taken care. Let’s work out [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=80&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">RANK ():- As the function name implies, RANK returns ranking (ordered) of rows based on the number or <span>expression given i</span>n the ORDER BY clause. Note that we do not need to give anything inside the RANK function. Just give it to the ORDER BY clause and things would be taken care. Let’s work out a scenario.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Scenario is to find out the sales figure for each store based on their actual sales.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">RANK () OVER (PARTITION BY store_no ORDER BY actual_sale) as SaleRank</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Note that there is nothing being fed to the function RANK. Result set below shows the sales figure ranked, for each store.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span>      </span>store_no<span>  </span>sale_month<span>    </span>actual_sale<span>    </span>SaleRank</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>10<span>      </span>05/01/2007<span>    </span>13,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>10<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">01/01/2007<span>    </span>13,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>          20<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">02/01/2007<span>    </span>11,000<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>20<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">04/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>30<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">02/01/2007<span>    </span>10,000<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>30<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">03/01/2007<span>    </span>10,500<span> </span><span>          </span>2</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>30<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">03/01/2007<span>    </span>12,500<span> </span><span>          </span>3</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>40<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">02/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>40<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">04/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>50<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">01/01/2007<span>    </span>10,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>50<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">05/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>60<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">06/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>70<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">07/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>80<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">07/01/2007<span>    </span>15,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span>90<span>      </span></span><span style="font-size:10pt;font-family:Verdana;">06/01/2007<span>    </span>15,500<span> </span><span>          </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">ROW_NUMBER ():- </span><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">It returns the sequential number of the row within a group, starting with 1 based on the ORDER BY clause. With the above scenario if we replace the RANK with ROW_NUMBER and run the following query:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">ROW_NUMBER() OVER (PARTITION BY store_no ORDER BY actual_sale) as SaleRank</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">The result set we get is similar, only difference is for first two rows we have 1,1 with RANK but 1,2 with ROW_NUMBER. This is because ROW_NUMBER takes into consideration the sequential occurrence of the row in a group which is store_no here.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">store_no<span>   </span>sale_month<span>    </span>actual_sale<span>    </span>SaleRank</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">10<span>            </span>05/01/2007<span>    </span>13,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>10<span>            </span>01/01/2007<span>    </span>13,500<span> </span><span>          </span>2<span>        </span></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>20<span>            </span>02/01/2007<span>    </span>11,000<span> </span><span>          </span>1<span>        </span></span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>20<span>            </span>04/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>            </span>02/01/2007<span>    </span>10,000<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>            </span>03/01/2007<span>    </span>10,500<span> </span><span>          </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>            </span>03/01/2007<span>    </span>12,500<span> </span><span>          </span>3</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>40<span>            </span>02/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>40<span>            </span>04/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>50<span>            </span>01/01/2007<span>    </span>10,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>50<span>            </span>05/01/2007<span>    </span>12,500<span> </span><span>          </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>60<span>            </span>06/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>70<span>            </span>07/01/2007<span>    </span>11,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>80<span>            </span>07/01/2007<span>    </span>15,500<span> </span><span>          </span>1</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>90<span>            </span>06/01/2007<span>    </span>15,500<span>           </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/80/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/80/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=80&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/08/29/examples-of-analytical-functions-present-in-teradata-more/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Examples Of Analytical functions present in Teradata (Contd.)</title>
		<link>http://readvitamin.wordpress.com/2007/08/28/examples-of-analytical-functions-present-in-teradata-contd/</link>
		<comments>http://readvitamin.wordpress.com/2007/08/28/examples-of-analytical-functions-present-in-teradata-contd/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 23:16:38 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/08/28/examples-of-analytical-functions-present-in-teradata-contd/</guid>
		<description><![CDATA[SUM ():- When used with partition clause, SUM () function returns the cumulative or moving sum of an expression based on how the aggregation group is specified. This function can also be used in place of CSUM and MSUM which are Teradata-specific functions and are discouraged to a great extent. As per recent recommendations from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=79&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">SUM ():- When used with partition clause, SUM () function returns the cumulative or moving sum of an e<span>xpression </span>based on how the aggregation group is specified. This function can also be used in place of CSUM and MSUM which are Teradata-specific functions and are discouraged to a great extent. As per recent recommendations from Teradata, usage of </span><span style="font-size:10pt;font-family:Verdana;"><span>ANSI-compliant </span>window function for any new applications is advised. Lets see why Teradata suggests to go for ANSI-compliant SUM () function.</span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana;">• </span></strong><span style="font-size:10pt;font-family:Verdana;">If you are using </span><span style="font-size:10pt;font-family:Verdana;">SUM function and want to calculate the cumulative SUM, then just specify ORDER BY clause with ROWS UNBOUNDED PRECEDING which would give the same result as that of CSUM function.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><strong><span style="font-size:10pt;font-family:Verdana;">• </span></strong><span style="font-size:10pt;font-family:Verdana;">To compute moving average using </span><span style="font-size:10pt;font-family:Verdana;">SUM window function use ORDER BY clause and specify ROWS number<em> </em>PRECEDING (number of rows preceding the current row).</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Let’s work out some examples using the data present in the previous section.</span></p>
<p><u><span style="font-size:10pt;font-family:Verdana;">Scenario 1:- </span></u><span style="font-size:10pt;font-family:Verdana;">Calculate the cumulative actual sales per store ordered by sale month:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SUM (actual_sale) OVER (PARTITION BY store_no </span><span style="font-size:10pt;font-family:Verdana;">ORDER BY sale_month </span><span style="font-size:10pt;font-family:Verdana;">ROWS UNBOUNDED PRECEDING) as StoreTotal</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span><span style="font-size:10pt;font-family:Verdana;">ORDER BY store_no, sale_month;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Result Set:-</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">store_no<span>   </span>sale_month<span>         </span>actual_sale<span>   </span>StoreTotal</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>01/01/2007           <span> </span>13,500<span>          </span>13,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>05/01/2007<span>            </span>13,500<span> </span><span>         </span>27,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>02/01/2007<span>            </span>11,000<span>          </span>11,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>04/01/2007<span>            </span>12,500<span>          </span>23,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>02/01/2007<span>            </span>10,000<span>          </span>10,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>03/01/2007<span>            </span>12,500<span>          </span>22,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>03/01/2007<span>            </span>10,500<span>          </span>33,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>02/01/2007<span>            </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>04/01/2007<span>            </span>12,500<span>          </span>24,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>01/01/2007<span>            </span>10,500<span>          </span>10,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>05/01/2007<span>            </span>12,500<span>          </span>23,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">60<span>      </span><span>   </span>06/01/2007<span>            </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">70<span>      </span><span>   </span>07/01/2007<span>            </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">80<span>      </span><span>   </span>07/01/2007<span>            </span>15,500<span>          </span>15,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">90<span>      </span><span>   </span>06/01/2007<span>            </span>15,500<span>          </span>15,500</span></p>
<p><u><span style="font-size:10pt;font-family:Verdana;">Scenario 2:- </span></u><span style="font-size:10pt;font-family:Verdana;">Calculate the total actual sales of fruits by category per each store:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, prod_code, actual_sale,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SUM (actual_sale) OVER (PARTITION BY prod_code ROWS BETWEEN </span><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as FruitTotal</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Result would be as follows:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">store_no<span>   </span>prod_code<span>   </span>actual_sale<span>   </span>FruitTotal</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">60<span>      </span><span>   </span>Apple<span>            </span>11,500<span>           </span>25,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>Apple<span>            </span>13,500<span>           </span>25,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>Apricot<span>          </span>12,500<span>           </span>26,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>Apricot<span>          </span>13,500<span>           </span>26,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>Banana<span>          1</span>1,000<span>           </span>22,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">70<span>      </span><span>   </span>Banana<span>          </span>11,500<span>           </span>22,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>Grapes<span>           </span>12,500<span>           </span>28,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">80<span>      </span><span>   </span>Grapes<span>           </span>15,500<span>           </span>28,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>Guava<span>            </span>10,500<span>           </span>22,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>Guava<span>            </span>11,500<span>           </span>22,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>Mango<span>            </span>12,500<span>          </span>25,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>Mango<span>            </span>12,500<span>          </span>25,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">90<span>      </span><span>   </span>Orange<span>           </span>15,500<span>          </span>26,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>Orange<span>           </span>10,500<span>          </span>26,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>Strawberry<span>      </span>10,000<span>          </span>10,000</span></p>
<p><u><span style="font-size:10pt;font-family:Verdana;">Scenario 3:- </span></u><span style="font-size:10pt;font-family:Verdana;">Calculate the moving actual sales per month per store.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SUM (actual_sale) OVER (PARTITION BY store_no, sale_month </span><span style="font-size:10pt;font-family:Verdana;">ORDER BY actual_sale ROWS 1 PRECEDING) as SaleTrend</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">And the Result would be:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">store_no<span>   </span>sale_month<span>         </span>actual_sale<span>   </span>SaleTrend</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>01/01/2007          <span> </span>13,500<span>          </span>13,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>      </span><span>   </span>05/01/2007<span>           </span>13,500<span>          </span>13,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>02/01/2007<span>           </span>11,000<span>          </span>11,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>      </span><span>   </span>04/01/2007<span>           </span>12,500<span>          </span>12,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>02/01/2007<span>           </span>10,000<span>          </span>10,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>03/01/2007<span>           </span>10,500<span>          </span>10,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">30<span>      </span><span>   </span>03/01/2007<span>           </span>12,500<span>          </span>23,000</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>02/01/2007<span>           </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>      </span><span>   </span>04/01/2007<span>           </span>12,500<span>          </span>12,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>01/01/2007<span>           </span>10,500<span>          </span>10,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>      </span><span>   </span>05/01/2007<span>           </span>12,500<span>          </span>12,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">60<span>      </span><span>   </span>06/01/2007<span>           </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">70<span>      </span><span>   </span>07/01/2007<span>           </span>11,500<span>          </span>11,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">80<span>      </span><span>   </span>07/01/2007<span>           </span>15,500<span>          </span>15,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">90<span>      </span><span>   </span>06/01/2007<span>           </span>15,500<span>          </span>15,500</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/79/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/79/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=79&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/08/28/examples-of-analytical-functions-present-in-teradata-contd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Examples Of Analytical functions present in Teradata (Cont.)</title>
		<link>http://readvitamin.wordpress.com/2007/08/27/examples-of-analytical-functions-present-in-teradata-cont/</link>
		<comments>http://readvitamin.wordpress.com/2007/08/27/examples-of-analytical-functions-present-in-teradata-cont/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 23:48:33 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/08/27/examples-of-analytical-functions-present-in-teradata-cont/</guid>
		<description><![CDATA[COUNT ():- As you know when you use this function as aggregate function, it would just return the total number of rows present in the SELECT statement. But the same function when used with OLAP, returns the cumulative or moving count for an expression, let’s see how this is done. Let’s also use the same [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=78&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">COUNT ():- As you know when you use this function as aggregate function, it would just return the total number of rows present in the SELECT statement. But the same function when used with OLAP, r<span>eturns the cumulative or moving count for an expression, let’s see how this is done. Let’s also use the same data set present in the initial article. Scenario is to find out, number of stores selling a particular product.</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;">This is called grouping count and the same can be done in two ways one with taking store_no as count, partitioning by prod_code and the other ways to reverse the logic of taking prod_code as count and partition by store_no.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">The following queries would give the desired result.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale, prod_code,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">COUNT (prod_code) OVER (PARTITION BY store_no</span><span style="font-size:10pt;font-family:Verdana;">ROWS BETWEEN UNBOUNDED PRECEDING AND</span><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED FOLLOWING)</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale, prod_code,</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">COUNT (store_no) OVER (PARTITION BY prod_code</span><span style="font-size:10pt;font-family:Verdana;">ROWS BETWEEN UNBOUNDED PRECEDING AND</span><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED FOLLOWING)</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">store_no<span>    </span>sale_month<span>    </span>actual_sale<span>    </span>prod_code<span>     </span>Group Count(store_no)</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">10<span>             </span>01/01/2007<span>    </span>13,500<span>          </span>Apple<span>               </span><span>       </span>2</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">60<span>             </span>06/01/2007<span>    </span>11,500<span>          </span>Apple<span>               </span><span>       </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>10<span>             </span>05/01/2007<span>    </span>13,500<span>          </span>Apricot<span>        </span><span>     </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>40<span>             </span>04/01/2007<span>    </span>12,500<span>          </span>Apricot<span>             </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>70<span>             </span>07/01/2007<span>    </span>11,500<span>          </span>Banana<span>              </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>20<span>             </span>02/01/2007<span>    </span>11,000<span>          </span>Banana<span>              </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>50<span>             </span>05/01/2007<span>    </span>12,500<span>          </span>Grapes<span>              </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>80<span>             </span>07/01/2007<span>    </span>15,500<span>          </span>Grapes<span>              </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>50<span>             </span>01/01/2007<span>    </span>10,500<span>          </span>Guava<span>               </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>40<span>             </span>02/01/2007<span>    </span>11,500<span>          </span>Guava<span>               </span><span>      </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>             </span>03/01/2007<span>    </span>12,500<span>          </span>Mango<span>               </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>20<span>             </span>04/01/2007<span>    </span>12,500<span>          </span>Mango<span>               </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>             </span>03/01/2007<span>    </span>10,500<span>          </span>Orange<span>              </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>90<span>             </span>06/01/2007<span>    </span>15,500<span>          </span>Orange<span>    </span><span>          </span><span>     </span>2</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span></span>30<span>             </span>02/01/2007<span>    </span>10,000<span>          </span>Strawberry<span>          </span><span>    </span>1</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">New Terms:-</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">ROWS BETWEEN: &#8211; This clause is to specify the start and end of the aggregation group.</span><span style="font-size:10pt;font-family:Verdana;">The default aggregation group is ROWS BETWEEN UNBOUNDED PRECEDING AND</span><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED FOLLOWING (take out this portion from the above query and run).</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED PROCEEDING: &#8211; When this is specified, the entire partition that precedes the current row is taken into the aggregation group.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">UNBOUNDED FOLLOWING: &#8211; Used to define the entire partition that follows the current row.</span><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/78/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/78/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=78&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/08/27/examples-of-analytical-functions-present-in-teradata-cont/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Examples Of Analytical functions present in Teradata.</title>
		<link>http://readvitamin.wordpress.com/2007/08/24/examples-of-analytical-functions-present-in-teradata/</link>
		<comments>http://readvitamin.wordpress.com/2007/08/24/examples-of-analytical-functions-present-in-teradata/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 23:16:36 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/08/24/examples-of-analytical-functions-present-in-teradata/</guid>
		<description><![CDATA[Let’s work out some examples of OLAP functions that are being discussed in the previous articles. Before that make sure you have a table and there is data present init. Follow the below instruction to create a temporary table and insert data into it. While inserting data you might encounter one of the following errors: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=77&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">Let’s work out some examples of OLAP functions that are being discussed in the previous articles. Before that make sure you have a table and there is data present init. Follow the below instruction to create a temporary table and insert data into it. While inserting data you might encounter one of the following errors:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">3520:<span>  </span>A constant value in a query is not valid for column sale_month.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">3535:<span>  </span>A character string failed conversion to a numeric value.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">2665:<span>  </span>Invalid date.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">All of these errors are due to the date value that you are inserting. If you encounter any of these errors, try permutation and combination of the date value and see if you can get rid of the error. If you still can not then find out from your sys admin what date format in allowed while you are inserting dates. Here in this example the format is ‘yyyy-mm-dd’. All of the below statements are tested in SQL assistant.</span><span style="font-size:10pt;font-family:Verdana;"> </span><span style="font-size:10pt;font-family:Verdana;">Create a Volatile Table “Sales” as follows:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">CREATE SET VOLATILE TABLE &lt;username&gt;.sales, NO FALLBACK,</span><span style="font-size:10pt;font-family:Verdana;">CHECKSUM = DEFAULT,</span><span style="font-size:10pt;font-family:Verdana;">LOG</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>     </span>(</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>&#8220;store_no&#8221; INTEGER,</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>&#8220;sale_month&#8221; DATE,</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>&#8220;prod_code&#8221; CHAR (20) CHARACTER SET LATIN NOT CASESPECIFIC,</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>&#8220;projected_sale&#8221; INTEGER,</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>&#8220;actual_sale&#8221; INTEGER</span><span style="font-size:10pt;font-family:Verdana;"><span>          </span><span>      </span>)</span><span style="font-size:10pt;font-family:Verdana;">PRIMARY INDEX ( &#8220;store_no&#8221; )</span><span style="font-size:10pt;font-family:Verdana;">ON COMMIT PRESERVE ROWS;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Insert data as follows:</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(10,&#8217;2007-01-01&#8242;,&#8217;Apple&#8217;,15000,13500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(20,&#8217;2007-02-01&#8242;,&#8217;Banana&#8217;,10000,11000);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(30,&#8217;2007-03-01&#8242;,&#8217;Orange&#8217;,11000,10500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(40,&#8217;2007-04-01&#8242;,&#8217;Apricot&#8217;,12500,12500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(50,&#8217;2007-05-01&#8242;,&#8217;Grapes&#8217;,15000,12500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(60,&#8217;2007-06-01&#8242;,&#8217;Apple&#8217;,12000,11500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(70,&#8217;2007-07-01&#8242;,&#8217;Banana&#8217;,15500,11500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(80,&#8217;2007-07-01&#8242;,&#8217;Grapes&#8217;,15000,15500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(90,&#8217;2007-06-01&#8242;,&#8217;Orange&#8217;,16000,15500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(10,&#8217;2007-05-01&#8242;,&#8217;Apricot&#8217;,14500,13500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(20,&#8217;2007-04-01&#8242;,&#8217;Mango&#8217;,15500,12500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(30,&#8217;2007-03-01&#8242;,&#8217;Mango&#8217;,15000,12500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(40,&#8217;2007-02-01&#8242;,&#8217;Guava&#8217;,14000,11500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(50,&#8217;2007-01-01&#8242;,&#8217;Guava&#8217;,12000,10500);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">INSERT INTO sales VALUES(30,&#8217;2007-02-01&#8242;,&#8217;Strawberry&#8217;,12000,10000);</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Now take the example of AVG () function. As you know AVG () computes the cumulative or moving average of a column, we will calculate something similar in the following scenario.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">Scenario is to find out the actual sales in each store, averaged over the current month and the preceding month. Here preceding month would be understood as the previous month to the current month, now what is current month, it is the first row returned after the result set is ordered after partitioning. Following is the query.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">SELECT store_no, sale_month, actual_sale, projected_sale,</span><span style="font-size:10pt;font-family:Verdana;">AVG(actual_sale) OVER (PARTITION BY store_no</span><span style="font-size:10pt;font-family:Verdana;">ORDER BY projected_sale</span><span style="font-size:10pt;font-family:Verdana;">ROWS 1 PRECEDING)</span><span style="font-size:10pt;font-family:Verdana;">FROM sales;</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">And it would return the following result set.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">store_no<span>     </span>sale_month<span>    </span>actual_sale<span>    </span>projected_sale<span>  </span>Moving Avg(actual_sale)</span><span style="font-size:10pt;font-family:Verdana;">10<span>                </span>5/1/2007<span>       </span>13,500<span>          </span>14,500<span>          </span>13,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">10<span>                </span>1/1/2007<span>       </span>13,500<span>          </span>15,000<span>          </span>13,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>                </span>2/1/2007<span>       </span>11,000<span>          </span>10,000<span>          </span>11,000.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">20<span>                </span>4/1/2007<span>       </span>12,500<span>          </span>15,500<span>          </span>11,750.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><strong>30<span>                </span>3/1/2007<span>       </span>10,500<span>          </span>11,000<span>          </span>10,500.00</strong></span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><strong>30<span>                </span>2/1/2007<span>       </span>10,000<span>          </span>12,000<span>          </span>10,250.00</strong></span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;"><strong>30<span>                </span>3/1/2007<span>       </span>12,500<span>          </span>15,000<span>          </span>11,250.00</strong></span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>                </span>4/1/2007<span>       </span>12,500<span>          </span>12,500<span>          </span>12,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">40<span>                </span>2/1/2007<span>       </span>11,500<span>          </span>14,000<span>          </span>12,000.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>                </span>1/1/2007<span>       </span>10,500<span>          </span>12,000<span>          </span>10,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">50<span>                </span>5/1/2007<span>       </span>12,500<span>          </span>15,000<span>          </span>11,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">60<span>                </span>6/1/2007<span>       </span>11,500<span>          </span>12,000<span>          </span>11,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">70<span>                </span>7/1/2007<span>       </span>11,500<span>          </span>15,500<span>          </span>11,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;">80<span>                </span>7/1/2007<span>       </span>15,500<span>          </span>15,000<span>          </span>15,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">90<span>                </span>6/1/2007<span>       </span>15,500<span>          </span>16,000<span>          </span>15,500.00</span></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"><span style="font-size:10pt;font-family:Verdana;"></span><span style="font-size:10pt;font-family:Verdana;">Note that the moving average number is changing every 2<sup>nd</sup> row in case there is a difference in between the 1<sup>st</sup> and 2<sup>nd</sup> row figure within the same store number. Particularly for the store number 30, you can see that there is a slight increase in the moving average in spite of good increase in actual sales. Projected Sales is also added just to have an idea how the actual sale is performing over the project sale.</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/77/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/77/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=77&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/08/24/examples-of-analytical-functions-present-in-teradata/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
		<item>
		<title>Characteristics of Ordered (OLAP) Analytical Computations.</title>
		<link>http://readvitamin.wordpress.com/2007/08/23/characteristics-of-ordered-olap-analytical-computations/</link>
		<comments>http://readvitamin.wordpress.com/2007/08/23/characteristics-of-ordered-olap-analytical-computations/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 23:54:10 +0000</pubDate>
		<dc:creator>readvitamin</dc:creator>
				<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://readvitamin.com/2007/08/23/characteristics-of-ordered-olap-analytical-computations/</guid>
		<description><![CDATA[1. One of the useful features in Ordered Analytical Computation is to produce/define data sets or data subsets dynamically. This is done by the usage of the OVER () phrase (detail later). This OVER () feature can be used with all the aggregate functions too. 2. Introducing the usage of QUALIFY Clause: If there is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=76&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt;font-family:Verdana;">1. One of the useful features in Ordered Analytical Computation is to produce/define data sets or data subsets dynamically. This is done by the usage of the OVER () phrase (detail later). This OVER () feature can be used with all the aggregate functions too.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">2. Introducing the usage of QUALIFY Clause: If there is a need to eliminate or extract rows based on the certain condition after the partition, use this clause.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">3. DISTINCT Clause in NOT allowed Analytical Computations.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">4. Ordered (OLAP) analytical functions are permitted in the following database objects:</span><span style="font-size:10pt;font-family:Verdana;">• Views</span><span style="font-size:10pt;font-family:Verdana;">• Macros</span><span style="font-size:10pt;font-family:Verdana;">• Derived tables</span><span style="font-size:10pt;font-family:Verdana;">• INSERT INTO-SELECT FROM.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">5. Ordered (OLAP) analytical functions are not permitted in sub queries. But note that if you are just using aggregate functions, then it is allowed.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">6. Ordered (OLAP) analytical functions are even not permitted in WHERE clauses. Same is the case with aggregate functions.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">7. Ordered (OLAP) analytical functions do not support CLOB or BLOB data types.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;">8. If you want to sort the result set, by a column present in the partition clause, then mind that you have to use the ORDER BY again after the FROM clause. Only using within the partition specification would not sort the result set.</span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/readvitamin.wordpress.com/76/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/readvitamin.wordpress.com/76/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/readvitamin.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/readvitamin.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/readvitamin.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=readvitamin.wordpress.com&amp;blog=981441&amp;post=76&amp;subd=readvitamin&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://readvitamin.wordpress.com/2007/08/23/characteristics-of-ordered-olap-analytical-computations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9731181ceb7add8f3b16dbab1a01227b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">readvitamin</media:title>
		</media:content>
	</item>
	</channel>
</rss>
