Computers are dumb. And they will do exactly what you ask them to do. The trick often is to think as dumb as the computer. Sadly it is all to easy to assume that the computer is 'thinking' like you are and blunder into a head scratching puzzle. Recently there was a post on MySQL Community Space Groundbreakers Developer Community site that shows that sometimes what is intended is not what you want but you are getting exactly what you asked.
Quiz -- What happens if you run the following query?
SELECT concat('CREATE TABLE if does not exists
sakila1.',
TABLE_NAME,
' like sakila.',
TABLE_NAME, ';')
FROM information_schema.`TABLES`
WHERE TABLE_SCHEMA = 'sakila'
A) You will …
[Read more]