<?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/"
	>

<channel>
	<title>Recursive SQL &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/recursive-sql/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 05 Mar 2018 19:33:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Puzzle: SQL Advance Query – Using Recursive CTE, Generates the Columns</title>
		<link>https://www.dbrnd.com/2018/02/sql-puzzle-using-recursive-cte-generates-the-columns/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 18 Feb 2018 16:16:48 +0000</pubDate>
				<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[RECURSIVE CTE]]></category>
		<category><![CDATA[Recursive SQL]]></category>
		<category><![CDATA[SQL Advance Query]]></category>
		<category><![CDATA[SQL Interview]]></category>
		<category><![CDATA[SQL Problem]]></category>
		<category><![CDATA[SQL Programming]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7106</guid>

					<description><![CDATA[Check the below input data and expected output for generating new columns using Recursive CTE. Input Data: [crayon-6aa124bb2104f978220811/] Expected Output: [crayon-6aa124bb21053558821333/] Solution: [crayon-6aa124bb21054089437306/] Please try the different solution for this puzzle and share it via comment...]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&amp;linkname=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-puzzle-using-recursive-cte-generates-the-columns%2F&#038;title=SQL%20Puzzle%3A%20SQL%20Advance%20Query%20%E2%80%93%20Using%20Recursive%20CTE%2C%20Generates%20the%20Columns" data-a2a-url="https://www.dbrnd.com/2018/02/sql-puzzle-using-recursive-cte-generates-the-columns/" data-a2a-title="SQL Puzzle: SQL Advance Query – Using Recursive CTE, Generates the Columns"></a></p><p>Check the below input data and expected output for generating new columns using Recursive CTE.</p>
<p><strong>Input Data:</strong></p><pre class="crayon-plain-tag">a1          a2          a3          a4          a5          a6
----------- ----------- ----------- ----------- ----------- -----------
1           2           3           4           5           6</pre><p> </p>
<p><strong>Expected Output:</strong></p><pre class="crayon-plain-tag">a1          a2          a3          a4          a5          a6          b1          b2          b3          b4          b5          b6
------ ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
1           2           3           4           5           6           2           4           6           8           10          12</pre><p> </p>
<p><strong>Solution:</strong></p>
<pre class="crayon-plain-tag">WITH
  col1(a1, a2, a3, a4, a5, a6) AS (SELECT 1,2,3,4,5,6),
  col2(b1, b2, b3, b4, b5, b6) AS 
  (
    SELECT 
		a1 * 2
		,a2 * 2
		,a3 * 2
		,a4 * 2
		,a5 * 2
		,a6 * 2
    FROM col1
  )
SELECT *
FROM col1, col2</pre> </p>
<p><strong><code>Please try the different solution for this puzzle and share it via comment...</code></strong></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
