<?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>power &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/power/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, 30 Apr 2018 13:10:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Puzzle: Calculate the Power of Three</title>
		<link>https://www.dbrnd.com/2018/05/sql-puzzle-calculate-the-power-of-three/</link>
					<comments>https://www.dbrnd.com/2018/05/sql-puzzle-calculate-the-power-of-three/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 12 May 2018 16:16:55 +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[power]]></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=7552</guid>

					<description><![CDATA[Check the below input data and expected output to get the power of three within first 100 numbers. Expected Output: [crayon-6ab55c8b76ce2978798401/] Create a table with first 100 numbers: [crayon-6ab55c8b76ce5462365466/] Solution: [crayon-6ab55c8b76ce6776765278/] 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&amp;linkname=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" 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%2F05%2Fsql-puzzle-calculate-the-power-of-three%2F&#038;title=SQL%20Puzzle%3A%20Calculate%20the%20Power%20of%20Three" data-a2a-url="https://www.dbrnd.com/2018/05/sql-puzzle-calculate-the-power-of-three/" data-a2a-title="SQL Puzzle: Calculate the Power of Three"></a></p><p>Check the below input data and expected output to get the power of three within first 100 numbers.</p>
<p><strong>Expected Output:</strong></p>
<pre class="crayon-plain-tag">PowerOfThree
------------
1
3
9
27
81</pre> </p>
<p><strong>Create a table with first 100 numbers:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Numbers 
(
   ID INT
);  

DECLARE @Counter AS INT = 1;
BEGIN
   WHILE @Counter &lt; 100 BEGIN
      INSERT INTO tbl_Numbers VALUES (@Counter);
	  SET @Counter = @Counter + 1;
   END;
END;</pre> </p>
<p><strong>Solution:</strong></p>
<pre class="crayon-plain-tag">SELECT ID AS PowerOfThree
FROM tbl_Numbers
WHERE LOG(ID, 3) = ROUND( LOG(ID, 3), 0);</pre> </p>
<p><strong><code>Please try the different solution for this puzzle and share it via comment...</code></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/05/sql-puzzle-calculate-the-power-of-three/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
