Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- MySQL Workbench Forward Engineering
- SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
- SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
- SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
- -- -----------------------------------------------------
- -- Schema DietDB
- -- -----------------------------------------------------
- DROP SCHEMA IF EXISTS `DietDB` ;
- -- -----------------------------------------------------
- -- Schema DietDB
- -- -----------------------------------------------------
- CREATE SCHEMA IF NOT EXISTS `DietDB` DEFAULT CHARACTER SET utf8 ;
- USE `DietDB` ;
- -- -----------------------------------------------------
- -- Table `DietDB`.`FoodItems`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`FoodItems` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`FoodItems` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `name` VARCHAR(255) NOT NULL,
- `fluid` TINYINT(1) NOT NULL,
- `kcal` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'per 100g/100ml',
- `carbohydrate` DOUBLE UNSIGNED NOT NULL DEFAULT 0 COMMENT 'per 100g/100ml',
- `fat` DOUBLE UNSIGNED NOT NULL DEFAULT 0 COMMENT 'per 100g/100ml',
- `protein` DOUBLE UNSIGNED NOT NULL DEFAULT 0 COMMENT 'per 100g/100ml',
- PRIMARY KEY (`id`))
- ENGINE = InnoDB;
- CREATE UNIQUE INDEX `name_UNIQUE` ON `DietDB`.`FoodItems` (`name` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Servings`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Servings` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Servings` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `foodItem_id` INT UNSIGNED NOT NULL,
- `name` VARCHAR(255) NOT NULL,
- `units` DOUBLE UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`, `foodItem_id`),
- CONSTRAINT `fk_Servings_FoodItems1`
- FOREIGN KEY (`foodItem_id`)
- REFERENCES `DietDB`.`FoodItems` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
- CREATE INDEX `fk_Servings_FoodItems1_idx` ON `DietDB`.`Servings` (`foodItem_id` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Sets`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Sets` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Sets` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `name` VARCHAR(255) NOT NULL,
- PRIMARY KEY (`id`))
- ENGINE = InnoDB;
- CREATE UNIQUE INDEX `name_UNIQUE` ON `DietDB`.`Sets` (`name` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Set_has_FoodItems`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Set_has_FoodItems` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Set_has_FoodItems` (
- `set_id` INT UNSIGNED NOT NULL,
- `foodItem_id` INT UNSIGNED NOT NULL,
- `units` DOUBLE UNSIGNED NOT NULL,
- PRIMARY KEY (`set_id`, `foodItem_id`),
- CONSTRAINT `fk_Sets_has_FoodItems_Sets1`
- FOREIGN KEY (`set_id`)
- REFERENCES `DietDB`.`Sets` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE,
- CONSTRAINT `fk_Sets_has_FoodItems_FoodItems1`
- FOREIGN KEY (`foodItem_id`)
- REFERENCES `DietDB`.`FoodItems` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
- CREATE INDEX `fk_Sets_has_FoodItems_FoodItems1_idx` ON `DietDB`.`Set_has_FoodItems` (`foodItem_id` ASC);
- CREATE INDEX `fk_Sets_has_FoodItems_Sets1_idx` ON `DietDB`.`Set_has_FoodItems` (`set_id` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Meals`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Meals` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Meals` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `date` DATE NOT NULL,
- `time` TIME NULL,
- PRIMARY KEY (`id`))
- ENGINE = InnoDB;
- -- -----------------------------------------------------
- -- Table `DietDB`.`Meals_has_Sets`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Meals_has_Sets` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Meals_has_Sets` (
- `meal_id` INT UNSIGNED NOT NULL,
- `set_id` INT UNSIGNED NOT NULL,
- `amount` INT UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`meal_id`, `set_id`),
- CONSTRAINT `fk_Meals_has_Sets_Meals1`
- FOREIGN KEY (`meal_id`)
- REFERENCES `DietDB`.`Meals` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE,
- CONSTRAINT `fk_Meals_has_Sets_Sets1`
- FOREIGN KEY (`set_id`)
- REFERENCES `DietDB`.`Sets` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
- CREATE INDEX `fk_Meals_has_Sets_Sets1_idx` ON `DietDB`.`Meals_has_Sets` (`set_id` ASC);
- CREATE INDEX `fk_Meals_has_Sets_Meals1_idx` ON `DietDB`.`Meals_has_Sets` (`meal_id` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Meals_has_FoodItems`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Meals_has_FoodItems` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Meals_has_FoodItems` (
- `meal_id` INT UNSIGNED NOT NULL,
- `foodItem_id` INT UNSIGNED NOT NULL,
- `amount` INT UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`meal_id`, `foodItem_id`),
- CONSTRAINT `fk_Meals_has_FoodItems_Meals1`
- FOREIGN KEY (`meal_id`)
- REFERENCES `DietDB`.`Meals` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE,
- CONSTRAINT `fk_Meals_has_FoodItems_FoodItems1`
- FOREIGN KEY (`foodItem_id`)
- REFERENCES `DietDB`.`FoodItems` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
- CREATE INDEX `fk_Meals_has_FoodItems_FoodItems1_idx` ON `DietDB`.`Meals_has_FoodItems` (`foodItem_id` ASC);
- CREATE INDEX `fk_Meals_has_FoodItems_Meals1_idx` ON `DietDB`.`Meals_has_FoodItems` (`meal_id` ASC);
- -- -----------------------------------------------------
- -- Table `DietDB`.`Meals_has_Servings`
- -- -----------------------------------------------------
- DROP TABLE IF EXISTS `DietDB`.`Meals_has_Servings` ;
- CREATE TABLE IF NOT EXISTS `DietDB`.`Meals_has_Servings` (
- `meal_id` INT UNSIGNED NOT NULL,
- `serving_id` INT UNSIGNED NOT NULL,
- `foodItem_id` INT UNSIGNED NOT NULL,
- `amount` INT UNSIGNED NOT NULL DEFAULT 1,
- PRIMARY KEY (`meal_id`, `serving_id`, `foodItem_id`),
- CONSTRAINT `fk_Meals_has_Servings_Meals1`
- FOREIGN KEY (`meal_id`)
- REFERENCES `DietDB`.`Meals` (`id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE,
- CONSTRAINT `fk_Meals_has_Servings_Servings1`
- FOREIGN KEY (`serving_id` , `foodItem_id`)
- REFERENCES `DietDB`.`Servings` (`id` , `foodItem_id`)
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
- CREATE INDEX `fk_Meals_has_Servings_Servings1_idx` ON `DietDB`.`Meals_has_Servings` (`serving_id` ASC, `foodItem_id` ASC);
- CREATE INDEX `fk_Meals_has_Servings_Meals1_idx` ON `DietDB`.`Meals_has_Servings` (`meal_id` ASC);
- USE `DietDB` ;
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`ServingsView`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`ServingsView` (`serving_id` INT, `foodItem_id` INT, `foodItem_name` INT, `serving_name` INT, `units` INT, `fluid` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`SetsView`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`SetsView` (`set_id` INT, `set_name` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`MealsView_Servings`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`MealsView_Servings` (`meal_id` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`MealsView_FoodItems`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`MealsView_FoodItems` (`meal_id` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`MealsView_Sets`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`MealsView_Sets` (`meal_id` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`MealsView`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`MealsView` (`meal_id` INT, `date` INT, `time` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- Placeholder table for view `DietDB`.`Days`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `DietDB`.`Days` (`date` INT, `kcal` INT, `carbohydrate` INT, `fat` INT, `protein` INT);
- -- -----------------------------------------------------
- -- View `DietDB`.`ServingsView`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`ServingsView` ;
- DROP TABLE IF EXISTS `DietDB`.`ServingsView`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `ServingsView` AS
- SELECT
- s.id as serving_id,
- i.id as foodItem_id,
- i.`name` as foodItem_name,
- s.`name` as serving_name,
- units,
- fluid,
- (kcal*units)/100 as kcal,
- (carbohydrate*units)/100 as carbohydrate,
- (fat*units)/100 as fat,
- (protein*units)/100 as protein
- FROM
- servings s
- JOIN
- FoodItems i ON i.id = FoodItem_id;
- -- -----------------------------------------------------
- -- View `DietDB`.`SetsView`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`SetsView` ;
- DROP TABLE IF EXISTS `DietDB`.`SetsView`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `SetsView` AS
- SELECT
- s.id AS set_id,
- s.`name` AS set_name,
- SUM((kcal*units)/100) AS kcal,
- SUM((carbohydrate*units)/100) AS carbohydrate,
- SUM((fat*units)/100) AS fat,
- SUM((protein*units)/100) AS protein
- FROM
- Sets s
- JOIN
- Set_has_FoodItems h ON h.set_id = s.id
- JOIN
- FoodItems i ON h.foodItem_id = i.id
- GROUP BY s.id;
- -- -----------------------------------------------------
- -- View `DietDB`.`MealsView_Servings`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`MealsView_Servings` ;
- DROP TABLE IF EXISTS `DietDB`.`MealsView_Servings`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `MealsView_Servings` AS
- SELECT
- m.id AS meal_id,
- SUM(kcal * amount) AS kcal,
- SUM(carbohydrate * amount) AS carbohydrate,
- SUM(fat * amount) AS fat,
- SUM(protein * amount) AS protein
- FROM
- Meals m
- JOIN
- Meals_has_Servings h ON h.meal_id = m.id
- JOIN
- ServingsView v ON h.serving_id = v.serving_id
- AND h.foodItem_id = v.foodItem_id
- GROUP BY m.id;
- -- -----------------------------------------------------
- -- View `DietDB`.`MealsView_FoodItems`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`MealsView_FoodItems` ;
- DROP TABLE IF EXISTS `DietDB`.`MealsView_FoodItems`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `MealsView_FoodItems` AS
- SELECT
- m.id AS meal_id,
- SUM((kcal/100)*amount) AS kcal,
- SUM((carbohydrate/100)*amount) AS carbohydrate,
- SUM((fat/100)*amount) AS fat,
- SUM((protein/100)*amount) AS protein
- FROM
- Meals m
- JOIN
- Meals_has_FoodItems h ON h.meal_id = m.id
- JOIN
- FoodItems i ON h.foodItem_id = i.id
- GROUP BY m.id;
- -- -----------------------------------------------------
- -- View `DietDB`.`MealsView_Sets`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`MealsView_Sets` ;
- DROP TABLE IF EXISTS `DietDB`.`MealsView_Sets`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `MealsView_Sets` AS
- SELECT
- m.id AS meal_id,
- SUM(kcal * amount) AS kcal,
- SUM(carbohydrate * amount) AS carbohydrate,
- SUM(fat * amount) AS fat,
- SUM(protein * amount) AS protein
- FROM
- Meals m
- JOIN
- Meals_has_Sets h ON h.meal_id = m.id
- JOIN
- SetsView v ON h.set_id = v.set_id
- GROUP BY m.id;
- -- -----------------------------------------------------
- -- View `DietDB`.`MealsView`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`MealsView` ;
- DROP TABLE IF EXISTS `DietDB`.`MealsView`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `MealsView` AS
- SELECT
- m.id AS meal_id,
- m.`date`,
- m.`time`,
- ifnull(a.kcal, 0) + ifnull(b.kcal, 0) + ifnull(c.kcal, 0) AS kcal,
- ifnull(a.carbohydrate, 0) + ifnull(b.carbohydrate, 0) + ifnull(c.carbohydrate, 0) AS carbohydrate,
- ifnull(a.fat, 0) + ifnull(b.fat, 0) + ifnull(c.fat, 0) AS fat,
- ifnull(a.protein, 0) + ifnull(b.protein, 0) + ifnull(c.protein, 0) AS protein
- FROM
- Meals m
- LEFT JOIN
- MealsView_FoodItems a ON a.meal_id = m.id
- LEFT JOIN
- MealsView_Sets b ON b.meal_id = m.id
- LEFT JOIN
- MealsView_Servings c ON c.meal_id = m.id
- GROUP BY m.id;
- -- -----------------------------------------------------
- -- View `DietDB`.`Days`
- -- -----------------------------------------------------
- DROP VIEW IF EXISTS `DietDB`.`Days` ;
- DROP TABLE IF EXISTS `DietDB`.`Days`;
- USE `DietDB`;
- CREATE OR REPLACE VIEW `Days` AS
- SELECT
- m.`date`,
- SUM(kcal) AS kcal,
- SUM(carbohydrate) AS carbohydrate,
- SUM(fat) AS fat,
- SUM(protein) AS protein
- FROM
- Meals m
- JOIN
- MealsView v ON v.meal_id = m.id
- GROUP BY m.`date`;
- SET SQL_MODE=@OLD_SQL_MODE;
- SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
- SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`FoodItems`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (1, 'Jajka', 0, 143, 1, 10, 13);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (3, 'Chleb, jasny', 0, 266, 48, 4, 11);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (4, 'Carnivor, proszek', 0, 357.1429, 21.9780, 0, 63.1868);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (5, 'Alpro, sojowe, nie słodzone', 1, 32, 0.2, 1.8, 3.3);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (6, 'Chleb, Karoliny', 0, 213, 51.2, 1.7, 5.6);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (7, 'Pomidory, cherry', 0, DEFAULT, DEFAULT, DEFAULT, DEFAULT);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (8, 'Marchewki, mini', 0, DEFAULT, DEFAULT, DEFAULT, DEFAULT);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (9, 'Oliwki, zielone', 0, DEFAULT, DEFAULT, DEFAULT, DEFAULT);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (10, 'Parówki, Słowianki', 0, 197, 0.5, 15, 15);
- INSERT INTO `DietDB`.`FoodItems` (`id`, `name`, `fluid`, `kcal`, `carbohydrate`, `fat`, `protein`) VALUES (11, 'Kurczak, udo, pieczony', 0, 211, 0, 12, 24);
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Servings`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (2, 1, 'M', 51);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (1, 1, 'S', 38);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (3, 1, 'L', 56);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (4, 1, 'XL', 65);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (6, 4, 'Miarka', 36.4);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (8, 6, 'Kromka', DEFAULT);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (9, 7, 'Kubełek z Lidla', DEFAULT);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (10, 8, 'Woreczek z Lidla', DEFAULT);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (11, 9, 'Woreczek z Lidla', DEFAULT);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (12, 3, 'Kromka', 25);
- INSERT INTO `DietDB`.`Servings` (`id`, `foodItem_id`, `name`, `units`) VALUES (13, 10, 'Sztuka', 34);
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Sets`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Sets` (`id`, `name`) VALUES (1, 'Carnivoir shake');
- INSERT INTO `DietDB`.`Sets` (`id`, `name`) VALUES (2, 'test');
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Set_has_FoodItems`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Set_has_FoodItems` (`set_id`, `foodItem_id`, `units`) VALUES (1, 4, 36.4);
- INSERT INTO `DietDB`.`Set_has_FoodItems` (`set_id`, `foodItem_id`, `units`) VALUES (1, 5, 500);
- INSERT INTO `DietDB`.`Set_has_FoodItems` (`set_id`, `foodItem_id`, `units`) VALUES (2, 1, 25);
- INSERT INTO `DietDB`.`Set_has_FoodItems` (`set_id`, `foodItem_id`, `units`) VALUES (2, 3, 36);
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Meals`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (1, '2016-06-01', '8:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (2, '2016-06-01', '13:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (3, '2016-06-01', '14:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (4, '2016-06-01', '15:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (5, '2016-06-01', '17:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (6, '2016-06-01', '22:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (7, '2016-06-02', '8:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (8, '2016-06-02', '14:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (9, '2016-06-02', '17:00');
- INSERT INTO `DietDB`.`Meals` (`id`, `date`, `time`) VALUES (10, '2016-06-02', '22:30');
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Meals_has_Sets`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Meals_has_Sets` (`meal_id`, `set_id`, `amount`) VALUES (1, 1, 1);
- INSERT INTO `DietDB`.`Meals_has_Sets` (`meal_id`, `set_id`, `amount`) VALUES (6, 1, 1);
- INSERT INTO `DietDB`.`Meals_has_Sets` (`meal_id`, `set_id`, `amount`) VALUES (7, 1, 1);
- INSERT INTO `DietDB`.`Meals_has_Sets` (`meal_id`, `set_id`, `amount`) VALUES (10, 1, 1);
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Meals_has_FoodItems`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Meals_has_FoodItems` (`meal_id`, `foodItem_id`, `amount`) VALUES (8, 11, 175);
- COMMIT;
- -- -----------------------------------------------------
- -- Data for table `DietDB`.`Meals_has_Servings`
- -- -----------------------------------------------------
- START TRANSACTION;
- USE `DietDB`;
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (2, 9, 7, 1);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (3, 10, 8, 1);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (4, 11, 9, 1);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (4, 12, 3, 1);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (5, 2, 1, 5);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (9, 8, 6, 4);
- INSERT INTO `DietDB`.`Meals_has_Servings` (`meal_id`, `serving_id`, `foodItem_id`, `amount`) VALUES (9, 13, 10, 5);
- COMMIT;
Add Comment
Please, Sign In to add comment