I have a dataset of 320 columns in a csv file where the header is simply the number of trip.
Each column represents a trip, a route of street names from A to B. (It was a simple list, that I transposed in excel to create the trip numbers as heads.)
I would like to import it to a postgreSQL table.
I saw previous similar question, but as it's only 320, I wonder if that is the best structure and if yes how to loop the column creation in order to insert the data through pgAdmin.
I figured so far this, that returns error message:
DO
$do$
BEGIN
FOR i IN 1..320 LOOP
INSERT INTO runs (col_i, col_id) -- use col names
SELECT i, id
FROM tbl;
END LOOP;
END
$do$;
Many thanks