Re: How to create a specific table

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to create a specific table
Date: 2015-01-22 15:03:34
Message-ID: CAB7nPqRw38Tns+25ghXuPEmNKSwWuV4dZoaRkW95ORdxtZRW8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 22, 2015 at 11:59 PM, David G Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> Pierre Hsieh wrote
>> 1. just one column which type is integer in table
>> 2. this columns only has 1 and 2 for 50 times as following
> use generate_series(...), the modulus operator (to determine even/odd via
> %2), and +1
Yes, embedded with CREATE TABLE AS:
=# create table test as select a % 2 + 1 from generate_series(1,100) as a;
SELECT 100
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pierre Hsieh 2015-01-22 15:18:32 how to calculate standard deviation from a table
Previous Message Andrey Lizenko 2015-01-22 15:01:17 Re: temporary tables are logged somehow?