List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:June 8 1999 7:13pm
Subject:Re: table creation
View as plain text  
Jean Claude LAFFITTE wrote:
> 
> Hi,
> 
> is there an easy way in SQL to create a table with the same structure
> than another table ?
> 
> I've tried to get informations with show table, but i've some problems
> with indexes and keys.
> 
> For example, on the table valeur_variables, mysqldump gives :
> 
> #
> # Table structure for table 'valeur_variables'
> #
> CREATE TABLE valeur_variables (
>   site mediumint(9) DEFAULT '0' NOT NULL,
>   i_num int(11) DEFAULT '0' NOT NULL,
>   v_num tinyint(4),
>   dt datetime,
>   valeur char(30),
>   KEY site (site,i_num),
>   KEY i_num (i_num)
> );
> 
> 
> but "show table valeur_variables" gives :
> 
> +--------+--------------+------+-----+---------+-------+
> | Field  | Type         | Null | Key | Default | Extra |
> +--------+--------------+------+-----+---------+-------+
> | site   | mediumint(9) |      | MUL | 0       |       |
> | i_num  | int(11)      |      | MUL | 0       |       |
> | v_num  | tinyint(4)   | YES  |     | NULL    |       |
> | dt     | datetime     | YES  |     | NULL    |       |
> | valeur | char(30)     | YES  |     | NULL    |       |
> +--------+--------------+------+-----+---------+-------+
> 
> and i don't now what to do with the keys
> 
>  KEY site (site, i_num)  Or KEY i_num (i_num, site) ...
> 
> Any suggestion ?

Hi Jean Claude

If you can wait a week or two, you can get mysql 3.23.0.
This version will have an addition to the CREATE TABLE syntax, that does what you look
for.

If not, you can get INDEX information with:
SHOW INDEX FROM valeur_variables

Tschau
Christian

Thread
table creationJean Claude LAFFITTE8 Jun
  • Re: table creationChristian Mack8 Jun
    • FilemakerRoger Smith9 Jun
      • Re: Filemakerwebmaster9 Jun
      • Re: Filemaker(Eric Savage)9 Jun
        • Re: FilemakerBob Ruddy9 Jun
      • Re: FilemakerJochen Haeberle9 Jun
        • Re: FilemakerRoger Smith9 Jun
RE: Filemakertcobb9 Jun
  • RE: FilemakerJohn Gray9 Jun
Re: FilemakerChristopher R. Jones9 Jun