0

I was trying to create the following table on PostgreSQL:

CREATE TABLE movies
(
    movie_name VARCHAR(200),
    movie_year INTEGER,         
    country VARCHAR(100),
    genre VARCHAR
    PRIMARY KEY (movie_name, movie_year) 
);

But received the following error message:

ERROR:  error de sintaxis en o cerca de «(»
LINE 7:  PRIMARY KEY 
                 ^
SQL state: 42601
Character: 166

Sorry, my PostgreSQL is in Spanish for some reason, but it basically says that there is a syntax error near the '('.

I´m following a course and the teacher was able to create this table on PostgreSQL without any problems, what am I doing wrong?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
JMarcos87
  • 183
  • 3
  • 11

1 Answers1

1

You're missing a comma after the last column definition:

CREATE TABLE movies
(
    movie_name VARCHAR(200),
    movie_year INTEGER,         
    country VARCHAR(100),
    genre VARCHAR,
    -- Here -----^
    PRIMARY KEY (movie_name, movie_year) 
);
Mureinik
  • 297,002
  • 52
  • 306
  • 350