To randomize timestamp column in mysql You can use the following statement:
UPDATE your_table SET
timestamp_field = TIMESTAMPADD(MINUTE, RAND()*60,timestamp_field);
AquilaX’s development blog
Category Archives: MySql
Randomize timestamp in MySQL
MySQL Database Alias
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.
MySQL UNION DISTINCT with result priority
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:
(SELECT product_id FROM products WHERE a=1)
UNION DISTINCT
(SELECT product_id FROM products WHERE a=2 OR a=1)
I wanted to be sure that the result from the first sub-query are before the [...]
Tags database schemas
A great article about tags database schemas can be found here.
phpMyAdmin change session expire time
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 [...]