Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PostgreSQL : ERROR: syntax error at or near "("

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading