diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_diet.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_diet.sql index 048ffa5..c2467c5 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_diet.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_diet.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:51 +-- Dump completed on 2018-12-21 14:34:56 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_diet_prohibits_ingredient.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_diet_prohibits_ingredient.sql index 1362d9c..b27a622 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_diet_prohibits_ingredient.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_diet_prohibits_ingredient.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:55 +-- Dump completed on 2018-12-21 14:34:59 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_drink.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_drink.sql index 2a131d0..5de4b2b 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_drink.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_drink.sql @@ -57,4 +57,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:50 +-- Dump completed on 2018-12-21 14:34:55 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_drink_has_ingredient.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_drink_has_ingredient.sql index 4a4e224..f0a6d93 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_drink_has_ingredient.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_drink_has_ingredient.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:48 +-- Dump completed on 2018-12-21 14:34:52 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_food.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_food.sql index f86aa6f..e019dd1 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_food.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_food.sql @@ -29,7 +29,7 @@ CREATE TABLE `food` ( `food_name` varchar(200) NOT NULL, `food_description` varchar(150) DEFAULT NULL, `food_calories` int(11) DEFAULT NULL, - `food_is_approved` varchar(45) DEFAULT '0', + `food_is_approved` bit(1) DEFAULT b'0', `restaurant_id` int(11) NOT NULL, PRIMARY KEY (`food_id`), UNIQUE KEY `food_id_UNIQUE` (`food_id`), @@ -44,7 +44,7 @@ CREATE TABLE `food` ( LOCK TABLES `food` WRITE; /*!40000 ALTER TABLE `food` DISABLE KEYS */; -INSERT INTO `food` VALUES (2,'Κεφτεδάκια με πατάτες',NULL,450,'TRUE',8132),(4,'Κοτομπουκιές',NULL,NULL,'FALSE',4330),(6,'Γεμιστά','Λαχταριστές ντομάτες και πιπεριές γεμιστές',326,'TRUE',8),(8,'Κεφτεδάκια με πατάτες',NULL,NULL,'FALSE',8),(48,'Burger','Είναι σαν να τρως αέρα!',1821,'TRUE',15),(68,'Μπριζολάκια','Χοιρινές μπριζόλες ξεροψημένες!',NULL,'FALSE',8132),(73,'Τυροκαυτερή','Η καλύτερη συνοδεία για τα τηγανητά κολοκυθάκια',276,'TRUE',8132),(124,'Γεμιστά','Παραδοσιακό ελληνικό πιάτο',392,'TRUE',4330),(478,'Πατσάς με σκορδοστούμπι','Ένα πιάτο που θυμίζει πολύ χωριό',450,'TRUE',4330),(548,'Fish&Chips','Μία γεύση από Αγγλία',840,'TRUE',7365); +INSERT INTO `food` VALUES (2,'Κεφτεδάκια με πατάτες',NULL,450,_binary '',8132),(4,'Κοτομπουκιές',NULL,NULL,_binary '\0',4330),(6,'Γεμιστά','Λαχταριστές ντομάτες και πιπεριές γεμιστές',326,_binary '',8),(8,'Κεφτεδάκια με πατάτες',NULL,NULL,_binary '\0',8),(48,'Burger','Είναι σαν να τρως αέρα!',1821,_binary '',15),(68,'Μπριζολάκια','Χοιρινές μπριζόλες ξεροψημένες!',NULL,_binary '\0',8132),(73,'Τυροκαυτερή','Η καλύτερη συνοδεία για τα τηγανητά κολοκυθάκια',276,_binary '',8132),(124,'Γεμιστά','Παραδοσιακό ελληνικό πιάτο',392,_binary '',4330),(478,'Πατσάς με σκορδοστούμπι','Ένα πιάτο που θυμίζει πολύ χωριό',450,_binary '',4330),(548,'Fish&Chips','Μία γεύση από Αγγλία',840,_binary '',7365); /*!40000 ALTER TABLE `food` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -57,4 +57,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:50 +-- Dump completed on 2018-12-21 14:34:54 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_food_has_ingredient.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_food_has_ingredient.sql index 584ec6f..ce152b0 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_food_has_ingredient.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_food_has_ingredient.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:50:01 +-- Dump completed on 2018-12-21 14:35:06 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_ingredient.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_ingredient.sql index f00f6f3..ed68fa9 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_ingredient.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_ingredient.sql @@ -51,4 +51,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:50:02 +-- Dump completed on 2018-12-21 14:35:07 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_permission.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_permission.sql index 89955c8..9981911 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_permission.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_permission.sql @@ -51,4 +51,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:49 +-- Dump completed on 2018-12-21 14:34:53 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_restaurant.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_restaurant.sql index 9ac7495..3c7a965 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_restaurant.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_restaurant.sql @@ -60,4 +60,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:56 +-- Dump completed on 2018-12-21 14:35:00 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_role.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_role.sql index ebd0e93..026d829 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_role.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_role.sql @@ -52,4 +52,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:50:00 +-- Dump completed on 2018-12-21 14:35:05 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_role_has_permission.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_role_has_permission.sql index cbd386a..b84e4c3 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_role_has_permission.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_role_has_permission.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:50:00 +-- Dump completed on 2018-12-21 14:35:04 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user.sql index 93e8694..82e8c94 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user.sql @@ -58,4 +58,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:53 +-- Dump completed on 2018-12-21 14:34:58 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user_follows_diet.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user_follows_diet.sql index c1a5d1d..380b9b6 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user_follows_diet.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user_follows_diet.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:58 +-- Dump completed on 2018-12-21 14:35:02 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user_prohibits_ingredient.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user_prohibits_ingredient.sql index 5165611..8c245b9 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user_prohibits_ingredient.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user_prohibits_ingredient.sql @@ -53,4 +53,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:59 +-- Dump completed on 2018-12-21 14:35:03 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_drink.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_drink.sql index 6d764e5..e7d6a0b 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_drink.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_drink.sql @@ -57,4 +57,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:54 +-- Dump completed on 2018-12-21 14:34:58 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_food.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_food.sql index 21cf9de..66ffebe 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_food.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_food.sql @@ -57,4 +57,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:52 +-- Dump completed on 2018-12-21 14:34:57 diff --git a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_restaurant.sql b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_restaurant.sql index f8ba074..6db8f2c 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_restaurant.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_user_rates_restaurant.sql @@ -60,4 +60,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:49:57 +-- Dump completed on 2018-12-21 14:35:01 diff --git a/Database implementation/dumps/Self Contained/dump.sql b/Database implementation/dumps/Self Contained/dump.sql index 20d9fc6..0f1f85d 100644 --- a/Database implementation/dumps/Self Contained/dump.sql +++ b/Database implementation/dumps/Self Contained/dump.sql @@ -141,7 +141,7 @@ CREATE TABLE `food` ( `food_name` varchar(200) NOT NULL, `food_description` varchar(150) DEFAULT NULL, `food_calories` int(11) DEFAULT NULL, - `food_is_approved` varchar(45) DEFAULT '0', + `food_is_approved` bit(1) DEFAULT b'0', `restaurant_id` int(11) NOT NULL, PRIMARY KEY (`food_id`), UNIQUE KEY `food_id_UNIQUE` (`food_id`), @@ -156,7 +156,7 @@ CREATE TABLE `food` ( LOCK TABLES `food` WRITE; /*!40000 ALTER TABLE `food` DISABLE KEYS */; -INSERT INTO `food` VALUES (2,'Κεφτεδάκια με πατάτες',NULL,450,'TRUE',8132),(4,'Κοτομπουκιές',NULL,NULL,'FALSE',4330),(6,'Γεμιστά','Λαχταριστές ντομάτες και πιπεριές γεμιστές',326,'TRUE',8),(8,'Κεφτεδάκια με πατάτες',NULL,NULL,'FALSE',8),(48,'Burger','Είναι σαν να τρως αέρα!',1821,'TRUE',15),(68,'Μπριζολάκια','Χοιρινές μπριζόλες ξεροψημένες!',NULL,'FALSE',8132),(73,'Τυροκαυτερή','Η καλύτερη συνοδεία για τα τηγανητά κολοκυθάκια',276,'TRUE',8132),(124,'Γεμιστά','Παραδοσιακό ελληνικό πιάτο',392,'TRUE',4330),(478,'Πατσάς με σκορδοστούμπι','Ένα πιάτο που θυμίζει πολύ χωριό',450,'TRUE',4330),(548,'Fish&Chips','Μία γεύση από Αγγλία',840,'TRUE',7365); +INSERT INTO `food` VALUES (2,'Κεφτεδάκια με πατάτες',NULL,450,_binary '',8132),(4,'Κοτομπουκιές',NULL,NULL,_binary '\0',4330),(6,'Γεμιστά','Λαχταριστές ντομάτες και πιπεριές γεμιστές',326,_binary '',8),(8,'Κεφτεδάκια με πατάτες',NULL,NULL,_binary '\0',8),(48,'Burger','Είναι σαν να τρως αέρα!',1821,_binary '',15),(68,'Μπριζολάκια','Χοιρινές μπριζόλες ξεροψημένες!',NULL,_binary '\0',8132),(73,'Τυροκαυτερή','Η καλύτερη συνοδεία για τα τηγανητά κολοκυθάκια',276,_binary '',8132),(124,'Γεμιστά','Παραδοσιακό ελληνικό πιάτο',392,_binary '',4330),(478,'Πατσάς με σκορδοστούμπι','Ένα πιάτο που θυμίζει πολύ χωριό',450,_binary '',4330),(548,'Fish&Chips','Μία γεύση από Αγγλία',840,_binary '',7365); /*!40000 ALTER TABLE `food` ENABLE KEYS */; UNLOCK TABLES; @@ -515,4 +515,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-12-21 13:51:00 +-- Dump completed on 2018-12-21 14:35:34 diff --git a/Database implementation/views/view_1_as_query.sql b/Database implementation/views/view_1_as_query.sql new file mode 100644 index 0000000..06ce2e0 --- /dev/null +++ b/Database implementation/views/view_1_as_query.sql @@ -0,0 +1,45 @@ +SELECT `restaurant`.`restaurant_id`, + `restaurant`.`restaurant_name`, + `restaurant`.`restaurant_category`, + `restaurant`.`restaurant_longitude`, + `restaurant`.`restaurant_latitude`, + `restaurant`.`restaurant_opening`, + `restaurant`.`restaurant_closing`, + `restaurant`.`user_id`, + `food`.`food_id` AS `item_id`, + `food`.`food_name` AS `item_name`, + `food`.`food_description` AS `item_description`, + `food`.`food_calories` AS `item_calories`, + `ingredient`.`ingredient_name`, + `ingredient`.`ingredient_has_alcohol` +FROM flavours_without_borders.restaurant +LEFT JOIN flavours_without_borders.food + ON restaurant.restaurant_id = food.restaurant_id +LEFT JOIN flavours_without_borders.food_has_ingredient + ON food.food_id = food_has_ingredient.food_id +LEFT JOIN flavours_without_borders.ingredient + ON food_has_ingredient.ingredient_name = ingredient.ingredient_name +WHERE restaurant.restaurant_is_approved = TRUE AND food.food_is_approved = TRUE +UNION +SELECT `restaurant`.`restaurant_id`, + `restaurant`.`restaurant_name`, + `restaurant`.`restaurant_category`, + `restaurant`.`restaurant_longitude`, + `restaurant`.`restaurant_latitude`, + `restaurant`.`restaurant_opening`, + `restaurant`.`restaurant_closing`, + `restaurant`.`user_id`, + `drink`.`drink_id` AS `item_id`, + `drink`.`drink_name` AS `item_name`, + `drink`.`drink_description` AS `item_description`, + NULL AS `item_calories`, + `ingredient`.`ingredient_name`, + `ingredient`.`ingredient_has_alcohol` +FROM flavours_without_borders.restaurant +LEFT JOIN flavours_without_borders.drink + ON restaurant.restaurant_id = drink.restaurant_id +LEFT JOIN flavours_without_borders.drink_has_ingredient + ON drink.drink_id = drink_has_ingredient.drink_id +LEFT JOIN flavours_without_borders.ingredient + ON drink_has_ingredient.ingredient_name = ingredient.ingredient_name +WHERE restaurant.restaurant_is_approved = TRUE AND drink.drink_is_approved = TRUE \ No newline at end of file