Use DISTINCT when loading data from another relation and duplicate rows would make insertion fail. It returns one row for each unique combination of the selected columns. section 3.4.1
Load a unique system list
INSERT INTO systems(id, name) SELECT DISTINCT system_id, system_public_name FROM 'https://oedi-data-lake.s3.amazonaws.com/pvdaq/csv/systems.csv' ORDER BY system_id ASC; Here, uniqueness applies to the pair of projected columns: repeated system_id and system_public_name pairs are inserted only once. section 3.4.1
Listing 3.6 Inserting a distinct set of rows from another table
INSTALL 'httpfs'; LOAD 'httpfs'; INSERT INTO systems(id, name) SELECT DISTINCT system_id, system_public_name FROM 'https://oedi-data-lake.s3.amazonaws.com/pvdaq/csv/systems.csv' ORDER BY system_id ASC;
Inspect the complete DuckDB example for installing the HTTP extension, reading a remote CSV, selecting distinct rows, and ordering the inserted result. section 3.4.1



