Home>
[]
Insert csv file of input data with COPY statement of postgresql,
I want to output only the data inserted immediately before.
[I am in trouble]
Select * FROM table name, not all data, only data inserted by COPY statement
I'm in trouble. . .
I want to select only the second and third rows of the table listed below. (Can it be done with a COPY statement?)
I'm sorry for ignorance, but it will be helpful if I get wisdom.
CREATE TABLE testDB
(ID SERIAL NOT NULL,
test1 INT4 NOT NULL,
test2 INT4 NOT NULL,
test3 VARCHAR (256));
\ copy testDB (test1, test2, test3) FROM '/tmp/inputCSV/test.csv' WITH CSV;
# I want to select the data inserted above.
select ~
● CSV content
2,2,2.jpg
3,3,3.jpg
● Contents of the table
ID | test1 | test2 | test3
1 1 1 1.jpg
2 2 2 2.jpg
3 3 3 3.jpg
-
Answer # 1
Related articles
- nodejs + postgresql like statement error partial match using variables
- postgresql - i want to get monthly results with a sql select statement
- postgresql sql statement some columns cannot be retrieved error: column "diffvideos" does not exist
- postgresql - about sql statement to get the value of another column by the value of one column
- i want to add a fixed value in the select statement of postgresql
- postgresql - i inserted data into postico, but it is not reflected on the terminal
- postgresql - an error occurs when an sql statement is entered in ssh
- i don't know the postgresql connection statement in javaee jsp
Trends
It is difficult to identify with the information in the data in the question.
If you only want to identify it temporarily, it would be quickest to import the CSV into another table.
If you add aIf constant identification is required, information that can be identified is necessary.
column and set a value for that item if it is not based on COPY, it will be NULL for COPY.
In the opposite case, CSV is imported into a temporary table by COPY, and identification information is also set when updating from that table to the target table.