create table famille ( famille text primary key, intitule text, type int, unite int ); \COPY famille FROM '/tmp/famille.csv' (FORMAT CSV, header, ENCODING 'UTF8'); create table article ( code text primary key, edi text, stat1 text, stat2 text, article text, famille text, -- references famille(famille) factpoids int, unitevente int, prix decimal, unitepoids int, publie int, suivistock int, sommeil int ); \COPY article FROM '/tmp/article.csv' (FORMAT CSV, header, ENCODING 'UTF8'); create table ticket ( id int primary key, horodatage timestamp, client text, mode_rglt int, etat int, facture text ); \COPY ticket FROM '/tmp/ticket.csv' (FORMAT CSV, header, ENCODING 'UTF8'); create table ligne ( id int primary key, ticket_id int, --references ticket (id), article text, -- references article (code) prix_unitaire decimal, quantite decimal ); \COPY ligne FROM '/tmp/ligne.csv' (FORMAT CSV, header, ENCODING 'UTF8');