~drizzle-trunk/drizzle/development

1994.5.16 by Stewart Smith
remove \r at end of line as they cause kitten injuries.
1
RENAME
1878.5.6 by Brian Aker
A couple of fixes to documentation.
2
======
3
4
Rename a table, or group of tables.
1945.3.9 by Marisa Plumb
changes in cross-references
5
1994.4.123 by Marisa Plumb
doc fixes
6
If you have an existing table old_name, you can create another table new_name; it will be empty but reptant he same structure, and then replace the existing table with the empty one as follows (assuming backup_table does not already exist):
7
8
.. code-block:: mysql
9
10
	CREATE TABLE new_name (...);
11
	RENAME TABLE old_name TO backup_table, new_name TO old_name;
12
13
When using a statement to rename more than one table, the order of operations are done from left to right. To swap two table names, use the following (assuming tmp_table does not already exist):
14
15
.. code-block:: mysql
16
17
	RENAME TABLE old_name TO tmp_table,
18
        new_name TO old_name,
19
        tmp_table TO new_name;
20
21
While RENAME is running, no other session can access any of the involved tables. 
22
2449.3.1 by Mark Atwood
RST admonitions like note and warning should have a new line before the content
23
.. seealso:: :doc:`/alter_table`