Re: create table and data types

Поиск
Список
Период
Сортировка
От Bath, David
Тема Re: create table and data types
Дата
Msg-id 200602151121.56766.dave.bath@unix.net
обсуждение исходный текст
Ответ на create table and data types  (Maciej Piekielniak <piechcio@isb.com.pl>)
Список pgsql-sql
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: (snipped)
>Is anybody know how create field in a new table with data type accuiring
>from a field in other table?
>For example:
> create table new_table ( name other_table.name%TYPE);

On Wed, 15 Feb 2006 09:42, Ken Hill wrote: (snipped)
> Have you tried restructuring the table with CREATE TABLE AS...?
> Try this:
> CREATE TABLE new_table
>      (id, mynewfield, mynewfield2)
>      AS SELECT id FROM old_table);

I use a similar technique, but add a "WHERE 1=0" so the new table is
empty.  Of course, more than a single table can be referenced in the
FROM clause.
--
David T. Bath
dave.bath@unix.net



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

Предыдущее
От: Ken Hill
Дата:
Сообщение: Re: create table and data types
Следующее
От: Ken Hill
Дата:
Сообщение: Re: Non Matching Records in Two Tables