Xiaobo, Using mysqldump, you can specify which tables to copy. The man for mysqldump is as such: mysqldump [options] [dbname [tablename....]]
Say db 'db' has tables x, y, and z in it. You only want to copy table x. mysqldump db x > x.sql(or whatever you want to name it). Dan Thank you Shawn. What I originally thought is that if there is any command like 'sqldump' to copy a few tables of a database. Xiaobo > "Xiaobo Chen" <[EMAIL PROTECTED]> wrote on 01/16/2006 03:33:36 PM: >> Hi, all >> >> How should I copy a table of a database? >> >> Thanks in advance. >> >> Xiaobo >> -- >> Faculty of Computer Science >> Dalhousie University >> Halifax, Nova Scotia >> Canada > > Do you want the data or the structure too? > > Just the data: > > CREATE TABLE newtable SELECT * from oldtable; > > Data and the original structure (no foreign keys): > > CREATE TABLE newtable LIKE oldtable; > INSERT newtable SELECT * FROM oldtable; > > Both forms of CREATE TABLE documented here: > http://dev.mysql.com/doc/refman/4.1/en/create-table.html > > Shawn Green > Database Administrator > Unimin Corporation - Spruce Pine -- Faculty of Computer Science Dalhousie University Halifax, Nova Scotia Canada -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]