<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.sqlzoo.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.sqlzoo.net/w/index.php?title=Subset&amp;feed=atom&amp;action=history</id>
		<title>Subset - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.sqlzoo.net/w/index.php?title=Subset&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://www.sqlzoo.net/w/index.php?title=Subset&amp;action=history"/>
		<updated>2013-05-24T07:21:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.4</generator>

	<entry>
		<id>http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3311&amp;oldid=prev</id>
		<title>Connor at 10:02, 8 August 2012</title>
		<link rel="alternate" type="text/html" href="http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3311&amp;oldid=prev"/>
				<updated>2012-08-08T10:02:51Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:02, 8 August 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $sql = &amp;quot;SELECT username, score FROM highscore &amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $sql = &amp;quot;SELECT username, score FROM highscore &amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;  .&amp;quot;ORDER BY score DESC&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;  .&amp;quot;ORDER BY score DESC&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $cursor = mysql_query($sql) or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $cursor = &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160;  &lt;/ins&gt;mysql_query($sql) or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $i = 0;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $i = 0;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; while ($line = mysql_fetch_array($cursor,MYSQL_ASSOC)){&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; while ($line = &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;/ins&gt;mysql_fetch_array($cursor,MYSQL_ASSOC)){&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if ($i++&amp;gt;9) {break;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if ($i++&amp;gt;9) {break;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; print &amp;quot;Position &amp;quot;.$i.&amp;quot;,&amp;quot;.$line{username}.&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; print &amp;quot;Position &amp;quot;.$i.&amp;quot;,&amp;quot;.$line{username}.&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	<entry>
		<id>http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3310&amp;oldid=prev</id>
		<title>Connor at 10:02, 8 August 2012</title>
		<link rel="alternate" type="text/html" href="http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3310&amp;oldid=prev"/>
				<updated>2012-08-08T10:02:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:02, 8 August 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;To get the top 10 you could write in PHP:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;To get the top 10 you could write in PHP:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;?&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; mysql_connect('localhost','username','password') or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; mysql_connect('localhost','username','password') &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; mysql_select_db('dbname')&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  &lt;/ins&gt;or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; mysql_select_db('dbname')&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  &lt;/ins&gt;or die(mysql_error());&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $sql = &amp;quot;SELECT username, score FROM highscore &amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $sql = &amp;quot;SELECT username, score FROM highscore &amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;  .&amp;quot;ORDER BY score DESC&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;  .&amp;quot;ORDER BY score DESC&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 38:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; while ($line = mysql_fetch_array($cursor,MYSQL_ASSOC)){&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; while ($line = mysql_fetch_array($cursor,MYSQL_ASSOC)){&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if ($i++&amp;gt;9) {break;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if ($i++&amp;gt;9) {break;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; print &amp;quot;Position &amp;quot;.$i.&amp;quot;,&amp;quot;.$line{username}.&amp;quot;,&amp;quot;.$line{score}.&amp;quot;\n&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; print &amp;quot;Position &amp;quot;.$i.&amp;quot;,&amp;quot;.$line{username}.&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;/ins&gt;&amp;quot;.$line{score}.&amp;quot;\n&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; ?&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; ?&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	<entry>
		<id>http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3309&amp;oldid=prev</id>
		<title>Connor: Created page with &quot;&lt;p&gt;In this example you are shown how to get subsets from tables.&lt;/p&gt; &lt;p&gt;You may have a table with thousands of entries but you only want to pick the top 10,&lt;/p&gt; &lt;p&gt;to do this ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.sqlzoo.net/w/index.php?title=Subset&amp;diff=3309&amp;oldid=prev"/>
				<updated>2012-08-08T10:01:39Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;p&amp;gt;In this example you are shown how to get subsets from tables.&amp;lt;/p&amp;gt; &amp;lt;p&amp;gt;You may have a table with thousands of entries but you only want to pick the top 10,&amp;lt;/p&amp;gt; &amp;lt;p&amp;gt;to do this ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;p&amp;gt;In this example you are shown how to get subsets from tables.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;You may have a table with thousands of entries but you only want to pick the top 10,&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;to do this different methods have to be used for the different platforms.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div class='ht'&amp;gt;&lt;br /&gt;
&amp;lt;div class=params&amp;gt;schema:scott&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='tidy'&amp;gt;DROP TABLE highscore&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='setup'&amp;gt;CREATE TABLE highscore (&lt;br /&gt;
   username VARCHAR(20),&lt;br /&gt;
   score INT );&lt;br /&gt;
INSERT INTO highscore VALUES ('gordon',10);&lt;br /&gt;
INSERT INTO highscore VALUES ('user01',20);&lt;br /&gt;
INSERT INTO highscore VALUES ('user02',30);&lt;br /&gt;
INSERT INTO highscore VALUES ('user03',40);&lt;br /&gt;
INSERT INTO highscore VALUES ('user04',50);&lt;br /&gt;
INSERT INTO highscore VALUES ('user05',60);&lt;br /&gt;
INSERT INTO highscore VALUES ('user06',70);&lt;br /&gt;
INSERT INTO highscore VALUES ('user07',80);&lt;br /&gt;
INSERT INTO highscore VALUES ('user08',90);&lt;br /&gt;
INSERT INTO highscore VALUES ('user09',100);&lt;br /&gt;
INSERT INTO highscore VALUES ('user10',110);&lt;br /&gt;
INSERT INTO highscore VALUES ('user11',120);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
For testing purposes we have the following:&lt;br /&gt;
 CREATE TABLE highscore (username VARCHAR(20), score INT);&lt;br /&gt;
 INSERT INTO highscore VALUES ('gordon',10);&lt;br /&gt;
 INSERT INTO highscore VALUES ('user01',20);&lt;br /&gt;
 ...&lt;br /&gt;
 INSERT INTO highscore VALUES ('user02',120);&lt;br /&gt;
To get the top 10 you could write in PHP:&lt;br /&gt;
 &amp;lt;?&lt;br /&gt;
 mysql_connect('localhost','username','password') or die(mysql_error());&lt;br /&gt;
 mysql_select_db('dbname')                        or die(mysql_error());&lt;br /&gt;
 $sql = &amp;quot;SELECT username, score FROM highscore &amp;quot;&lt;br /&gt;
       .&amp;quot;ORDER BY score DESC&amp;quot;;&lt;br /&gt;
 $cursor = mysql_query($sql) or die(mysql_error());&lt;br /&gt;
 $i = 0;&lt;br /&gt;
 while ($line = mysql_fetch_array($cursor,MYSQL_ASSOC)){&lt;br /&gt;
  if ($i++&amp;gt;9) {break;}&lt;br /&gt;
  print &amp;quot;Position &amp;quot;.$i.&amp;quot;,&amp;quot;.$line{username}.&amp;quot;,&amp;quot;.$line{score}.&amp;quot;\n&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def'&amp;gt;&lt;br /&gt;
SELECT username, score&lt;br /&gt;
  FROM highscore&lt;br /&gt;
  ORDER BY score DESC&lt;br /&gt;
  LIMIT 10&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;ALTER SESSION SET optimizer_goal=first_rows_10&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;&lt;br /&gt;
SELECT username, score&lt;br /&gt;
  FROM highscore&lt;br /&gt;
  ORDER BY score DESC&lt;br /&gt;
  OPTION (FAST 10)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-access'&amp;gt;&lt;br /&gt;
SELECT TOP 10 username, score&lt;br /&gt;
  FROM highscore&lt;br /&gt;
  ORDER BY score DESC&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-oracle&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;For oracle you can also use:&lt;br /&gt;
&amp;lt;pre&amp;gt;SELECT /*+first_rows(10) */ username, score&lt;br /&gt;
  FROM highscore&lt;br /&gt;
  ORDER BY score DESC&amp;lt;/pre&amp;gt;&lt;br /&gt;
and:&lt;br /&gt;
&amp;lt;pre&amp;gt;SELECT username, score FROM&lt;br /&gt;
   (SELECT username, score FROM highscore&lt;br /&gt;
    ORDER BY score DESC) t&lt;br /&gt;
    WHERE rownum &amp;lt;= 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-sqlserver&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;For sqlserver you can also use TOP:&lt;br /&gt;
&amp;lt;pre&amp;gt;SELECT TOP 10 username, score&lt;br /&gt;
  FROM highscore&lt;br /&gt;
  ORDER BY score DESC&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Hacks Ref}}&lt;/div&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	</feed>