Re: [GENERAL] How to do this in SQL?

Поиск
Список
Период
Сортировка
От Chris Bitmead
Тема Re: [GENERAL] How to do this in SQL?
Дата
Msg-id 3700E7C9.FCD0D4C5@bigfoot.com
обсуждение исходный текст
Ответ на Re: [GENERAL] How to do this in SQL?  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Ответы Re: [GENERAL] How to do this in SQL?
Список pgsql-sql
Herouth Maoz wrote:

> INSERT INTO BOOK (name, author)
> SELECT 'War and Peace', oid
> FROM author
> WHERE name = 'Tolstoy';

Thanks! Now what if I had...
CREATE TABLE book (author oid, publisher oid);

What is the syntax? Is it...

INSERT INTO BOOK(author, publisher)
SELECT author.oid, publisher.oid 
FROM author, publisher
WHERE author.name = 'Tolstoy' AND publisher.name = 'Penguin';

Is that right?


-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com


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

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [GENERAL] How to do this in SQL?
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: [GENERAL] How to do this in SQL?