<?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>AquilaX's development blog &#187; MySql</title>
	<atom:link href="http://dev.horemag.net/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.horemag.net</link>
	<description>code and so on...</description>
	<lastBuildDate>Thu, 02 Feb 2012 08:29:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Randomize timestamp in MySQL</title>
		<link>http://dev.horemag.net/2009/02/16/randomize-timestamp-in-mysql/</link>
		<comments>http://dev.horemag.net/2009/02/16/randomize-timestamp-in-mysql/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 20:09:11 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[randomize]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=79</guid>
		<description><![CDATA[To randomize timestamp column in mysql You can use the following statement:
&#160;
UPDATE your_table SET
timestamp_field = TIMESTAMPADD&#40;MINUTE, RAND&#40;&#41;*60,timestamp_field&#41;;
&#160;
]]></description>
			<content:encoded><![CDATA[<p>To randomize timestamp column in mysql You can use the following statement:</p>
<pre class="sql">&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> your_table <span style="color: #993333; font-weight: bold;">SET</span>
timestamp_field = TIMESTAMPADD<span style="color: #66cc66;">&#40;</span>MINUTE, RAND<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #cc66cc;">60</span>,timestamp_field<span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2009/02/16/randomize-timestamp-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Database Alias</title>
		<link>http://dev.horemag.net/2008/11/07/mysql-database-alias/</link>
		<comments>http://dev.horemag.net/2008/11/07/mysql-database-alias/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 15:11:19 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=62</guid>
		<description><![CDATA[Sure, it's not possible to create alias for database in MySQL but here's a good workaround.
Don't forget to set the perditions for the alias as well. 
]]></description>
			<content:encoded><![CDATA[<p>Sure, it's not possible to create alias for database in MySQL but <a href="http://rymerheason.blogspot.com/2008/05/create-alias-for-your-mysql-database.html" onclick="javascript:urchinTracker('/outbound/article/http://rymerheason.blogspot.com/2008/05/create-alias-for-your-mysql-database.html');">here</a>'s a good workaround.<br />
Don't forget to set the perditions for the alias as well. </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/11/07/mysql-database-alias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL UNION DISTINCT with result priority</title>
		<link>http://dev.horemag.net/2008/07/31/mysql-union-distinct-with-result-priority/</link>
		<comments>http://dev.horemag.net/2008/07/31/mysql-union-distinct-with-result-priority/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 11:47:16 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=59</guid>
		<description><![CDATA[I had to modify the search algorithm today, the idea was to fetch the exact matches first then the split words matches. The status quo was:
&#160;
&#40;SELECT product_id FROM products WHERE a=1&#41;
  UNION DISTINCT
&#40;SELECT product_id FROM products WHERE a=2 OR a=1&#41;
&#160;
I wanted to be sure that the result from the first sub-query are before the [...]]]></description>
			<content:encoded><![CDATA[<p>I had to modify the search algorithm today, the idea was to fetch the exact matches first then the split words matches. The status quo was:</p>
<pre class="mysql">&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">UNION</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">2</span> <span style="color: #993333; font-weight: bold;">OR</span> a=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
&nbsp;</pre>
<p>I wanted to be sure that the result from the first sub-query are before the second one. The first thing that kame to my mind was:</p>
<pre class="mysql">&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id, <span style="color: #cc66cc;">1</span> as priority <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">UNION</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id, <span style="color: #cc66cc;">2</span> as priority <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">2</span> <span style="color: #993333; font-weight: bold;">OR</span> a=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> priority
&nbsp;</pre>
<p>but unfortunately this breaks the UNION DISTINCT clause and the results are duplicated.</p>
<p>I came out with the following solution:</p>
<pre class="mysql">&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> MIN<span style="color: #66cc66;">&#40;</span>priority<span style="color: #66cc66;">&#41;</span> AS priority, product_id
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id, <span style="color: #cc66cc;">5</span> AS priority <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">UNION</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> product_id, <span style="color: #cc66cc;">6</span> AS priority <span style="color: #993333; font-weight: bold;">FROM</span> products <span style="color: #993333; font-weight: bold;">WHERE</span> a=<span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">OR</span> a=<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> AS t
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #66cc66;">&#40;</span>product_id<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> priority
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/07/31/mysql-union-distinct-with-result-priority/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Tags database schemas</title>
		<link>http://dev.horemag.net/2008/04/01/tags-database-schemas/</link>
		<comments>http://dev.horemag.net/2008/04/01/tags-database-schemas/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 10:53:06 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/?p=57</guid>
		<description><![CDATA[A great article about tags database schemas can be found here.
]]></description>
			<content:encoded><![CDATA[<p>A great article about <strong>tags</strong> database schemas can be found <a href="http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html" onclick="javascript:urchinTracker('/outbound/article/http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html');">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/04/01/tags-database-schemas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin change session expire time</title>
		<link>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/</link>
		<comments>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 09:17:37 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/</guid>
		<description><![CDATA[To change phpMyAdmin's default session expire time (1800 s), change the 'LoginCookieValidity' setting to whatever value of seconds You like.
From the phpMyAdmin's wiki's Config page.
LoginCookieValidity
Define how long (in seconds) a login cookie is valid.
$cfg['LoginCookieValidity'] = 1800;
Maximum value is 2^31-1 , which is around 2.1 * 10^9. This is about 58 years.
If you are on a [...]]]></description>
			<content:encoded><![CDATA[<p>To change <a href="http://www.phpmyadmin.net" onclick="javascript:urchinTracker('/outbound/article/http://www.phpmyadmin.net');">phpMyAdmin</a>'s default session expire time (1800 s), change the 'LoginCookieValidity' setting to whatever value of seconds You like.<br />
From the phpMyAdmin's wiki's <a href="http://wiki.cihar.com/pma/Config" onclick="javascript:urchinTracker('/outbound/article/http://wiki.cihar.com/pma/Config');">Config page</a>.</p>
<blockquote><p><strong>LoginCookieValidity</strong><br />
Define how long (in seconds) a login cookie is valid.</p>
<pre>$cfg['LoginCookieValidity'] = 1800;</pre>
<p>Maximum value is 2^31-1 , which is around 2.1 * 10^9. This is about 58 years.<br />
If you are on a 64-bit system it is even longer. 2^63-1. Longer than the age of the universe.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/11/20/phpmyadmin-change-session-expire-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

