--- title: MySQLでテーブルのコピーを作成する author: kazu634 date: 2009-08-01 wordtwit_post_info: - 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4737;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}' categories: - mysql ---
「MySQLでテーブルのコピーを簡単に作る方法」を参考させていただきました(おいぬまさんとは昨年のEmacs勉強会でご一緒したような記憶が)。
MySQLでテーブルのコピーを作成する方法は下記の通りになります:
kazu634@kazu634-desktop% mysql -uusername -ppassword ~/public_html/cgi-bin [3578] Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 133 Server version: 5.0.75-0ubuntu10.2 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use sample; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> CREATE TABLE renoir_20090801 LIKE renoir; Query OK, rows affected (.15 sec) mysql> INSERT INTO renoir_20090801 SELECT * FROM renoir; Query OK, 87 rows affected (.07 sec) Records: 87 Duplicates: Warnings: mysql> exit Bye