Re: which function should i invoke to create a table and insert tuples?

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Re: which function should i invoke to create a table and insert tuples?
Дата
Msg-id AANLkTill5WX4tlS3JYpKkD9wj9Mkt5KnLrGSO5-o3cNQ@mail.gmail.com
обсуждение исходный текст
Ответ на which function should i invoke to create a table and insert tuples?  (sunpeng <bluevaley@gmail.com>)
Список pgsql-general
On 17 May 2010 15:31, sunpeng <bluevaley@gmail.com> wrote:
hi,when i do experiment on postgresql 8.4,i need to create a table and insert some tuples,which function should i invoke?
for example,i want to create a table with "create table test (uid int,catcode int)" and insert tuples with "insert into test values(1,1)".
thanks millions!

peng

What is it you're testing?

You can insert many rows into a table by doing something like the following:

CREATE TABLE test
(
test_id serial,
test_num int
test_value int
)

INSERT INTO test (test_num, test_value)
SELECT s.a, ceil(random()*100) FROM generate_series(1,1000) as s(a);

That would just put 1,000 entries into the table, the first column would get its value from its sequence, the second from the series and the third would be random.

Regards

Thom

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

Предыдущее
От: sunpeng
Дата:
Сообщение: which function should i invoke to create a table and insert tuples?
Следующее
От: Thom Brown
Дата:
Сообщение: Re: which function should i invoke to create a table and insert tuples?