WordPress posts may be randomly displayed using the “Get random results from a MySql table” tip placed in a simple plugin. What this plugin does is to simply ad the “RAND()” value to “ORDER BY” clause in the sql query which retrieves the WordPress posts.
It is possible to retrieve random results from a MySql table using the RAND() mathematical function. In order to get the random results the RAND() function needs to be used in the ORDER BY clause.
In order to insert value 0 in a field that is set as primary key for a MySQL table you need to execute the following query prior to any insert query: SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
Disabling foreign key checks in MySQL is usefull when you are dealing with tables that use foreign keys (InnoDB engine).