diff --git a/legacy-sql/count.sql b/legacy-sql/count.sql new file mode 100644 index 0000000..db6cb07 --- /dev/null +++ b/legacy-sql/count.sql @@ -0,0 +1,23 @@ +USE loff; + +SHOW TABLES; + +SELECT table_schema "Full database", + CONCAT( + ROUND( + SUM(data_length + index_length) + / 1024 / 1024, 1), + " MB") "dbsize" +FROM information_schema.tables +WHERE table_schema = "loff" +GROUP BY table_schema + +UNION + +SELECT "Rows in 'product' table", COUNT(*) +FROM product + +UNION + +SELECT "Rows in 'category' table", COUNT(*) +FROM category; diff --git a/legacy-sql/insert-category.sql b/legacy-sql/insert-category.sql new file mode 100644 index 0000000..0af36c0 --- /dev/null +++ b/legacy-sql/insert-category.sql @@ -0,0 +1,19 @@ +USE loff; + +INSERT INTO category (name) VALUES ('biscuits'); + +INSERT INTO product (code, url, name, nutrition_grades, category_id) +SELECT + '8480000141323', + 'https://fr-en.openfoodfacts.org/product/8480000141323/galletas-maria-dorada-hacendado', + 'Galletas María Dorada Hacendado', + 'd', + id AS category_id +FROM category +WHERE name = 'biscuits'; + +INSERT INTO product (code, name, nutrition_grades, category_id, url) +VALUES ('3593551174971', 'Les Broyés du Poitou', 'e', 1, 'https://fr-en.openfoodfacts.org/product/3593551174971/les-broyes-du-poitou-les-mousquetaires'), + ('2000000052047', 'Palets solognots', 'e', 1, 'https://fr-en.openfoodfacts.org/product/2000000052047/palets-solognots-biscuiterie-de-chambord'), + ('3175681771772', 'Moelleux POMME FRAMBOISE', 'c', 1, 'https://fr-en.openfoodfacts.org/product/3175681771772/moelleux-pomme-framboise-gerble'), + ('26035642', 'Cookies nougatine + pépites de chocolat', 'e', 1, 'https://fr-en.openfoodfacts.org/product/26035642/cookies-nougatine-pepites-de-chocolat-arizona')