sql - WHERE NOT EXISTS in PostgreSQL gives syntax error -


when trying use where not exists clause prevent adding row duplicate value in column age, error syntax error @ or near "where".

why did throw syntax error? i'm using postgresql 9.1.

sql

insert live.users ("website", "age")  values ('abc', '123') not exists (select age live.users age = 123); 

error

error:  syntax error @ or near "where" line 6: not exists (select age live.users w... 

do instead:

insert live.users ("website", "age")  select 'abc', 123 not exists (select age live.users age = 123); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -