Reputation: 7460
I am trying to create a user table through psql
in my command line, but I keep getting the error
ERROR: syntax error at or near "user"
This is the command I am using:
CREATE TABLE user (_id INTEGER, email VARCHAR password VARCHAR, score INTEGER)
I have seen that user is a reserved word, so I did try the follow variations of this command:
CREATE TABLE "user" (_id INTEGER, email VARCHAR password, VARCHAR, score INTEGER)
and
CREATE TABLE User (_id INTEGER, email VARCHAR, password, VARCHAR, score INTEGER)
But still get the same variation of the error.
I should note too, that this column did previously exist, but I could not edit it or do anything to it through my sql queries. I have also tested table creation that does in fact work. What am I doing wrong?
Edit: Remove extra comma on the example code, as pointed out by Kedar Limaye
Upvotes: 0
Views: 68
Reputation: 1041
You missed to remove the comma after word password,here is the query
CREATE TABLE "User" (_id INTEGER, email VARCHAR, password VARCHAR, score INTEGER)
Upvotes: 1