Assistance in importing a csv file into Postgresql

Поиск
Список
Период
Сортировка
От Intengu Technologies
Тема Assistance in importing a csv file into Postgresql
Дата
Msg-id a1afa64b0905250807j1f99f17cx71ea06a1b4ff0ba@mail.gmail.com
обсуждение исходный текст
Ответы Re: Assistance in importing a csv file into Postgresql  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: Assistance in importing a csv file into Postgresql  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-general
Dear List

I have a csv file that I would like to import into Postgresql, the
structure of the csv file is in this format:
"field1","field2","field3","field4"
"1","2","RD","00001"
"2","2","RD","00001"
"4","2","RD","00001"
"4","2","RD","00001"
"5","2","RD","00001"
"5","2","RD","00001"
"5","2","RD","00001"
"6","2","RD","00001"
"1","3","RD","00003"
"2","3","RD","00003"
"3","3","RD","00003"
"4","3","RD","00003"
"4","3","RD","00003"
"5","3","RD","00003"
"5","3","RD","00003"

What I would like to do is

If field1=1 make table1 and insert the rest of field1=1 into this table
If field1=2 make table2 and insert the rest of field1=2 into this table

Hence in this example one will have table1, table2, table3, table4,
table5 and table6

How can I accomplish this using the COPY command.

Postgresql is running on a Windows platform.

Thanks in advance.

--
Sindile Bidla

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

Предыдущее
От: "Bayless Kirtley"
Дата:
Сообщение: Re: Daylight saving time question
Следующее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: Assistance in importing a csv file into Postgresql