<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Type conversion semantics of MySQL&#8217;s BETWEEN operator</title>
	<atom:link href="http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/</link>
	<description>Stay curious!</description>
	<pubDate>Tue, 07 Oct 2008 03:02:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: mikec</title>
		<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/#comment-14226</link>
		<dc:creator>mikec</dc:creator>
		<pubDate>Mon, 18 Feb 2008 19:50:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=221#comment-14226</guid>
		<description>I mean mysql does NOT always convert operands of between to the type of the first one in my previous post.</description>
		<content:encoded><![CDATA[<p>I mean mysql does NOT always convert operands of between to the type of the first one in my previous post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikec</title>
		<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/#comment-14225</link>
		<dc:creator>mikec</dc:creator>
		<pubDate>Mon, 18 Feb 2008 19:47:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=221#comment-14225</guid>
		<description>Here is an example that shows mysql does convert between operators to the type of the first one.
select * from t1
where '5' between 3 and '10';

The first operand is a string, if mysql convert 3 to string and using string comparison , it would return empty table because '5' </description>
		<content:encoded><![CDATA[<p>Here is an example that shows mysql does convert between operators to the type of the first one.<br />
select * from t1<br />
where &#8216;5&#8242; between 3 and &#8216;10&#8242;;</p>
<p>The first operand is a string, if mysql convert 3 to string and using string comparison , it would return empty table because &#8216;5&#8242;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/#comment-4129</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Fri, 16 Feb 2007 14:17:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=221#comment-4129</guid>
		<description>&lt;p&gt;Hi shawnc, you are facing problems because your data is not properly normalized; there is no such thing as an "array" in SQL.  I recommend you read on normalization.  MySQL has a &lt;a href="http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html" rel="nofollow"&gt;very good article on normalization&lt;/a&gt;, and there are others as well.  If you are still having troubles, try connecting to #mysql on IRC -- you are likely to have a series of questions as you learn SQL's initially awkward way to do things.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi shawnc, you are facing problems because your data is not properly normalized; there is no such thing as an &#8220;array&#8221; in SQL.  I recommend you read on normalization.  MySQL has a <a href="http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html" rel="nofollow" onclick="javascript:urchinTracker ('/outbound/comment/dev.mysql.com');">very good article on normalization</a>, and there are others as well.  If you are still having troubles, try connecting to #mysql on IRC &#8212; you are likely to have a series of questions as you learn SQL&#8217;s initially awkward way to do things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shawnc</title>
		<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/#comment-4124</link>
		<dc:creator>shawnc</dc:creator>
		<pubDate>Fri, 16 Feb 2007 12:10:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=221#comment-4124</guid>
		<description>&lt;p&gt;Hello, I am trying to solve a problem where my data inside the table is stored in a array of 1,2,3,4,5,6  I need to check if a user entered number is within this array.  Is this possible with the between operator?&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hello, I am trying to solve a problem where my data inside the table is stored in a array of 1,2,3,4,5,6  I need to check if a user entered number is within this array.  Is this possible with the between operator?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/#comment-1793</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Wed, 13 Sep 2006 13:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=221#comment-1793</guid>
		<description>&lt;p&gt;Something I inferred, but didn't write very clearly, was this: I wonder if BETWEEN tries to convert everything to the same type as its first operand?  In other words, does "NUMBER BETWEEN DATE AND STRING" cast everything to a number?  Is there an easy way to test this theory, or is it time to hit the source code?&lt;/p&gt;

&lt;p&gt;I'm experimenting with queries like the following:&lt;/p&gt;

&lt;pre&gt;select '5e2' between 501 and date('2006-05-01');
select 500 between '5e2' and date('2006-05-01');&lt;/pre&gt;

&lt;p&gt;As far as I can tell, BETWEEN tries to convert all three operands to the type of the first operand.  I have a feeling that the answer will clear everything up here.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Something I inferred, but didn&#8217;t write very clearly, was this: I wonder if BETWEEN tries to convert everything to the same type as its first operand?  In other words, does &#8220;NUMBER BETWEEN DATE AND STRING&#8221; cast everything to a number?  Is there an easy way to test this theory, or is it time to hit the source code?</p>
<p>I&#8217;m experimenting with queries like the following:</p>
<pre>select '5e2' between 501 and date('2006-05-01');
select 500 between '5e2' and date('2006-05-01');</pre>
<p>As far as I can tell, BETWEEN tries to convert all three operands to the type of the first operand.  I have a feeling that the answer will clear everything up here.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
