<?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>CUME_DIST &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/cume_dist/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>Thu, 07 Dec 2017 06:50:28 +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>PostgreSQL: Calculate Percent Rank and Cumulative Percent Rank</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 31 Dec 2017 16:16:45 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[CUME_DIST]]></category>
		<category><![CDATA[Cumulative Rank]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[PERCENT_RANK]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[RANK]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6845</guid>

					<description><![CDATA[In this post, I am sharing the use of two functions of PostgreSQL which are PERCENT_RANK() and CUME_DIST(). Using these functions, we can calculate the Percent Rank and Cumulative Percent Rank of number column. We know about the normal RANK(), which generates the rank of the number. But sometimes, it requires checking the percentage instead [&#8230;]]]></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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&amp;linkname=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" 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%2F2017%2F12%2Fpostgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist%2F&#038;title=PostgreSQL%3A%20Calculate%20Percent%20Rank%20and%20Cumulative%20Percent%20Rank" data-a2a-url="https://www.dbrnd.com/2017/12/postgresql-calculate-percent-rank-and-cumulative-percent-rank-percent_rank-cume_dist/" data-a2a-title="PostgreSQL: Calculate Percent Rank and Cumulative Percent Rank"></a></p><p>In this post, I am sharing the use of two functions of PostgreSQL which are PERCENT_RANK() and CUME_DIST().<br />
Using these functions, we can calculate the Percent Rank and Cumulative Percent Rank of number column.</p>
<p>We know about the normal RANK(), which generates the rank of the number. But sometimes, it requires checking the percentage instead of rank.</p>
<p>Please check the below demonstration:</p>
<p><strong>Create a sample table with data:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_Numbers
(ID INTEGER);

INSERT INTO tbl_Numbers 
VALUES (1),(2),(3),(4),(5);</pre><p>
<strong>Calculate the Percent rank and Cumulative Percent rank:</strong></p><pre class="crayon-plain-tag">SELECT 
	ID
    ,(PERCENT_RANK() OVER win)::numeric(10, 2) as PercentRank
    ,(CUME_DIST() OVER win)::numeric(10, 2) as CumulativeRank
FROM tbl_Numbers 
WINDOW win AS (ORDER BY ID);</pre><p>
<strong>The Result:</strong></p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-6847" src="https://www.dbrnd.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-04-at-6.38.05-PM.png" alt="PostgreSQL Percentage Rank" width="622" height="332" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
