Question
What is the code to put in my visual studio code if I want to do out average ratings of restaurants by adding all the
What is the code to put in my visual studio code if I want to do out average ratings of restaurants by adding all the ratings in the comments and divide by the number of comments to get average ratings for each restaurant. So that whenever, a new user comment a rating, it will change the overall rating.
One of the data I have for comment table
"_id": 2,
"restaurantId": 18,
"restaurant": "Din Tai Fung",
"username": "paul_lim",
"review": "updated review",
"date_time_posted": "Tue Sep 07 2019 15:00:54 GMT+0800 (Malay Peninsula Standard Time)",
"rating": 5,
"filter": "newest",
"user_informationId": 10
One of the data I have for restaurant table
"_id": 2,
"name": "Din Tai Fung",
"story": "Having originally been founded as a cooking oil retail business in 1958, in 1972 Din Tai Fung was reborn as a steamed dumpling and noodle restaurant. Din Tai Fung Dumpling House focused on achieving steady improvement in quality and in the level of service that the restaurant provided.",
"thumb": "images/restaurant/m-dintaifung-v2.jpg",
"contact": "+65 6341 6566",
"menu": "images/restaurant/e-dintaifung-v2.jpg",
"location": "The Seletar Mall 33 Sengkang West Avenue #02-07 Singapore 797653",
"average_price": "$20",
"rating": 5,
"category": "Chinese",
"opening_hours": "Monday to friday 1130am-9pm, Saturday 11am-9:30pm, Sunday 11am-9pm",
"poster": "images/restaurant/t-dintaifung-v2.jpg",
"area": "Sengkang"
i am using visual studio code and mysql workbench
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started