[
  {
    "question": "统计最近7天每个服务区的总营业收入和订单数量，并按营业收入降序排列。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营业收入, SUM(order_sum) AS 总订单数量 FROM bss_business_day_data WHERE oper_date >= CURRENT_DATE - INTERVAL '7 days' AND delete_ts IS NULL GROUP BY service_name ORDER BY 总营业收入 DESC;"
  },
  {
    "question": "查询2023年4月1日各档口的现金支付金额及订单数量，并按金额降序排序。",
    "sql": "SELECT branch_name AS 档口名称, rmb AS 现金支付金额, rmb_order AS 现金订单数量 FROM bss_business_day_data WHERE oper_date = '2023-04-01' AND delete_ts IS NULL ORDER BY 现金支付金额 DESC;"
  },
  {
    "question": "分析2023年4月各服务区微信支付与支付宝支付的占比情况。",
    "sql": "SELECT service_name AS 服务区名称, SUM(wx) / SUM(pay_sum) * 100 AS 微信支付占比, SUM(zfb) / SUM(pay_sum) * 100 AS 支付宝支付占比 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name;"
  },
  {
    "question": "找出2023年4月营业收入最高的前5个服务区。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name ORDER BY 总营业收入 DESC LIMIT 5;"
  },
  {
    "question": "统计2023年4月每天的营业收入趋势，显示每日总收入。",
    "sql": "SELECT oper_date AS 统计日期, SUM(pay_sum) AS 日营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY oper_date ORDER BY 统计日期;"
  },
  {
    "question": "比较不同服务区2023年4月的平均每日营业收入。",
    "sql": "SELECT service_name AS 服务区名称, AVG(pay_sum) AS 平均每日营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name ORDER BY 平均每日营业收入 DESC;"
  },
  {
    "question": "查询2023年4月营业收入最低的3个服务区。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name ORDER BY 总营业收入 ASC LIMIT 3;"
  },
  {
    "question": "统计2023年4月各服务区不同支付方式的订单数量分布。",
    "sql": "SELECT service_name AS 服务区名称, SUM(wx_order) AS 微信订单数, SUM(zf_order) AS 支付宝订单数, SUM(rmb_order) AS 现金订单数 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name;"
  },
  {
    "question": "查询2023年4月营业收入超过10000元的服务区。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name HAVING SUM(pay_sum) > 10000 ORDER BY 总营业收入 DESC;"
  },
  {
    "question": "统计2023年4月各服务区每日营业收入的波动情况。",
    "sql": "SELECT service_name AS 服务区名称, oper_date AS 统计日期, SUM(pay_sum) AS 日营业收入 FROM bss_business_day_data WHERE oper_date >= '2023-04-01' AND oper_date <= '2023-04-30' AND delete_ts IS NULL GROUP BY service_name, oper_date ORDER BY 服务区名称, 统计日期;"
  },
  {
    "question": "统计2023年每个月进入宜春服务区的车辆总数及平均每日车流量，并按月份排序。",
    "sql": "SELECT EXTRACT(MONTH FROM count_date) AS 月份, SUM(customer_count) AS 总车流量, AVG(customer_count) AS 日均车流量 FROM bss_car_day_count WHERE count_date BETWEEN '2023-01-01' AND '2023-12-31' AND service_area_id = (SELECT id FROM bss_service_area WHERE service_area_name = '宜春服务区') AND delete_ts IS NULL GROUP BY EXTRACT(MONTH FROM count_date) ORDER BY 月份;"
  },
  {
    "question": "2023年4月，各服务区车辆总数排名前5的服务区名称及车流量。",
    "sql": "SELECT sa.service_area_name AS 服务区名称, SUM(cc.customer_count) AS 总车流量 FROM bss_car_day_count cc JOIN bss_service_area sa ON cc.service_area_id = sa.id WHERE cc.count_date BETWEEN '2023-04-01' AND '2023-04-30' AND cc.delete_ts IS NULL AND sa.delete_ts IS NULL GROUP BY sa.service_area_name ORDER BY 总车流量 DESC LIMIT 5;"
  },
  {
    "question": "2023年，各车辆类型在所有服务区的占比情况。",
    "sql": "SELECT car_type AS 车辆类型, SUM(customer_count) AS 总车流量, ROUND(SUM(customer_count) * 100.0 / (SELECT SUM(customer_count) FROM bss_car_day_count WHERE count_date BETWEEN '2023-01-01' AND '2023-12-31' AND delete_ts IS NULL), 2) AS 占比百分比 FROM bss_car_day_count WHERE count_date BETWEEN '2023-01-01' AND '2023-12-31' AND delete_ts IS NULL GROUP BY car_type ORDER BY 总车流量 DESC;"
  },
  {
    "question": "2023年，平均每日车流量最低的3个服务区名称及平均车流量。",
    "sql": "SELECT sa.service_area_name AS 服务区名称, AVG(cc.customer_count) AS 日均车流量 FROM bss_car_day_count cc JOIN bss_service_area sa ON cc.service_area_id = sa.id WHERE cc.count_date BETWEEN '2023-01-01' AND '2023-12-31' AND cc.delete_ts IS NULL AND sa.delete_ts IS NULL GROUP BY sa.service_area_name ORDER BY 日均车流量 ASC LIMIT 3;"
  },
  {
    "question": "2023年4月，每天进入庐山服务区的车流量趋势变化。",
    "sql": "SELECT count_date AS 统计日期, customer_count AS 车流量 FROM bss_car_day_count WHERE count_date BETWEEN '2023-04-01' AND '2023-04-30' AND service_area_id = (SELECT id FROM bss_service_area WHERE service_area_name = '庐山服务区') AND delete_ts IS NULL ORDER BY count_date;"
  },
  {
    "question": "2023年4月，各公司管辖的服务区平均每日车流量对比。",
    "sql": "SELECT co.company_name AS 公司名称, AVG(cc.customer_count) AS 日均车流量 FROM bss_car_day_count cc JOIN bss_service_area sa ON cc.service_area_id = sa.id JOIN bss_company co ON sa.company_id = co.id WHERE cc.count_date BETWEEN '2023-04-01' AND '2023-04-30' AND cc.delete_ts IS NULL AND sa.delete_ts IS NULL AND co.delete_ts IS NULL GROUP BY co.company_name ORDER BY 日均车流量 DESC;"
  },
  {
    "question": "2023年4月，过境车辆最多的前3个服务区名称及数量。",
    "sql": "SELECT sa.service_area_name AS 服务区名称, SUM(cc.customer_count) AS 过境车流量 FROM bss_car_day_count cc JOIN bss_service_area sa ON cc.service_area_id = sa.id WHERE cc.count_date BETWEEN '2023-04-01' AND '2023-04-30' AND cc.car_type = '过境' AND cc.delete_ts IS NULL AND sa.delete_ts IS NULL GROUP BY sa.service_area_name ORDER BY 过境车流量 DESC LIMIT 3;"
  },
  {
    "question": "2023年4月，每个星期几在宜春服务区的平均车流量，并按星期排序。",
    "sql": "SELECT EXTRACT(DOW FROM count_date) AS 星期, AVG(customer_count) AS 日均车流量 FROM bss_car_day_count WHERE count_date BETWEEN '2023-04-01' AND '2023-04-30' AND service_area_id = (SELECT id FROM bss_service_area WHERE service_area_name = '宜春服务区') AND delete_ts IS NULL GROUP BY EXTRACT(DOW FROM count_date) ORDER BY 星期;"
  },
  {
    "question": "2023年4月，所有服务区中，每日车流量超过1000的日期及服务区名称。",
    "sql": "SELECT cc.count_date AS 统计日期, sa.service_area_name AS 服务区名称, cc.customer_count AS 车流量 FROM bss_car_day_count cc JOIN bss_service_area sa ON cc.service_area_id = sa.id WHERE cc.count_date BETWEEN '2023-04-01' AND '2023-04-30' AND cc.customer_count > 1000 AND cc.delete_ts IS NULL AND sa.delete_ts IS NULL ORDER BY cc.count_date;"
  },
  {
    "question": "2023年4月，各车辆类型在宜春服务区的每日车流量明细。",
    "sql": "SELECT count_date AS 统计日期, car_type AS 车辆类型, customer_count AS 车流量 FROM bss_car_day_count WHERE count_date BETWEEN '2023-04-01' AND '2023-04-30' AND service_area_id = (SELECT id FROM bss_service_area WHERE service_area_name = '宜春服务区') AND delete_ts IS NULL ORDER BY count_date, car_type;"
  },
  {
    "question": "统计各公司2023年4月1日的总营业收入，并按公司名称分组。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.pay_sum) AS 总营业收入 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name;"
  },
  {
    "question": "统计各公司2023年4月1日的车辆总数，并按公司名称排序。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(car_count) AS 车辆总数 FROM (SELECT service_area_id, SUM(customer_count) AS car_count FROM bss_car_day_count WHERE count_date = '2023-04-01' AND delete_ts IS NULL GROUP BY service_area_id) t JOIN bss_service_area s ON t.service_area_id = s.id JOIN bss_company b ON s.company_id = b.id GROUP BY b.company_name ORDER BY 车辆总数 DESC;"
  },
  {
    "question": "计算各公司单位车流的平均营业收入，并按公司名称排序。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.pay_sum) / SUM(car_count) AS 单位车流营收 FROM (SELECT service_area_id, SUM(customer_count) AS car_count FROM bss_car_day_count WHERE count_date = '2023-04-01' AND delete_ts IS NULL GROUP BY service_area_id) t JOIN bss_service_area s ON t.service_area_id = s.id JOIN bss_company b ON s.company_id = b.id JOIN bss_business_day_data a ON s.service_area_no = a.service_no WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name;"
  },
  {
    "question": "找出2023年4月1日营业收入最高的前5家公司。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.pay_sum) AS 总营业收入 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name ORDER BY 总营业收入 DESC LIMIT 5;"
  },
  {
    "question": "找出2023年4月1日车流量最高的前5家公司。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(car_count) AS 车辆总数 FROM (SELECT service_area_id, SUM(customer_count) AS car_count FROM bss_car_day_count WHERE count_date = '2023-04-01' AND delete_ts IS NULL GROUP BY service_area_id) t JOIN bss_service_area s ON t.service_area_id = s.id JOIN bss_company b ON s.company_id = b.id GROUP BY b.company_name ORDER BY 车辆总数 DESC LIMIT 5;"
  },
  {
    "question": "统计各公司在2023年4月1日的现金支付总金额，并按公司名称排序。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.rmb) AS 现金支付总额 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name ORDER BY 现金支付总额 DESC;"
  },
  {
    "question": "统计各公司在2023年4月1日使用微信支付的订单数量，并按公司名称排序。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.wx_order) AS 微信订单数量 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name;"
  },
  {
    "question": "比较各公司在2023年4月1日的支付宝支付金额占比。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.zfb) / SUM(a.pay_sum) * 100 AS 支付宝占比百分比 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name;"
  },
  {
    "question": "统计各公司在2023年4月1日的订单总数，并按订单数量排序。",
    "sql": "SELECT b.company_name AS 公司名称, SUM(a.order_sum) AS 订单总数 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name ORDER BY 订单总数 DESC;"
  },
  {
    "question": "找出2023年4月1日车流和营收均排名前五的公司。",
    "sql": "WITH car_count_rank AS (SELECT b.company_name AS 公司名称, SUM(car_count) AS 车辆总数 FROM (SELECT service_area_id, SUM(customer_count) AS car_count FROM bss_car_day_count WHERE count_date = '2023-04-01' AND delete_ts IS NULL GROUP BY service_area_id) t JOIN bss_service_area s ON t.service_area_id = s.id JOIN bss_company b ON s.company_id = b.id GROUP BY b.company_name ORDER BY 车辆总数 DESC LIMIT 5), revenue_rank AS (SELECT b.company_name AS 公司名称, SUM(a.pay_sum) AS 总营业收入 FROM bss_business_day_data a JOIN bss_service_area c ON a.service_no = c.service_area_no JOIN bss_company b ON c.company_id = b.id WHERE a.oper_date = '2023-04-01' AND a.delete_ts IS NULL GROUP BY b.company_name ORDER BY 总营业收入 DESC LIMIT 5) SELECT car_count_rank.公司名称 FROM car_count_rank INNER JOIN revenue_rank ON car_count_rank.公司名称 = revenue_rank.公司名称;"
  },
  {
    "question": "统计各路段关联的服务区数量，并按数量降序排列。",
    "sql": "SELECT section_name AS 路段名称, COUNT(service_area_id) AS 服务区数量 FROM bss_section_route LEFT JOIN bss_section_route_area_link ON bss_section_route.id = bss_section_route_area_link.section_route_id WHERE bss_section_route.delete_ts IS NULL GROUP BY section_name ORDER BY 服务区数量 DESC;"
  },
  {
    "question": "查询2023年4月1日各服务区的车流总量，并按车流降序排列。",
    "sql": "SELECT service_area_id AS 服务区ID, SUM(customer_count) AS 总车流量 FROM bss_car_day_count WHERE count_date = '2023-04-01' GROUP BY service_area_id ORDER BY 总车流量 DESC;"
  },
  {
    "question": "找出2023年4月1日车流最少的5个服务区。",
    "sql": "SELECT service_area_id AS 服务区ID, SUM(customer_count) AS 总车流量 FROM bss_car_day_count WHERE count_date = '2023-04-01' GROUP BY service_area_id ORDER BY 总车流量 ASC LIMIT 5;"
  },
  {
    "question": "分析2022年各路段的月均车流情况，并按路段排序。",
    "sql": "SELECT bss_section_route.section_name AS 路段名称, AVG(monthly_count) AS 月均车流量 FROM (SELECT bss_section_route_area_link.section_route_id, DATE_TRUNC('month', count_date) AS 月份, SUM(customer_count) AS monthly_count FROM bss_car_day_count JOIN bss_section_route_area_link ON bss_car_day_count.service_area_id = bss_section_route_area_link.service_area_id WHERE count_date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY bss_section_route_area_link.section_route_id, 月份) AS monthly_data JOIN bss_section_route ON monthly_data.section_route_id = bss_section_route.id GROUP BY bss_section_route.section_name ORDER BY 路段名称;"
  },
  {
    "question": "查询所有开放状态的服务区及其所属路段。",
    "sql": "SELECT bss_service_area.service_area_name AS 服务区名称, bss_section_route.section_name AS 路段名称 FROM bss_service_area JOIN bss_section_route_area_link ON bss_service_area.id = bss_section_route_area_link.service_area_id JOIN bss_section_route ON bss_section_route_area_link.section_route_id = bss_section_route.id WHERE bss_service_area.delete_ts IS NULL AND bss_service_area.service_state = '开放';"
  },
  {
    "question": "统计2023年4月1日各车辆类型在各服务区的分布情况。",
    "sql": "SELECT service_area_id AS 服务区ID, car_type AS 车辆类型, SUM(customer_count) AS 总车流量 FROM bss_car_day_count WHERE count_date = '2023-04-01' GROUP BY service_area_id, car_type ORDER BY 服务区ID, 总车流量 DESC;"
  },
  {
    "question": "查询2023年4月1日车流最多的3个路段及其总车流量。",
    "sql": "SELECT bss_section_route.section_name AS 路段名称, SUM(bss_car_day_count.customer_count) AS 总车流量 FROM bss_car_day_count JOIN bss_section_route_area_link ON bss_car_day_count.service_area_id = bss_section_route_area_link.service_area_id JOIN bss_section_route ON bss_section_route_area_link.section_route_id = bss_section_route.id WHERE bss_car_day_count.count_date = '2023-04-01' GROUP BY bss_section_route.section_name ORDER BY 总车流量 DESC LIMIT 3;"
  },
  {
    "question": "计算2023年4月1日各服务区车流占所属路段车流的百分比。",
    "sql": "WITH section_total AS (SELECT bss_section_route.id AS section_id, SUM(bss_car_day_count.customer_count) AS total_count FROM bss_car_day_count JOIN bss_section_route_area_link ON bss_car_day_count.service_area_id = bss_section_route_area_link.service_area_id JOIN bss_section_route ON bss_section_route_area_link.section_route_id = bss_section_route.id WHERE bss_car_day_count.count_date = '2023-04-01' GROUP BY bss_section_route.id), area_count AS (SELECT bss_section_route_area_link.section_route_id, bss_car_day_count.service_area_id, SUM(bss_car_day_count.customer_count) AS area_count FROM bss_car_day_count JOIN bss_section_route_area_link ON bss_car_day_count.service_area_id = bss_section_route_area_link.service_area_id WHERE bss_car_day_count.count_date = '2023-04-01' GROUP BY bss_section_route_area_link.section_route_id, bss_car_day_count.service_area_id) SELECT area_count.service_area_id AS 服务区ID, bss_section_route.section_name AS 路段名称, area_count.area_count AS 服务区车流量, section_total.total_count AS 路段总车流量, (area_count.area_count::numeric / section_total.total_count) * 100 AS 占比百分比 FROM area_count JOIN section_total ON area_count.section_route_id = section_total.section_id JOIN bss_section_route ON area_count.section_route_id = bss_section_route.id;"
  },
  {
    "question": "统计各公司管辖路段的平均服务区数量。",
    "sql": "SELECT bss_company.company_name AS 公司名称, AVG(area_count) AS 平均服务区数量 FROM (SELECT bss_section_route.section_name, COUNT(bss_section_route_area_link.service_area_id) AS area_count FROM bss_section_route LEFT JOIN bss_section_route_area_link ON bss_section_route.id = bss_section_route_area_link.section_route_id GROUP BY bss_section_route.section_name) AS section_area_count JOIN bss_section_route ON section_area_count.section_name = bss_section_route.section_name JOIN bss_service_area ON bss_section_route.id = (SELECT section_route_id FROM bss_section_route_area_link WHERE bss_section_route_area_link.service_area_id = bss_service_area.id LIMIT 1) JOIN bss_company ON bss_service_area.company_id = bss_company.id GROUP BY bss_company.company_name;"
  },
  {
    "question": "查询2023年4月1日所有服务区的车流数据，包括车辆类型明细。",
    "sql": "SELECT service_area_id AS 服务区ID, car_type AS 车辆类型, customer_count AS 车流量 FROM bss_car_day_count WHERE count_date = '2023-04-01' ORDER BY 服务区ID, 车流量 DESC;"
  },
  {
    "question": "统计最近7天内每天各服务区的营业总额，并按日期和服务区名称排序。",
    "sql": "SELECT oper_date AS 统计日期, service_name AS 服务区名称, SUM(pay_sum) AS 营业总额 FROM bss_business_day_data WHERE delete_ts IS NULL AND oper_date >= CURRENT_DATE - 7 GROUP BY oper_date, service_name ORDER BY oper_date, service_name;"
  },
  {
    "question": "统计各服务区在2023年4月期间的总营收，并按营收从高到低排序。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营收 FROM bss_business_day_data WHERE delete_ts IS NULL AND EXTRACT(YEAR FROM oper_date) = 2023 AND EXTRACT(MONTH FROM oper_date) = 4 GROUP BY service_name ORDER BY 总营收 DESC;"
  },
  {
    "question": "统计2023年4月期间，开放状态和关闭状态的服务区的平均日营收，并按状态排序。",
    "sql": "SELECT sa.service_state AS 服务区状态, AVG(bd.pay_sum) AS 平均日营收 FROM bss_business_day_data bd JOIN bss_service_area sa ON bd.service_no = sa.service_area_no WHERE bd.delete_ts IS NULL AND sa.delete_ts IS NULL AND EXTRACT(YEAR FROM bd.oper_date) = 2023 AND EXTRACT(MONTH FROM bd.oper_date) = 4 GROUP BY sa.service_state ORDER BY 平均日营收 DESC;"
  },
  {
    "question": "找出2023年4月营收最高的前5个服务区。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营收 FROM bss_business_day_data WHERE delete_ts IS NULL AND EXTRACT(YEAR FROM oper_date) = 2023 AND EXTRACT(MONTH FROM oper_date) = 4 GROUP BY service_name ORDER BY 总营收 DESC LIMIT 5;"
  },
  {
    "question": "统计2023年4月每天开放状态服务区的总营收，并按日期排序。",
    "sql": "SELECT bd.oper_date AS 统计日期, SUM(bd.pay_sum) AS 开放状态总营收 FROM bss_business_day_data bd JOIN bss_service_area sa ON bd.service_no = sa.service_area_no WHERE sa.service_state = '开放' AND bd.delete_ts IS NULL AND sa.delete_ts IS NULL AND EXTRACT(YEAR FROM bd.oper_date) = 2023 AND EXTRACT(MONTH FROM bd.oper_date) = 4 GROUP BY bd.oper_date ORDER BY 统计日期;"
  },
  {
    "question": "统计2023年4月每天关闭状态服务区的总营收，并按日期排序。",
    "sql": "SELECT bd.oper_date AS 统计日期, SUM(bd.pay_sum) AS 关闭状态总营收 FROM bss_business_day_data bd JOIN bss_service_area sa ON bd.service_no = sa.service_area_no WHERE sa.service_state = '关闭' AND bd.delete_ts IS NULL AND sa.delete_ts IS NULL AND EXTRACT(YEAR FROM bd.oper_date) = 2023 AND EXTRACT(MONTH FROM bd.oper_date) = 4 GROUP BY bd.oper_date ORDER BY 统计日期;"
  },
  {
    "question": "比较2023年4月开放和关闭状态服务区的总营收差异。",
    "sql": "SELECT sa.service_state AS 服务区状态, SUM(bd.pay_sum) AS 总营收 FROM bss_business_day_data bd JOIN bss_service_area sa ON bd.service_no = sa.service_area_no WHERE bd.delete_ts IS NULL AND sa.delete_ts IS NULL AND EXTRACT(YEAR FROM bd.oper_date) = 2023 AND EXTRACT(MONTH FROM bd.oper_date) = 4 GROUP BY sa.service_state;"
  },
  {
    "question": "统计2023年4月每天所有服务区的总营收，并按日期排序。",
    "sql": "SELECT oper_date AS 统计日期, SUM(pay_sum) AS 总营收 FROM bss_business_day_data WHERE delete_ts IS NULL AND EXTRACT(YEAR FROM oper_date) = 2023 AND EXTRACT(MONTH FROM oper_date) = 4 GROUP BY oper_date ORDER BY 统计日期;"
  },
  {
    "question": "列出2023年4月期间，每个服务区的总营收、订单总数，并按总营收从高到低排序。",
    "sql": "SELECT service_name AS 服务区名称, SUM(pay_sum) AS 总营收, SUM(order_sum) AS 订单总数 FROM bss_business_day_data WHERE delete_ts IS NULL AND EXTRACT(YEAR FROM oper_date) = 2023 AND EXTRACT(MONTH FROM oper_date) = 4 GROUP BY service_name ORDER BY 总营收 DESC;"
  },
  {
    "question": "统计2023年4月期间，开放状态服务区的总营收、订单总数，并按总营收从高到低排序。",
    "sql": "SELECT bd.service_name AS 服务区名称, SUM(bd.pay_sum) AS 总营收, SUM(bd.order_sum) AS 订单总数 FROM bss_business_day_data bd JOIN bss_service_area sa ON bd.service_no = sa.service_area_no WHERE sa.service_state = '开放' AND bd.delete_ts IS NULL AND sa.delete_ts IS NULL AND EXTRACT(YEAR FROM bd.oper_date) = 2023 AND EXTRACT(MONTH FROM bd.oper_date) = 4 GROUP BY bd.service_name ORDER BY 总营收 DESC;"
  }
]