I'm following an older tutorial learning Postgres, so it's possible maybe something has changed since it was published. In the tutorial (using psql) I create a table then do some insert
statements. Here is the tutorial and corresponding psql
commands that cause error:
http://www.postgresqlforbeginners.com/2010/11/create-table-and-constraints.html
create table people(
id int PRIMARY KEY,
name varchar NOT NULL
);
insert into people(0,'Steve Jobs');
insert into people(1,'Mike Markkula');
insert into people(2,'Mike Scott');
insert into people(3,'John Sculley');
insert into people(4,'Michael Spindler');
insert into people(5,'Gil Amelio');
insert into people(6,'Mike Scott');
I get this error for each insert statement:
ERROR: syntax error at or near "0"
LINE 1: insert into people(0,'Steve Jobs');
^
I've tried copy pasting, capitalizing the sql commands (ie INSERT
), running the command from shell outside of psql
, adding spaces, using "
instead of '
quotes... All result in the same errors. Has something changed or am I possibly doing something wrong?
values
keyword: postgresql.org/docs/current/static/sql-insert.html That tutorial is plain wrong – a_horse_with_no_name Oct 21 '17 at 12:54value
instead ofvalues
. Anyway, thanks – DjH Oct 21 '17 at 12:57