Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT `id`, `name`, `info`, `food`, `drinks`, `service`, `ambience`, `hygiene`, `recommend`, `best_menu`, `best_service`, `author`, `username`
- FROM `restaurants` RIGHT JOIN `rating` ON `rating`.`rid` IN (1,2,3);
- SELECT `rid` as `id`, COUNT(*) as `count`, AVG(`food`+`drinks`+`service`+`ambience`+`hygiene`) as `average`, SUM(`food`) as `food`, SUM(`drinks`) as `drinks`, SUM(`service`) as `service`, SUM(`ambience`) as `ambience`, SUM(`hygiene`) as `hygiene`, concat(round(( SUM(`recommend`)/COUNT(*) * 100 ),2),'%') as `recommended`, `best_menu` as `best`, `best_service` as `service`, `voted` as `last vote`
- FROM `rating` WHERE `rid` IN (3,1,2) GROUP BY `rid` ORDER BY `best_menu`, `best_service`;
- ratings_index
- (rating_id*,rating_title,rating_type(integer,string));
- users
- (user_id*,username,email)
- venues
- (venue_id,name,address)
- user_integer_ratings
- (user_id*,venue_id*,rating_id*,rating)
- user_string_ratings
- (user_id*,venue_id*,rating_id*,rating)
- * = (component of) PRIMARY KEY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement