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

<channel>
	<title>Carsten's Random Ramblings &#187; Pop Quiz</title>
	<atom:link href="http://www.bitbybit.dk/carsten/blog/?feed=rss2&#038;cat=8" rel="self" type="application/rss+xml" />
	<link>http://www.bitbybit.dk/carsten/blog</link>
	<description>on MySQL, PHP, programming and stuff</description>
	<pubDate>Mon, 03 May 2010 19:58:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>More MySQL quizzes</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=275</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=275#comments</comments>
		<pubDate>Sat, 06 Feb 2010 13:05:10 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=275</guid>
		<description><![CDATA[Not quite pop quiz format, but if you enjoyed the ones I published some time ago (almost 2 years ago now&#8230; how time flies), you&#8217;ll probably be interested to know that &#8220;plogi&#8221; and &#8220;urs&#8221; (whoever they are) have picked up on the idea and started on their own set of questions and answers.
Do pay them [...]]]></description>
			<content:encoded><![CDATA[<p>Not quite pop quiz format, but if you enjoyed <a href="http://www.bitbybit.dk/carsten/blog/?page_id=158">the ones I published</a> some time ago (almost 2 years ago now&#8230; how time flies), you&#8217;ll probably be interested to know that  <a href="http://www.bitbybit.dk/carsten/blog/?p=275#more-275" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=275</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #29</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=214</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=214#comments</comments>
		<pubDate>Thu, 25 Sep 2008 07:27:54 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=214</guid>
		<description><![CDATA[Yet another quiz inspired by Freenode#mysql IRC discussions. If you haven&#8217;t been around on the channel lately, you should have a peek. Lots of interesting discussions going on!
mysql&#62; SELECT c1, c2 FROM t WHERE c2 LIKE 'a%';
+------+------+
&#124; c1   &#124; c2   &#124;
+------+------+
&#124; a    &#124; abc  &#124;
+------+------+
Is the following construct for the LIKE clause legal?
SELECT c1, c2 [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another quiz inspired by Freenode#mysql IRC discussions. If you haven&#8217;t been around on the channel lately, you should have a peek. Lots of interesting discussions going on!</p>
<pre>mysql&gt; SELECT c1, c2 FROM t WHERE c2 LIKE 'a%';
+------+------+
| c1   | c2   |
+------+------+
| a    | abc  |
+------+------+</pre>
<p>Is the following construct for the LIKE clause legal?</p>
<pre>SELECT c1, c2 FROM t WHERE c2 LIKE CONCAT('a', '%');</pre>
<p>And how about this one?</p>
<pre>SELECT c1, c2 FROM t WHERE c2 LIKE CONCAT(c1, '%');</pre>
<p>Bonus question: Suppose the table has many rows, several more columns and there&#8217;s an index on (c2, c1). Could that index be utilized when running the legal versions of the query &#8212; and if so, how?</p>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=214#more-214" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=214</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #28</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=211</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=211#comments</comments>
		<pubDate>Wed, 24 Sep 2008 06:45:06 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=211</guid>
		<description><![CDATA[Don&#8217;t forget to send in your suggestions for new quizzes!
This quiz originated on FreeNode#mysql, where someone asked how to count the number of newline-separated &#8220;fields&#8221; in a TEXT column. For the purposes of the quiz, I&#8217;ve changed the idea slightly but you should be able to appreciate the usefulness of this method for any x-separated [...]]]></description>
			<content:encoded><![CDATA[<p><em>Don&#8217;t forget to send in your suggestions for new quizzes!</em></p>
<p>This quiz originated on FreeNode#mysql, where someone asked how to count the number of newline-separated &#8220;fields&#8221; in a TEXT column. For the purposes of the quiz, I&#8217;ve changed the idea slightly but you should be able to appreciate the usefulness of this method for any x-separated data that you have to deal with.</p>
<p>Given the following data&#8230;</p>
<pre>mysql&gt; SELECT * FROM t;
+-----------+
| s         |
+-----------+
| aba       |
| abacad    |
| abacadaea |
+-----------+</pre>
<p>&#8230;create a query which counts the number of occurrences of the character &#8216;a&#8217; in each line, e.g.</p>
<pre>mysql&gt; SELECT s, &lt;something&gt; AS count_a
    -&gt; FROM t;
+-----------+---------+
| s         | count_a |
+-----------+---------+
| aba       |       2 |
| abacad    |       3 |
| abacadaea |       5 |
+-----------+---------+</pre>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=211#more-211" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=211</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;My turn to play MySQL&#8221;</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=205</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=205#comments</comments>
		<pubDate>Thu, 28 Aug 2008 19:29:55 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=205</guid>
		<description><![CDATA[[Update: A couple of people have told me they really like "your game". I am not the creator of this game; I merely point to it. To my knowledge, I don't know any of the people involved in creating it.]
&#8220;The ATTACK query is an undocumented feature of the development 	 branch of MySQL&#8230;&#8221;
With the popularity [...]]]></description>
			<content:encoded><![CDATA[<p>[<em>Update: A couple of people have told me they really like "your game". I am not the creator of this game; I merely point to it. To my knowledge, I don't know any of the people involved in creating it.</em>]</p>
<blockquote><p>&#8220;The ATTACK query is an undocumented feature of the development 	 branch of MySQL&#8230;&#8221;</p></blockquote>
<p>With the popularity of MySQL  I guess it was just a question of time before someone came up with a game not just <em>based</em> on MySQL, but also with the <em>theme</em> of MySQL. In the words of the website&#8230;</p>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=205#more-205" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=205</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #27</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=202</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=202#comments</comments>
		<pubDate>Tue, 29 Apr 2008 07:44:18 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=202</guid>
		<description><![CDATA[I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
This wonderful quiz from Vladimir Kolesnikov is one of those that should make you stop and think for a moment&#8230;
Given this table and data:
mysql&#62; SELECT * FROM t;
+------+------+
&#124; i1 [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!</em></p>
<p>This wonderful quiz from <a href="http://ritmark.com">Vladimir Kolesnikov</a> is one of those that should make you stop and think for a moment&#8230;</p>
<p>Given this table and data:</p>
<pre>mysql&gt; SELECT * FROM t;
+------+------+
| i1   | i2   |
+------+------+
|    1 |    2 |
|    2 |    1 |
|    4 |    3 |
|    3 |    4 |
+------+------+
4 rows in set (0.00 sec)</pre>
<p>What is the result of the following three statements?</p>
<pre>SELECT * FROM t ORDER BY 1</pre>
<pre>SELECT * FROM t ORDER BY 2</pre>
<pre>SELECT * FROM t ORDER BY 1+1</pre>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=202#more-202" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=202</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #26</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=197</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=197#comments</comments>
		<pubDate>Thu, 24 Apr 2008 07:13:20 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=197</guid>
		<description><![CDATA[I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
Today&#8217;s quiz question, which subsequently became three, comes courtesy of Janek Bogucki.
Since questions 2 and 3 contain hints on the other questions, they are embedded within the answers to [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!</em></p>
<p>Today&#8217;s quiz question, which subsequently became three, comes courtesy of <a href="http://selectstarfromjdb.blogspot.com/">Janek Bogucki</a>.</p>
<p>Since questions 2 and 3 contain hints on the other questions, they are embedded within the answers to previous questions.</p>
<p><strong>Question 1</strong>: What happens if you throw the following statement at your MySQL server?</p>
<pre>CREATE TABLE log(
name CHAR(20) NOT NULL,
count INT UNSIGNED NOT NULL
)</pre>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=197#more-197" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=197</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #25</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=196</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=196#comments</comments>
		<pubDate>Wed, 23 Apr 2008 07:42:03 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=196</guid>
		<description><![CDATA[I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
This quiz on INFORMATION_SCHEMA is stolen (with permission!), from Roland:

Specify a minimal set of columns of the information_schema.TABLE_CONSTRAINTS table that is sufficient to reliably identify a single row in [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!</em></p>
<p>This quiz on <code>INFORMATION_SCHEMA</code> is stolen (with permission!), from <a href="http://rpbouman.blogspot.com">Roland</a>:</p>
<ul>
<li>Specify a minimal set of columns of the <code>information_schema.TABLE_CONSTRAINTS</code> table that is sufficient to reliably identify a single row in the <code>information_schema.TABLE_CONSTRAINTS</code> table.</li>
<li>Argue why these columns are necessary and sufficient to identify a row, and why a smaller set of columns does not exist</li>
</ul>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=196#more-196" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=196</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #24</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=192</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=192#comments</comments>
		<pubDate>Tue, 15 Apr 2008 08:03:40 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=192</guid>
		<description><![CDATA[I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
What happens if you try to enter the following command into MySQL?
CREATE TABLE t1 (
i INT,
INDEX i (i)
);

Show answer
Answer:The table will be created. While column names and index names [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!</em></p>
<p>What happens if you try to enter the following command into MySQL?</p>
<p><code>CREATE TABLE t1 (<br />
i INT,<br />
INDEX i (i)<br />
);</code></p>
<p> <a href="http://www.bitbybit.dk/carsten/blog/?p=192#more-192" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=192</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quiz #23</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=187</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=187#comments</comments>
		<pubDate>Mon, 14 Apr 2008 16:30:07 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=187</guid>
		<description><![CDATA[I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
Here&#8217;s something I came across several months back. Watch in wonder as we create a PRIMARY KEY which is already there, then drop it again, only and to see [...]]]></description>
			<content:encoded><![CDATA[<p><em>I&#8217;m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!</em></p>
<p>Here&#8217;s something I came across several months back. Watch in wonder as we create a PRIMARY KEY which is already there, then drop it again, only and to see that it&#8217;s still present in the table&#8230;:</p>
<pre>mysql&gt; DESC t1;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i     | int(11) | NO   | PRI |         |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql&gt; ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 1091 (42000): Can't DROP 'PRIMARY'; check that column/key exists
mysql&gt; ALTER TABLE t1 ADD PRIMARY KEY(i);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql&gt; DESC t1;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i     | int(11) | NO   | PRI |         |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql&gt; ALTER TABLE t1 DROP PRIMARY KEY;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql&gt; DESC t1;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i     | int(11) | NO   | PRI |         |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)</pre>
<p>Explain (or simply read the answer to see) how that sequence of events is possible. <a href="http://www.bitbybit.dk/carsten/blog/?p=187#more-187" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=187</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Pop Quizzes: Now in Spanish and Russian!</title>
		<link>http://www.bitbybit.dk/carsten/blog/?p=188</link>
		<comments>http://www.bitbybit.dk/carsten/blog/?p=188#comments</comments>
		<pubDate>Mon, 14 Apr 2008 10:02:15 +0000</pubDate>
		<dc:creator>Carsten</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Pop Quiz]]></category>

		<guid isPermaLink="false">http://www.bitbybit.dk/carsten/blog/?p=188</guid>
		<description><![CDATA[Thanks to Marcos Besteiro and Andrew Dashin, the MySQL Pop Quizzes are now available in Spanish and Russian!
Thanks for the hard work, guys! It&#8217;s great to see that people are finding this worthwhile. I will try to get around to linking up the individual quizzes as soon as I find some time.
If you wish to [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.propiedadprivada.com/">Marcos Besteiro</a> and <a href="http://ru.andrewdashin.com/">Andrew Dashin</a>, the <a href="http://www.bitbybit.dk/carsten/blog/?page_id=158">MySQL Pop Quizzes</a> are now available in <a href="http://www.propiedadprivada.com/search/test+quiz">Spanish</a> and <a href="http://ru.andrewdashin.com/category/quiz/mysql/">Russian</a>!</p>
<p>Thanks for the hard work, guys! It&#8217;s great to see that people are finding this worthwhile. I will try to get around to linking up the individual quizzes as soon as I find some time.</p>
<p><em>If you wish to translate the quizzes into your own language, please contact me at carsten (at) bitbybit (dot) dk before you start so we can sort out the details.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbybit.dk/carsten/blog/?feed=rss2&amp;p=188</wfw:commentRss>
		</item>
	</channel>
</rss>
