Hello All, I have MySQL 4.0.16 on Windows 2000 pro. I am trying to create a table in an existing database. according to the manual, I can use one of these statements: 6.5.3 CREATE TABLE Syntax CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] or CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(] LIKE old_tbl_name [)];
I am trying to use the second option. I have a table students and i want to create another table students2 using the 'LIKE' students. Here are the results:
mysql> CREATE TABLE students2 LIKE students;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE students' at line 1
mysql> CREATE TABLE students2 (LIKE students);
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE students)' at line 1
1064 is ER_PARSE_ERROR
I tried all the tricks i know to no avail. I really don't see the error in this simple command,!!!. Any help would be appricated.
Farther down the manual page:
In MySQL 4.1, you can also use LIKE to create a table based on the definition of another table, including any column attributes and indexes the original table has:
CREATE TABLE new_tbl LIKE orig_tbl;
So you need 4.1 for this to work.
-- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com
MySQL Users Conference: April 14-16, 2004 http://www.mysql.com/uc2004/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]