Stewart learns more SQL oddities (or WTFs)

In what situation will this succeed:

ALTER TABLE t1 RENAME t2;

but this fail:

RENAME TABLE t1 TO t2;

?

Highlight the white text below for the answer:

When t1 is a temporary table.

Wow… I wonder why that is, I can’t think of any good reason…

3 thoughts on “Stewart learns more SQL oddities (or WTFs)

  1. Hi Stewart!

    Also when you have a non-temporary table and you are under LOCK TABLES.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.