Adds developpement requests (INSERT & DB size) #2

This commit is contained in:
Fred Z 2018-08-02 11:14:13 +02:00
parent ae687d85ac
commit 005a25afc5
2 changed files with 42 additions and 0 deletions

23
legacy-sql/count.sql Normal file
View File

@ -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;

View File

@ -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')