Search code examples
mysqlmysql-error-1064

I'm not able to overcome a syntax error when creating table in MySQL Would anyone spot the error?


I'm trying to create this table:

CREATE TABLE usuario(
   id INTEGER(7) NOT NULL AUTO_INCREMENT PRIMARY KEY,
   nome VARCHAR(250) NOT NULL,
   nacionalidade VARCHAR(75) DEFAULT 'brasileira',
   profissao VARCHAR(150),
   sexo varchar(1),
   estadoCivil VARCHAR(50),
   nomeConjuge VARCHAR(150),    
   identidade INTEGER(11),  
   orgaoExpedidor VARCHAR(50),
   CPF INTEGER(11),
   Logradouro VARCHAR(200), 
   numeroCasa INTEGER(6),   
   complemento VARCHAR(100),        
   bairro VARCHAR(100), 
   cidade VARCHAR(200), 
   UF VARCHAR(2),   
   CEP VARCHAR(10),
   )TYPE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;

But, when I try to insert the table, I got this error:

enter image description here

Could someone with more experience in MySQL signal what am I doing wrong?


Solution

  • CEP VARCHAR(10),

    Remove the , here

    And MySQL 5.5+ does not support TYPE= anymore. Use ENGINE= instead.

    Note The older TYPE option was synonymous with ENGINE. TYPE was deprecated in MySQL 4.0 and removed in MySQL 5.5. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead.

    Source