<?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>having Archives - Huahua&#039;s Tech Road</title>
	<atom:link href="https://zxi.mytechroad.com/blog/tag/having/feed/" rel="self" type="application/rss+xml" />
	<link>https://zxi.mytechroad.com/blog/tag/having/</link>
	<description></description>
	<lastBuildDate>Tue, 03 Apr 2018 05:55:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.8</generator>

<image>
	<url>https://zxi.mytechroad.com/blog/wp-content/uploads/2017/09/cropped-photo-32x32.jpg</url>
	<title>having Archives - Huahua&#039;s Tech Road</title>
	<link>https://zxi.mytechroad.com/blog/tag/having/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>花花酱 LeetCode 596. Classes More Than 5 Students</title>
		<link>https://zxi.mytechroad.com/blog/sql/leetcode-596-classes-more-than-5-students/</link>
					<comments>https://zxi.mytechroad.com/blog/sql/leetcode-596-classes-more-than-5-students/#respond</comments>
		
		<dc:creator><![CDATA[zxi]]></dc:creator>
		<pubDate>Tue, 03 Apr 2018 05:55:48 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[having]]></category>
		<guid isPermaLink="false">http://zxi.mytechroad.com/blog/?p=2410</guid>

					<description><![CDATA[<p>Problem There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the table: +---------+------------+&#8230;</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/sql/leetcode-596-classes-more-than-5-students/">花花酱 LeetCode 596. Classes More Than 5 Students</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1><strong>Problem</strong></h1>
<p>There is a table <code>courses</code> with columns: <b>student</b> and <b>class</b></p>
<p>Please list out all classes which have more than or equal to 5 students.</p>
<p>For example, the table:</p>
<pre class="crayon:false">+---------+------------+
| student | class      |
+---------+------------+
| A       | Math       |
| B       | English    |
| C       | Math       |
| D       | Biology    |
| E       | Math       |
| F       | Computer   |
| G       | Math       |
| H       | Math       |
| I       | Math       |
+---------+------------+
</pre>
<p>Should output:</p>
<pre class="crayon:false ">+---------+
| class   |
+---------+
| Math    |
+---------+
</pre>
<p><b>Note:</b><br />
The students should not be counted duplicate in each course.</p>
<h1><strong>Solution</strong></h1>
<p>SQL</p><pre class="crayon-plain-tag"># Author: Huahua
# Running time: 1756 ms
select class from courses group by class having count(distinct student) &gt;= 5</pre><p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/sql/leetcode-596-classes-more-than-5-students/">花花酱 LeetCode 596. Classes More Than 5 Students</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zxi.mytechroad.com/blog/sql/leetcode-596-classes-more-than-5-students/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
