Syntax error in MySQL

1

I was creating a table in MySQL and this error appeared in this code:

USE cadastro;
CREATE TABLE países(
    cod_país INT NOT NULL AUTO_INCREMENT,
    nome_país VARCHAR (30),
    PRIMARY KEY cod_país
    );
  

1 errors were encountered during analysis.

     

A closing bracket was expected. (near ")" at position 124)

    
asked by anonymous 21.08.2018 / 04:57

3 answers

7

Relatives are missing from the PRIMARY KEY line:

CREATE TABLE países (
    cod_país INT NOT NULL AUTO_INCREMENT,
    nome_país VARCHAR(30),
    PRIMARY KEY (cod_país)
);

See running SQLFiddle . And in Coding Ground . I also put it in GitHub for future reference.

Documentation .

    
21.08.2018 / 05:03
-2

Put it like this and see if you can.

USE cadastro;
CREATE TABLE países(
    cod_pais INT NOT NULL AUTO_INCREMENT,
    nome_país VARCHAR (30),
    PRIMARY KEY (cod_pais)
    );
    
21.08.2018 / 20:46
-3

Take the "is" accents in the word country. All the words " country " are written with an acute accent on the

    
21.08.2018 / 05:18