Re: Insert data if it is not existing

Поиск
Список
Период
Сортировка
От tango ward
Тема Re: Insert data if it is not existing
Дата
Msg-id CAA6wQLKER=WpBjpa+6Uzym0KwVFSSZ3LTzdcmKDy3Vh4LCDu6w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Insert data if it is not existing  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Insert data if it is not existing  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general

On Thu, May 24, 2018 at 10:55 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, May 23, 2018, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
INSERT INTO my_table(%s, %s)
WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= %s)

INSERT doesn't have a where clause...

David J. 


What I did is

'''INSERT INTO my_table(name, age)
SELECT %s, %s
WHERE NOT EXISTS(SELECT name FROM my_table WHERE name=%s)''', ('Scott', 23)

В списке pgsql-general по дате отправления:

Предыдущее
От: tango ward
Дата:
Сообщение: Re: Insert data if it is not existing
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Insert data if it is not existing