Bug #26947 CREATE TABLE description AS SHOW COLUMNS FROM db.table
Submitted: 8 Mar 2007 6:10 Modified: 13 Mar 2007 13:54
Reporter: Hans Ginzel Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version:5.0.26-community-nt OS:Windows (MS Windows XP)
Assigned to: CPU Architecture:Any
Tags: create table show

[8 Mar 2007 6:10] Hans Ginzel
Description:
There should be possibility to create tables not only from select statements (CREATE TABLE t AS SELECT) but from all SHOW statements (CREATE TABLE t AS SHOW ...).

How to repeat:
CREATE TABLE d AS SHOW COLUMNS FROM mysql.user

Suggested fix:
Modify CREATE TABLE t AS SELECT statement.
[13 Mar 2007 11:41] Sveta Smirnova
Thank you for the report.

This feature has already implemented.

Read about CREATE TABLE new_tbl LIKE orig_tbl at http://dev.mysql.com/doc/refman/5.0/en/create-table.html
[13 Mar 2007 13:54] Hans Ginzel
CREATE TABLE ... LIKE does not solve this feature request!

CREATE TABLE new_name LIKE existing_table; creates an empty table with the same columns, indexes as the existing table has.

But CREATE TABLE new_name AS SHOW columns FROM existing_table; should create table  with columns Field, Type, Null, Key, Default, Extra, Comment with one record for each column of the existing_table. Something like information_schema.columns but with original case of column names.

Should be supported for all SHOW statements.