Write a SQL query to analyze Kfc France restaurant performance by day, including sales, food cost, labor cost, and waste, and identify the worst-performing locations.
Use the provided Kfc France restaurant, sales, cost, and waste tables. Treat missing cost or waste values as zero for performance calculations.
Output
- One row per restaurant and business date with
business_date, restaurant_name, sales, food_cost, labor_cost, waste, operating_contribution, previous_day_contribution, performance_rank, and is_worst_performer.
- Include restaurants with sales records only, rank locations from lowest to highest operating contribution within each date, include ties, and order by date, rank, and restaurant name.