Exercice 2

This commit is contained in:
2025-08-28 07:13:19 +02:00
parent bd64e734bf
commit f067959843
7 changed files with 122 additions and 66 deletions

View File

@@ -0,0 +1,48 @@
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/articles.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/tickets.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,
total decimal
);
\COPY ligne FROM '/tmp/lignes.csv' (FORMAT CSV, header, ENCODING 'UTF8');