Re: duplicate records

From: Vassilis Papadimos <vpapad(at)cs(dot)pdx(dot)edu>
To: pdxpug(at)postgresql(dot)org
Subject: Re: duplicate records
Date: 2006-10-18 22:48:44
Message-ID: 4536AF4C.8080506@cs.pdx.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Vassilis Papadimos wrote:
> Thomas J Keller wrote:
>> Excellent.
>> So the first step is to create an empty table:
>>
>> passwords=# CREATE TABLE foo_bar LIKE original_table;
>> ERROR: syntax error at or near "LIKE" at character 22
>> LINE 1: CREATE TABLE foo_bar LIKE original_table;
>
> SQL doesn't have this "do what I mean" feature yet :-)

Ahem... Apparently SQL *does* have this "do what I mean" feature (or at
least PostgreSQL does!) I've never heard of it before.

But you have to write it like this:

CREATE TABLE foo_bar (like original_table);

(Including the parentheses.)

I still like the

SELECT DISTINCT * FROM original_table INTO foo_bar;

solution though, two birds with one stone...

Vassilis.

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Devin Ben-Hur 2006-10-18 23:49:17 Re: duplicate records
Previous Message Vassilis Papadimos 2006-10-18 22:24:01 Re: duplicate records