| /* | |
| { | |
| "qid": "002", | |
| "task_type": "ambig", | |
| "has_intended_resolution": true, | |
| "language": "SQLite", | |
| "db": "retails", | |
| "question": "Count the number of suppliers that offer both air and rail shipping in America.", | |
| "gold_ambiguity_points": [ | |
| { | |
| "id": "A", | |
| "phrase": "suppliers that offer both air and rail shipping in America", | |
| "type": "finite", | |
| "ambiguity_type": "syntactic_computation", | |
| "interpretations": [ | |
| "suppliers that offer air and rail shipping to customers in America", | |
| "suppliers in America that offer air and rail shipping" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| }, | |
| { | |
| "id": "B", | |
| "phrase": "air", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_value", | |
| "interpretations": [ | |
| "ship mode is AIR", | |
| "ship mode is AIR or REG AIR" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| }, | |
| { | |
| "id": "C", | |
| "phrase": "America", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_table", | |
| "interpretations": [ | |
| "United States (country)", | |
| "Americas (region)" | |
| ], | |
| "intended_interpretation_idx": 1 | |
| } | |
| ], | |
| "gold_intended_query_id": "GQRY-A.0-B.0-C.1", | |
| "extra_info": {} | |
| } | |
| */ | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "United States (country)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers that offer air and rail shipping to customers in America", | |
| "[C] air": "ship mode is AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'AIR' | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 8588 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "Americas (region)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers that offer air and rail shipping to customers in America", | |
| "[C] air": "ship mode is AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'AIR' | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 10000 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "United States (country)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers that offer air and rail shipping to customers in America", | |
| "[C] air": "ship mode is AIR or REG AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode IN ('AIR', 'REG AIR') | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 9201 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "Americas (region)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers that offer air and rail shipping to customers in America", | |
| "[C] air": "ship mode is AIR or REG AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode IN ('AIR', 'REG AIR') | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| JOIN customer c ON o.o_custkey = c.c_custkey | |
| JOIN nation n ON c.c_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 10000 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "United States (country)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers in America that offer air and rail shipping", | |
| "[C] air": "ship mode is AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'AIR' | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 391 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "Americas (region)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers in America that offer air and rail shipping", | |
| "[C] air": "ship mode is AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'AIR' | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 1992 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "United States (country)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers in America that offer air and rail shipping", | |
| "[C] air": "ship mode is AIR or REG AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode IN ('AIR', 'REG AIR') | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| WHERE n.n_name = 'UNITED STATES' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 391 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] America": "Americas (region)", | |
| "[B] suppliers that offer both air and rail shipping in America": "suppliers in America that offer air and rail shipping", | |
| "[C] air": "ship mode is AIR or REG AIR" | |
| } | |
| } | |
| } | |
| */ | |
| WITH usa_suppliers_with_air AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode IN ('AIR', 'REG AIR') | |
| ), | |
| usa_suppliers_with_rail AS ( | |
| SELECT DISTINCT l.l_suppkey | |
| FROM lineitem l | |
| JOIN supplier s ON l.l_suppkey = s.s_suppkey | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AMERICA' | |
| AND l.l_shipmode = 'RAIL' | |
| ) | |
| SELECT COUNT(*) AS supplier_count | |
| FROM usa_suppliers_with_air a | |
| JOIN usa_suppliers_with_rail r ON a.l_suppkey = r.l_suppkey; | |
| /* EXEC RESULT | |
| supplier_count | |
| 1992 | |
| */ | |
| ----- END OF GOLD QUERY ----- |