From d90c7a86d4bd63ff9f7473357dda604707b4491f Mon Sep 17 00:00:00 2001 From: medina5 Date: Tue, 2 Sep 2025 22:59:01 +0200 Subject: [PATCH] =?UTF-8?q?s=C3=A9parer=20les=20exercices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-entrypoint-initdb.d/1_initdb.sql | 37 ------------------------- postgis.sql | 7 +++++ vector.sql | 27 ++++++++++++++++++ 3 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 postgis.sql create mode 100644 vector.sql diff --git a/docker-entrypoint-initdb.d/1_initdb.sql b/docker-entrypoint-initdb.d/1_initdb.sql index 3403563..e8711bd 100644 --- a/docker-entrypoint-initdb.d/1_initdb.sql +++ b/docker-entrypoint-initdb.d/1_initdb.sql @@ -44,40 +44,3 @@ create table ligne ( prix_unitaire decimal, quantite decimal ); - - -CREATE TABLE route ( - id int primary key, - source int, - target int, - cost double precision, - reverse_cost double precision -); - -CREATE TABLE produits ( - id SERIAL PRIMARY KEY, - nom TEXT, - caracteristiques VECTOR(6) -); - -INSERT INTO produits (nom, caracteristiques) VALUES -('Tomate', '[0.6, 0.3, 0.3, 1.0, 0.5, 1.0]'), -('Concombre', '[0.2, 0.1, 0.9, 1.0, 0.0, 0.0]'), -('Courgette', '[0.3, 0.1, 0.5, 1.0, 0.0, 0.0]'), -('Carotte', '[0.5, 0.1, 0.8, 0.5, 0.0, 1.0]'), -('Poivron', '[0.4, 0.2, 0.6, 1.0, 0.0, 1.0]'), -('Aubergine', '[0.2, 0.1, 0.4, 1.0, 0.0, 0.0]'), -('Pomme', '[0.8, 0.3, 0.9, 1.0, 1.0, 1.0]'), -('Poire', '[0.7, 0.2, 0.7, 1.0, 1.0, 0.0]'), -('Fraise', '[0.9, 0.4, 0.7, 1.0, 1.0, 1.0]'), -('Cerise', '[0.8, 0.3, 0.6, 1.0, 1.0, 1.0]'), -('Citron', '[0.2, 1.0, 0.6, 1.0, 1.0, 1.0]'), -('Orange', '[0.7, 0.6, 0.7, 1.0, 1.0, 1.0]'), -('Banane', '[0.9, 0.1, 0.2, 1.0, 1.0, 0.0]'), -('Raisin', '[0.8, 0.3, 0.5, 1.0, 1.0, 1.0]'), -('Pastèque', '[0.8, 0.2, 0.6, 1.0, 1.0, 1.0]'), -('Melon', '[0.9, 0.2, 0.5, 1.0, 1.0, 1.0]'), -('Betterave', '[0.5, 0.1, 0.4, 0.0, 0.0, 1.0]'), -('Radis', '[0.2, 0.3, 0.9, 0.5, 0.0, 1.0]'), -('Brocoli', '[0.1, 0.1, 0.6, 0.0, 0.0, 0.0]'), -('Chou-fleur', '[0.1, 0.1, 0.7, 0.0, 0.0, 0.0]'); diff --git a/postgis.sql b/postgis.sql new file mode 100644 index 0000000..f13d978 --- /dev/null +++ b/postgis.sql @@ -0,0 +1,7 @@ +CREATE TABLE route ( + id int primary key, + source int, + target int, + cost double precision, + reverse_cost double precision +); diff --git a/vector.sql b/vector.sql new file mode 100644 index 0000000..fe64617 --- /dev/null +++ b/vector.sql @@ -0,0 +1,27 @@ +CREATE TABLE produits ( + id SERIAL PRIMARY KEY, + nom TEXT, + caracteristiques VECTOR(6) +); + +INSERT INTO produits (nom, caracteristiques) VALUES +('Tomate', '[0.6, 0.3, 0.3, 1.0, 0.5, 1.0]'), +('Concombre', '[0.2, 0.1, 0.9, 1.0, 0.0, 0.0]'), +('Courgette', '[0.3, 0.1, 0.5, 1.0, 0.0, 0.0]'), +('Carotte', '[0.5, 0.1, 0.8, 0.5, 0.0, 1.0]'), +('Poivron', '[0.4, 0.2, 0.6, 1.0, 0.0, 1.0]'), +('Aubergine', '[0.2, 0.1, 0.4, 1.0, 0.0, 0.0]'), +('Pomme', '[0.8, 0.3, 0.9, 1.0, 1.0, 1.0]'), +('Poire', '[0.7, 0.2, 0.7, 1.0, 1.0, 0.0]'), +('Fraise', '[0.9, 0.4, 0.7, 1.0, 1.0, 1.0]'), +('Cerise', '[0.8, 0.3, 0.6, 1.0, 1.0, 1.0]'), +('Citron', '[0.2, 1.0, 0.6, 1.0, 1.0, 1.0]'), +('Orange', '[0.7, 0.6, 0.7, 1.0, 1.0, 1.0]'), +('Banane', '[0.9, 0.1, 0.2, 1.0, 1.0, 0.0]'), +('Raisin', '[0.8, 0.3, 0.5, 1.0, 1.0, 1.0]'), +('Pastèque', '[0.8, 0.2, 0.6, 1.0, 1.0, 1.0]'), +('Melon', '[0.9, 0.2, 0.5, 1.0, 1.0, 1.0]'), +('Betterave', '[0.5, 0.1, 0.4, 0.0, 0.0, 1.0]'), +('Radis', '[0.2, 0.3, 0.9, 0.5, 0.0, 1.0]'), +('Brocoli', '[0.1, 0.1, 0.6, 0.0, 0.0, 0.0]'), +('Chou-fleur', '[0.1, 0.1, 0.7, 0.0, 0.0, 0.0]');