From 733fcb7464cce0af290f748b7e49b8ebc2bb417e Mon Sep 17 00:00:00 2001 From: Apostolof Date: Fri, 21 Dec 2018 13:51:25 +0200 Subject: [PATCH] Add more example entries, Complete queries --- .../dumps/Project Folder/flavours_without_borders_diet.sql | 2 +- .../flavours_without_borders_diet_prohibits_ingredient.sql | 2 +- .../dumps/Project Folder/flavours_without_borders_drink.sql | 2 +- .../flavours_without_borders_drink_has_ingredient.sql | 2 +- .../dumps/Project Folder/flavours_without_borders_food.sql | 2 +- .../flavours_without_borders_food_has_ingredient.sql | 2 +- .../Project Folder/flavours_without_borders_ingredient.sql | 2 +- .../Project Folder/flavours_without_borders_permission.sql | 2 +- .../Project Folder/flavours_without_borders_restaurant.sql | 2 +- .../dumps/Project Folder/flavours_without_borders_role.sql | 2 +- .../flavours_without_borders_role_has_permission.sql | 2 +- .../dumps/Project Folder/flavours_without_borders_user.sql | 2 +- .../flavours_without_borders_user_follows_diet.sql | 2 +- .../flavours_without_borders_user_prohibits_ingredient.sql | 2 +- .../flavours_without_borders_user_rates_drink.sql | 2 +- .../flavours_without_borders_user_rates_food.sql | 2 +- .../flavours_without_borders_user_rates_restaurant.sql | 4 ++-- Database implementation/dumps/Self Contained/dump.sql | 4 ++-- Database implementation/queries/query_10.sql | 6 ++++++ 19 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 Database implementation/queries/query_10.sql 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 7c10bdb..048ffa5 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:33:51 +-- Dump completed on 2018-12-21 13:49:51 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 ce4c773..1362d9c 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:33:55 +-- Dump completed on 2018-12-21 13:49:55 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 efe2f24..2a131d0 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:33:50 +-- Dump completed on 2018-12-21 13:49:50 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 7f874ab..4a4e224 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:33:48 +-- Dump completed on 2018-12-21 13:49:48 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 b4f74df..f86aa6f 100644 --- a/Database implementation/dumps/Project Folder/flavours_without_borders_food.sql +++ b/Database implementation/dumps/Project Folder/flavours_without_borders_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:33:49 +-- Dump completed on 2018-12-21 13:49:50 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 1cbd039..584ec6f 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:34:01 +-- Dump completed on 2018-12-21 13:50:01 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 4cb7c0e..f00f6f3 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:34:02 +-- Dump completed on 2018-12-21 13:50:02 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 d7bbcf2..89955c8 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:33:49 +-- Dump completed on 2018-12-21 13:49:49 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 8e8b6df..9ac7495 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:33:56 +-- Dump completed on 2018-12-21 13:49:56 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 666fba7..ebd0e93 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:34:00 +-- Dump completed on 2018-12-21 13:50:00 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 0a02c14..cbd386a 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:34:00 +-- Dump completed on 2018-12-21 13:50:00 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 83fc1ee..93e8694 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:33:53 +-- Dump completed on 2018-12-21 13:49:53 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 ae723ff..c1a5d1d 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:33:58 +-- Dump completed on 2018-12-21 13:49:58 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 bf9f484..5165611 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:33:59 +-- Dump completed on 2018-12-21 13:49:59 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 f92b969..6d764e5 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:33:54 +-- Dump completed on 2018-12-21 13:49:54 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 77dc000..21cf9de 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:33:52 +-- Dump completed on 2018-12-21 13:49:52 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 fb7c772..f8ba074 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 @@ -47,7 +47,7 @@ CREATE TABLE `user_rates_restaurant` ( LOCK TABLES `user_rates_restaurant` WRITE; /*!40000 ALTER TABLE `user_rates_restaurant` DISABLE KEYS */; -INSERT INTO `user_rates_restaurant` VALUES (215,4330,18,5,'2018-10-02','Χορταστικό φαΐ!','hard'),(215,6211,NULL,4,'2018-04-04','','hard'),(356,4330,NULL,4,'2018-09-16',NULL,NULL),(24788,1356,NULL,5,'2018-06-08','Φιλικότατο προσωπικό!','moderate'),(24788,4330,2,3,'2018-01-04','Λίγες επιλογές για διαβητικούς.',NULL); +INSERT INTO `user_rates_restaurant` VALUES (7,15,2,2,'2017-06-01','Χάλι μαύρο',NULL),(7,7365,NULL,3,'2018-02-21','Μέτριο.',NULL),(9,15,NULL,3,'2016-05-08','Δεν χόρτασα','easy'),(215,4330,18,5,'2018-10-02','Χορταστικό φαΐ!','hard'),(215,6211,NULL,4,'2018-04-04','','hard'),(356,4330,NULL,4,'2018-09-16',NULL,NULL),(666,7365,NULL,3,'2018-04-16',NULL,'easy'),(8756,15,18,2,'2017-09-11',NULL,'moderate'),(24788,1356,NULL,5,'2018-06-08','Φιλικότατο προσωπικό!','moderate'),(24788,4330,2,3,'2018-01-04','Λίγες επιλογές για διαβητικούς.',NULL); /*!40000 ALTER TABLE `user_rates_restaurant` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -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:33:57 +-- Dump completed on 2018-12-21 13:49:57 diff --git a/Database implementation/dumps/Self Contained/dump.sql b/Database implementation/dumps/Self Contained/dump.sql index 838e36b..20d9fc6 100644 --- a/Database implementation/dumps/Self Contained/dump.sql +++ b/Database implementation/dumps/Self Contained/dump.sql @@ -502,7 +502,7 @@ CREATE TABLE `user_rates_restaurant` ( LOCK TABLES `user_rates_restaurant` WRITE; /*!40000 ALTER TABLE `user_rates_restaurant` DISABLE KEYS */; -INSERT INTO `user_rates_restaurant` VALUES (215,4330,18,5,'2018-10-02','Χορταστικό φαΐ!','hard'),(215,6211,NULL,4,'2018-04-04','','hard'),(356,4330,NULL,4,'2018-09-16',NULL,NULL),(24788,1356,NULL,5,'2018-06-08','Φιλικότατο προσωπικό!','moderate'),(24788,4330,2,3,'2018-01-04','Λίγες επιλογές για διαβητικούς.',NULL); +INSERT INTO `user_rates_restaurant` VALUES (7,15,2,2,'2017-06-01','Χάλι μαύρο',NULL),(7,7365,NULL,3,'2018-02-21','Μέτριο.',NULL),(9,15,NULL,3,'2016-05-08','Δεν χόρτασα','easy'),(215,4330,18,5,'2018-10-02','Χορταστικό φαΐ!','hard'),(215,6211,NULL,4,'2018-04-04','','hard'),(356,4330,NULL,4,'2018-09-16',NULL,NULL),(666,7365,NULL,3,'2018-04-16',NULL,'easy'),(8756,15,18,2,'2017-09-11',NULL,'moderate'),(24788,1356,NULL,5,'2018-06-08','Φιλικότατο προσωπικό!','moderate'),(24788,4330,2,3,'2018-01-04','Λίγες επιλογές για διαβητικούς.',NULL); /*!40000 ALTER TABLE `user_rates_restaurant` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -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:32:09 +-- Dump completed on 2018-12-21 13:51:00 diff --git a/Database implementation/queries/query_10.sql b/Database implementation/queries/query_10.sql new file mode 100644 index 0000000..d137c45 --- /dev/null +++ b/Database implementation/queries/query_10.sql @@ -0,0 +1,6 @@ +SELECT restaurant.restaurant_id, AVG(user_rates_restaurant.rating_grade) AS 'Average rating' +FROM flavours_without_borders.restaurant +JOIN flavours_without_borders.user_rates_restaurant + ON restaurant.restaurant_id = user_rates_restaurant.restaurant_id +WHERE restaurant_name = "McDonald's" +GROUP BY restaurant_id \ No newline at end of file