Problem syntax MySql generating by PhpMyAdmin

0

I have a problem when MyAdmin generates a table creation script.

The Script:

CREATE TABLE 'crud_ABC'.'cliente_ABC' ( 'id' INT(10) NOT NULL AUTO_INCREMENT , 'nome' VARCHAR(300) NOT NULL , 'valor' DOUBLE(20) NOT NULL , 'descricao' TINYTEXT NOT NULL , PRIMARY KEY ('id'(10))) ENGINE = MyISAM;

But he reports the error:

  

1064 - You have a syntax error in your SQL next to ') NOT NULL,' description 'TINYTEXT NOT NULL, PRIMARY KEY (' id '(10))) ENGINE = My' on line 1

What can it be? I already tried changing the quotes.

    
asked by anonymous 03.04.2018 / 00:27

1 answer

1

There are some problems with your code:

  • You are only passing one value to double . In this type you need to enter the size and number of decimal places. DOUBLE(20,10) NOT NULL

  • You are passing the size of the primary key, this is not necessary, it is actually wrong, just enter the field. PRIMARY KEY (id)

  • Here's an example:

    CREATE 'crud_ABC'.'cliente_ABC' ( 
        'id' INT(10) NOT NULL AUTO_INCREMENT,
        'nome' VARCHAR(300) NOT NULL,
        'valor' DOUBLE(20,10) NOT NULL,
        'descricao' TINYTEXT NOT NULL,
        PRIMARY KEY ('id')
    ) ENGINE = MyISAM;
    

    Reference: link

        
    03.04.2018 / 01:10