Restaurants in the areaserve various food to customers.As long as customers keep showing up to a restaurant regularly, that restaurant will keep...
Question Get Answer

Restaurants in the area serve various food to customers. As long as

customers keep showing up to a restaurant regularly, that restaurant will keep serving the same dish. If no customers visit a restaurant for more than 3 days, then that restaurant will serve a new type of food starting when the next customer visits. Unfortunately, some ingredients were contaminated and caused a few customers to suffer from food poisoning. The restaurants know which food was affected and are now trying to figure out which customers were affected. The restaurants keep their own catalogue of customers, so there is no guarantee that a customer has the same customer ID at each restaurant. All restaurants serve food in the same order. Figure out which customer ate which food.
Sample Data:
restaurant_id,customer_id,visit_date
1,1,2020-01-01
2,1,2020-01-01
1,2,2020-01-03
3,1,2020-01-04
2,2,2020-01-14
3,1,2020-01-11
2,3,2020-01-14


Food:


food_id,food_name
1,Spaghetti
2,Chicken and Rice
3,Tacos
 
Desired:
Restaurant,Customer,Visit,Food
1,1,2020-01-01,Spaghetti
2,1,2020-01-01,Spaghetti
1,2,2020-01-03,Spaghetti
3,1,2020-01-04,Spaghetti
2,2,2020-01-10,Chicken and Rice
3,1,2020-01-11,Chicken and Rice
2,3,2020-01-14,Tacos

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 MYSQL tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes