1

I've been reading the MariaDB manual and tutorials and apparently this should work:

EXPLAIN CREATE TABLE `prefix_database2`.`table1` LIKE `prefix_database1`.`table1`;`

The LIKE operator is supposed to duplicate the table columns and keys. I'm at a loss at why I'm getting the syntax error.

How do I duplicate a table in a second database from the first while maintaining the exact same columns, keys, etc?

John
  • 757
  • 1
  • 10
  • 23

1 Answers1

1

EXPLAIN doesn't support CREATE TABLE

the supported commands are:

EXPLAIN tbl_name [col_name | wild]

Or

EXPLAIN [EXTENDED | PARTITIONS | FORMAT=JSON] {SELECT select_options | UPDATE update_options | DELETE delete_options}

see manual

Use the CREATE command without EXPLAIN and it works as expected

nbk
  • 8,699
  • 6
  • 14
  • 27