<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://beyondrelational.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>TSQL Challenges for Beginners - All Comments</title><link>http://beyondrelational.com/blogs/tcb/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>re: TSQL Beginner's Challenge 2 - Fight Your Fear for Date Calculations</title><link>http://beyondrelational.com/blogs/tcb/archive/2010/03/01/TSQL-Beginner_2700_s-Challenge-2-_2D00_-Fight-Your-Fear-for-Date-Calculations.aspx#3649</link><pubDate>Thu, 25 Feb 2010 07:58:02 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:3649</guid><dc:creator>Niladri Biswas</dc:creator><description>&lt;p&gt;Hi Divya &amp;amp; Jacob,&lt;/p&gt;
&lt;p&gt;Appreciate if you can let me know about the exceptional cases that needs to be handle in this challenge.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Niladri Biswas&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=3649" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1830</link><pubDate>Tue, 01 Dec 2009 20:50:10 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1830</guid><dc:creator>nhasan</dc:creator><description>&lt;p&gt;DECLARE @Employees TABLE&lt;/p&gt;
&lt;p&gt;(&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;EmployeeID INT IDENTITY,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;EmployeeName VARCHAR(15),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Department VARCHAR(15),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Salary NUMERIC(16,2)&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;T Cook&amp;#39;,&amp;#39;Finance&amp;#39;, 40000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;D Michael&amp;#39;,&amp;#39;Finance&amp;#39;, 25000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;A Smith&amp;#39;,&amp;#39;Finance&amp;#39;, 25000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;D Adams&amp;#39;,&amp;#39;Finance&amp;#39;, 15000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;M Williams&amp;#39;,&amp;#39;IT&amp;#39;, 80000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;D Jones&amp;#39;,&amp;#39;IT&amp;#39;, 40000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;J Miller&amp;#39;,&amp;#39;IT&amp;#39;, 50000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;L Lewis&amp;#39;,&amp;#39;IT&amp;#39;, 50000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;A Anderson&amp;#39;,&amp;#39;Back-Office&amp;#39;, 25000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;S Martin&amp;#39;,&amp;#39;Back-Office&amp;#39;, 15000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;J Garcia&amp;#39;,&amp;#39;Back-Office&amp;#39;, 15000)&lt;/p&gt;
&lt;p&gt;INSERT INTO @Employees(EmployeeName, Department, Salary)&lt;/p&gt;
&lt;p&gt;VALUES(&amp;#39;T Clerk&amp;#39;,&amp;#39;Back-Office&amp;#39;, 10000)&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;	e.EmployeeID,&lt;/p&gt;
&lt;p&gt;	e.EmployeeName,&lt;/p&gt;
&lt;p&gt;	e.Department,&lt;/p&gt;
&lt;p&gt;	e.Salary&lt;/p&gt;
&lt;p&gt;FROM&lt;/p&gt;
&lt;p&gt;	@Employees e&lt;/p&gt;
&lt;p&gt;WHERE&lt;/p&gt;
&lt;p&gt;	(SELECT&lt;/p&gt;
&lt;p&gt;		COUNT(DISTINCT e2.Salary) &lt;/p&gt;
&lt;p&gt;	 FROM&lt;/p&gt;
&lt;p&gt;		@Employees e2&lt;/p&gt;
&lt;p&gt;	 WHERE&lt;/p&gt;
&lt;p&gt;		e2.Department = e.Department AND&lt;/p&gt;
&lt;p&gt;		e2.Salary &amp;gt;= e.Salary&lt;/p&gt;
&lt;p&gt;	 GROUP BY&lt;/p&gt;
&lt;p&gt;		e2.Department) = 2&lt;/p&gt;
&lt;p&gt;ORDER BY&lt;/p&gt;
&lt;p&gt;	e.Salary&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1830" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1782</link><pubDate>Tue, 01 Dec 2009 06:56:39 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1782</guid><dc:creator>Pankaj Kumar Verma</dc:creator><description>&lt;p&gt;HI jacob,&lt;/p&gt;
&lt;p&gt;I have also submitted my script of the challenge #1. Please check this and let me know is it OK.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1782" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1414</link><pubDate>Fri, 30 Oct 2009 06:43:20 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1414</guid><dc:creator>arorasumitcs</dc:creator><description>&lt;p&gt;True one Niladri.. but what you think what you did, you even send the whole explanation in comments with your solution and you blaming other peoples.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1414" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner's Challenge - Submission Guidelines and Terms</title><link>http://beyondrelational.com/blogs/tcb/pages/tsql-beginner-s-challenge-submission-guidelines-and-terms.aspx#1346</link><pubDate>Tue, 20 Oct 2009 07:32:35 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1346</guid><dc:creator>Niladri Biswas</dc:creator><description>&lt;p&gt;Hi Tejas,&lt;/p&gt;
&lt;p&gt;I have tried to give explanation for the TBC #1 but I was unable to upload the images. Is there any otehr way where I can send a full document of explanation.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1346" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1313</link><pubDate>Sun, 18 Oct 2009 16:14:17 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1313</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Srinivas,&lt;/p&gt;
&lt;p&gt;Please read submission Guidelines at &lt;a rel="nofollow" target="_new" href="http://beyondrelational.com/blogs/tcb/pages/tsql-beginner-s-challenge-submission-guidelines-and-terms.aspx"&gt;beyondrelational.com/.../tsql-beginner-s-challenge-submission-guidelines-and-terms.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It has clear instructions on how to submit the solution.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1313" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1312</link><pubDate>Sun, 18 Oct 2009 16:13:51 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1312</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Mudit,&lt;/p&gt;
&lt;p&gt;Temp tables are not allowed. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1312" width="1" height="1"&gt;</description></item><item><title>re: First Editorial - T-SQL Challenges Beginners</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/09/22/first-editorial-t-sql-challenges-beginners.aspx#1305</link><pubDate>Thu, 15 Oct 2009 23:19:03 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1305</guid><dc:creator>Vijaya Krishna Kadiyala</dc:creator><description>&lt;p&gt;Kool..dude..wish you all the best..&lt;/p&gt;
&lt;p&gt;Thanks -- Vj&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1305" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1291</link><pubDate>Thu, 15 Oct 2009 08:36:39 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1291</guid><dc:creator>srinivas</dc:creator><description>&lt;p&gt;i was able to solve this puzzle, but where can i post my solution.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1291" width="1" height="1"&gt;</description></item><item><title>re: TSQL Beginner’s Challenge #1 – Find the second highest salary for each department</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/10/13/tsql-beginner-s-challenge-1-find-the-second-highest-salary-for-each-department.aspx#1275</link><pubDate>Wed, 14 Oct 2009 13:45:34 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1275</guid><dc:creator>Mudit.Gupta</dc:creator><description>&lt;p&gt;Jacob,&lt;/p&gt;
&lt;p&gt;Can we use Temp tables instead of Table Variables for this task?&lt;/p&gt;
&lt;p&gt;thanks!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1275" width="1" height="1"&gt;</description></item><item><title>re: TSQL Challenges for Beginners – The team – Interview with Tejas Shah</title><link>http://beyondrelational.com/blogs/tcb/archive/2009/09/17/tsql-challenges-for-beginners-the-team-interview-with-tejas-shah.aspx#887</link><pubDate>Thu, 17 Sep 2009 07:23:03 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:887</guid><dc:creator>Ritesh Shah</dc:creator><description>&lt;p&gt;Congratulations Tejas for being a part of TSQL Challenges for Beginners.&lt;/p&gt;
&lt;p&gt;Ritesh Shah&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.SQLHub.com"&gt;http://www.SQLHub.com&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=887" width="1" height="1"&gt;</description></item></channel></rss>