Home > Enterprise >  PostgreSQL : ERROR: syntax error at or near "("
PostgreSQL : ERROR: syntax error at or near "("

Time:01-11

I started to learn PSQL. I have a question how to solve this problem, in my opinion the code should be ok but BD says otherwise ;). Can someone help me with this. Thank you in advance.

The code is from a terminal on Ubuntu (this is the method I want to create the table), not from pgAdmin.

exercises_db=# CREATE TABLE* product (
exercises_db(# id serial, 
exercises_db(# name varchar(32),
exercises_db(# description text,
exercises_db(# price decimal(5,2),
exercises_db(# PRIMARY KEY(id)
exercises_db(# );


ERROR:  syntax error at or near "("
LINE 1: CREATE DATABASE product (

*Errata: I already changed in the example, I did not notice that I was doing instead of "TABLE", "DATABASE". Again, thank you very much for your help.

CodePudding user response:

CREATE TABLE product (
    id serial primary key, 
    name varchar(32),
    description text,
    price decimal(5,2)
);
  • Related