<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Interview Questions and Answers &#8211; Guest Post by Rick Morelan &#8211; Day 27 of 31</title>
	<atom:link href="http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 23 May 2013 14:22:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: vick</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-353743</link>
		<dc:creator><![CDATA[vick]]></dc:creator>
		<pubDate>Fri, 28 Sep 2012 02:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-353743</guid>
		<description><![CDATA[It&#039;s very simple without using any Rank !!]]></description>
		<content:encoded><![CDATA[<p>It&#8217;s very simple without using any Rank !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-287549</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 23 May 2012 10:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-287549</guid>
		<description><![CDATA[Yes. Have you tried it?

Alternatively, You can do it in derived table too

 
select min(amount) from 
(
select top 3 amount from grant order by amount desc 
) as t]]></description>
		<content:encoded><![CDATA[<p>Yes. Have you tried it?</p>
<p>Alternatively, You can do it in derived table too</p>
<p>select min(amount) from<br />
(<br />
select top 3 amount from grant order by amount desc<br />
) as t</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shailesh</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-285187</link>
		<dc:creator><![CDATA[shailesh]]></dc:creator>
		<pubDate>Wed, 16 May 2012 17:48:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-285187</guid>
		<description><![CDATA[can we do like this
with cte as ( select top 3 amount from grant order by amount desc ) select min(amount) from cte]]></description>
		<content:encoded><![CDATA[<p>can we do like this<br />
with cte as ( select top 3 amount from grant order by amount desc ) select min(amount) from cte</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aram</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151682</link>
		<dc:creator><![CDATA[Aram]]></dc:creator>
		<pubDate>Fri, 29 Jul 2011 23:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151682</guid>
		<description><![CDATA[The following performs much better in large tables by preventing fetching unneeded records:

--Use a Common Table Expression
WITH CTE AS
(SELECT TOP 3 *,
RANK() OVER(ORDER BY Amount DESC) AS GrantRank
FROM [Grant] )
SELECT * FROM CTE
WHERE GrantRank = 3]]></description>
		<content:encoded><![CDATA[<p>The following performs much better in large tables by preventing fetching unneeded records:</p>
<p>&#8211;Use a Common Table Expression<br />
WITH CTE AS<br />
(SELECT TOP 3 *,<br />
RANK() OVER(ORDER BY Amount DESC) AS GrantRank<br />
FROM [Grant] )<br />
SELECT * FROM CTE<br />
WHERE GrantRank = 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kumar</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151343</link>
		<dc:creator><![CDATA[kumar]]></dc:creator>
		<pubDate>Thu, 28 Jul 2011 16:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151343</guid>
		<description><![CDATA[Pinal. U have so many resourceful articles for readers and I would like to personally thank you for all ur efforts. Please keep up the good work. Thanks]]></description>
		<content:encoded><![CDATA[<p>Pinal. U have so many resourceful articles for readers and I would like to personally thank you for all ur efforts. Please keep up the good work. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ss</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151242</link>
		<dc:creator><![CDATA[ss]]></dc:creator>
		<pubDate>Thu, 28 Jul 2011 06:23:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151242</guid>
		<description><![CDATA[Hello rstech,

Thank you so much for the reply. I think its easier to use rank() function when there is large amounts of data to be sorted out. 

Thank you.]]></description>
		<content:encoded><![CDATA[<p>Hello rstech,</p>
<p>Thank you so much for the reply. I think its easier to use rank() function when there is large amounts of data to be sorted out. </p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ravigupta7986avi Gupta</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151227</link>
		<dc:creator><![CDATA[ravigupta7986avi Gupta]]></dc:creator>
		<pubDate>Thu, 28 Jul 2011 05:28:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151227</guid>
		<description><![CDATA[Hi Pinal and Rick,

Thanks for this nice post.

Can you please tell if there is any performance difference between the two methods shown in this post. i.e, between &quot;Use a Common Table Expression&quot; and &quot;Use a Derived Table&quot;. 

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal and Rick,</p>
<p>Thanks for this nice post.</p>
<p>Can you please tell if there is any performance difference between the two methods shown in this post. i.e, between &#8220;Use a Common Table Expression&#8221; and &#8220;Use a Derived Table&#8221;. </p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Complete Downloadable List – Day 0 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151156</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Complete Downloadable List – Day 0 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 22:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151156</guid>
		<description><![CDATA[[...] SQL SERVER – Interview Questions and Answers – Guest Post by Rick Morelan – Day 27 of 31 [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Interview Questions and Answers – Guest Post by Rick Morelan – Day 27 of 31 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rs tech</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151147</link>
		<dc:creator><![CDATA[rs tech]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 21:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151147</guid>
		<description><![CDATA[Hello ss... 
Here is a workable solution to Rick&#039;s interview question without using the RANK() function.

/*  Create a parameter that sets the position of the 
     business required value. 
**********************************************************************/
DECLARE @nRank int;
SET @nRank = 3;

/*  Use the TOP() expression with a derived table to return all 
     rows that meet the specified business requirement.
**********************************************************************/
SELECT TOP (1) WITH TIES *
FROM [Grant]
WHERE Amount NOT IN (  SELECT TOP (@nRank - 1) WITH TIES Amount
                                            FROM [Grant]
                                            ORDER BY Amount DESC )
ORDER BY Amount DESC;]]></description>
		<content:encoded><![CDATA[<p>Hello ss&#8230;<br />
Here is a workable solution to Rick&#8217;s interview question without using the RANK() function.</p>
<p>/*  Create a parameter that sets the position of the<br />
     business required value.<br />
**********************************************************************/<br />
DECLARE @nRank int;<br />
SET @nRank = 3;</p>
<p>/*  Use the TOP() expression with a derived table to return all<br />
     rows that meet the specified business requirement.<br />
**********************************************************************/<br />
SELECT TOP (1) WITH TIES *<br />
FROM [Grant]<br />
WHERE Amount NOT IN (  SELECT TOP (@nRank &#8211; 1) WITH TIES Amount<br />
                                            FROM [Grant]<br />
                                            ORDER BY Amount DESC )<br />
ORDER BY Amount DESC;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaiman Sindhi</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151134</link>
		<dc:creator><![CDATA[Jaiman Sindhi]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 20:33:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151134</guid>
		<description><![CDATA[Excellent Post Rick!

Pinal bring more guest author like him.]]></description>
		<content:encoded><![CDATA[<p>Excellent Post Rick!</p>
<p>Pinal bring more guest author like him.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramdas</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151107</link>
		<dc:creator><![CDATA[Ramdas]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 17:59:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151107</guid>
		<description><![CDATA[Nice article,thank you]]></description>
		<content:encoded><![CDATA[<p>Nice article,thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nestor</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151071</link>
		<dc:creator><![CDATA[Nestor]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 14:43:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151071</guid>
		<description><![CDATA[Nice question and a great answer. Thanks for the pointer.
I had to use the ROW_NUMBER(), RANK() AND DENSE_RANK() functions a couple of days ago in a query that&#039;s being used to extract data from a SQL database. Very interesting functions, and very helpful.]]></description>
		<content:encoded><![CDATA[<p>Nice question and a great answer. Thanks for the pointer.<br />
I had to use the ROW_NUMBER(), RANK() AND DENSE_RANK() functions a couple of days ago in a query that&#8217;s being used to extract data from a SQL database. Very interesting functions, and very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-151022</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 10:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-151022</guid>
		<description><![CDATA[fixed and thanks!]]></description>
		<content:encoded><![CDATA[<p>fixed and thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ss</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-150964</link>
		<dc:creator><![CDATA[ss]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 05:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-150964</guid>
		<description><![CDATA[Hello...
It is a very nice post but is it not possible to do the same with out using the rank() function?]]></description>
		<content:encoded><![CDATA[<p>Hello&#8230;<br />
It is a very nice post but is it not possible to do the same with out using the rank() function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: levpius</title>
		<link>http://blog.sqlauthority.com/2011/07/27/sql-server-interview-questions-and-answers-guest-post-by-rick-morelan-day-27-of-31/#comment-150924</link>
		<dc:creator><![CDATA[levpius]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 01:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13595#comment-150924</guid>
		<description><![CDATA[Pinal,

Thanks for the pointers ... You have a typo:
&quot;I encourage all the readers to read her MUST read books Joes 2 Pros.&quot;]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Thanks for the pointers &#8230; You have a typo:<br />
&#8220;I encourage all the readers to read her MUST read books Joes 2 Pros.&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
