From: | Melvin Davidson <melvin6925(at)yahoo(dot)com> |
---|---|
To: | pgadmin-support(at)postgresql(dot)org, TedJones <ted(at)mentra(dot)co(dot)uk> |
Subject: | Re: Table column headings PgAmin4 |
Date: | 2018-02-07 15:29:16 |
Message-ID: | 1607272991.3561757.1518017356523@mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
First, please note that PgAdmin4 is just an interface to PostgreSQL, so it is very helpful if you state the actual version of PostgreSQL and O/S you are working with.IE: SELECT version();
>Can the column headings be taken from the first line of the csv file?
Yes.
>Additionally, I have tried to do this with smaller number of columns with
>CREATE table but the column headings appear in a different order to what is
>in the csv file (that cannot be edited
What you are trying to do can only be done with a SQL statement (IE: Query Tool)
So you need to specify the actual columns and order you will be providing.
https://www.postgresql.org/docs/9.6/static/sql-insert.html
EG:
CREATE TABLE many_col (
a integer,
b varchar(10),
c text,
d varchar(5),
e integer,
f text,
CONSTRAINT many_col PRIMARY KEY (a)
);
INSERT INTO many_col
( b, c, a, e)
VALUES
('first b', 'first text value', 1, 11),
)'secon b', 'first text value', 2, 22);
Melvin Davidson 🎸
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
www.youtube.com/unusedhero/videos
Folk Alley - All Folk - 24 Hours a day
www.folkalley.com
On Wednesday, February 7, 2018, 10:06:49 AM EST, TedJones <ted(at)mentra(dot)co(dot)uk> wrote:
I am quite new to PostgreSQL and I am having difficulty with the following:
I am trying to input a csv file into a table that has a very large number of
columns. This means that it is impractical to create a table and specify the
name of all the columns. Can the column headings be taken from the first
line of the csv file?
Additionally, I have tried to do this with smaller number of columns with
CREATE table but the column headings appear in a different order to what is
in the csv file (that cannot be edited). I then cannot edit (cut and paste
as you would expect!) the SQL to change the order of the columns. Surely
there must be a way of doing this!! I have no control over the input csv
files that contain the data.
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html
From | Date | Subject | |
---|---|---|---|
Next Message | Murtuza Zabuawala | 2018-02-07 17:33:33 | Re: Table column headings PgAmin4 |
Previous Message | TedJones | 2018-02-07 14:48:46 | Table column headings PgAmin4 |