db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
movie_platform | For all ratings which are rated in year 2020, name the movies which has the rating scored 4 and above. | ratings in year 2020 refers to rating_timestamp_utc like '%2020%'; rating_score > = 4; | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE CAST(SUBSTR(T1.rating_timestamp_utc, 1, 4) AS INTEGER) = 2020 AND CAST(SUBSTR(T1.rating_timestamp_utc, 6, 2) AS INTEGER) > 4 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
retails | What is the nationality of supplier number 1? | nationality refers to n_name; supplier number 1 refers to s_suppkey = 1 | SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Please list any two parts that come with the wrap bag container and have a supply cost of under 10. | part name refers to p_name; wrap bag container refers to p_container = 'WRAP BAG'; supply cost of under 10 refers to ps_supplycost < 10 | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost < 10 AND T1.p_container = 'WRAP BAG' LIMIT 2 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the name of the most expensive car? | name of the car refers to car_name; the most expensive refers to max(price) | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T2.price DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Please name any three parts that have an available quantity of more than 9998. | part name refers to p_name; an available quantity of more than 9998 refers to ps_availqty > 9998 | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_availqty > 9998 LIMIT 3 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the fastest car made by Japan? | the fastest refers to max(horsepower); made by Japan refers to country = 'Japan'; name of the car refers to car_name | SELECT T1.car_name FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T3.country = 'Japan' ORDER BY T1.horsepower DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the supply cost of large plated tin? | supply cost refers to ps_supplycost; large plated tin refers to p_type = 'large plated tin' | SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'large plated tin' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Which Dodge car is the cheapest? | Dodge car refers to car_name LIKE 'dodge%'; the cheapest refers to min(price); name of the car refers to car_name | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.car_name LIKE 'dodge%' ORDER BY T2.price ASC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the difference between the number of returned items and not returned items with the full price of under 16947.7? | full price of under 16947.7 refers to l_extendedprice < 16947.7; returned item refers to l_returnflag = 'R'; not returned item refers to l_returnflag = 'A' OR l_returnflag = 'N'; difference = subtract(count(l_linenumber where l_returnflag = 'A' OR l_returnflag = 'N'), count(l_linenumber where l_returnflag = 'R')) where... | SELECT SUM(IIF(l_returnflag = 'A', 1, 0)) - SUM(IIF(l_returnflag = 'N', 1, 0)) AS diff FROM lineitem WHERE l_extendedprice < 16947.7 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Please list all the years in which the car model Chevrolet Impala was introduced in the market. | year refers to model_year; Chevrolet Impala refers to car_name = 'chevrolet impala' | SELECT DISTINCT T1.model_year FROM production AS T1 INNER JOIN data AS T2 ON T1.ID = T2.ID WHERE T2.car_name = 'chevrolet impala' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the discounted price of line item number 1? | discounted price refers to multiply(l_extendedprice, subtract(1, l_discount)); line item number 1 refers to l_linenumber = 1 | SELECT l_extendedprice * (1 - l_discount) FROM lineitem WHERE l_linenumber = 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars with an engine displacement of no less than 400 cubic millimeter, how many cars cost at least 30,000? | engine displacement of no less than 400 cubic millimeter refers to displacement > 400; cost at least 30,000 refers to price > 30000 | SELECT COUNT(*) FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.displacement > 400 AND T2.price > 30000 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
movie_platform | List all movies with the best rating score. State the movie title and number of Mubi user who loves the movie. | best rating score refers to rating_score = 5; number of Mubi user who loves the movie refers to movie_popularity; | SELECT DISTINCT T2.movie_title, T2.movie_popularity FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
retails | Please list any three customers with debt. | customer refers to c_name; with debt refers to c_acctbal < 0 | SELECT c_name FROM customer WHERE c_acctbal < 0 LIMIT 3 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | How many orders in 1998 had a total price under 950? | 1998 refers to year(o_orderdate) = '1998'; a total price under 950 refers to o_totalprice < 950 | SELECT COUNT(o_orderkey) AS countorders FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1998' AND o_totalprice < 950 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Which country produced the most fuel-efficient car? | the most fuel-efficient refers to max(mpg) | SELECT T3.country FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country ORDER BY T1.mpg DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the total price and the order priority of order number 33? | total price refers to o_totalprice; order priority refers to o_orderpriority; order number 33 refers to o_orderkey = 33 | SELECT o_totalprice, o_orderpriority FROM orders WHERE o_orderkey = 33 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Which ship mode has more "deliver in person" instructions, rail or mail? | ship mode refers to l_shipmode; "deliver in person" instruction refers to l_shipinstruct = 'DELIVER IN PERSON' | SELECT IIF(SUM(IIF(l_shipmode = 'RAIL', 1, 0)) - SUM(IIF(l_shipmode = 'MAIL', 1, 0)), 'RAIL', 'MAIL') AS result FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the name of the most expensive car that was produced by the USA? | name of the car refers to car_name; the most expensive refers to max(price); produced by the USA refers to country = 'USA' | SELECT T4.car_name FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T3.country = 'USA' ORDER BY T1.price DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many of the line items that have a quantity greater than 40 have been shipped by air? | quantity greater than 40 refers to l_quantity > 40; shipped by air refers to l_shipmode = 'AIR' | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 40 AND l_shipmode = 'AIR' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | How much is the Peugeot 505s Turbo Diesel? | cost refers to price; Peugeot 505s Turbo Diesel refers to car_name = 'peugeot 505s turbo diesel' | SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'peugeot 505s turbo diesel' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Please list any three line item numbers that have 10% off. | line item number refers to l_linenumber; 10% off refers to l_discount = 0.1 | SELECT l_linenumber FROM lineitem WHERE l_discount = 0.1 LIMIT 3 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the car models introduced in the market in 1970, how many of them have the USA as their origin country? | introduced in the market in 1970 refers to model_year = 1970; have the USA as origin country refers to country = 'USA' | SELECT COUNT(*) FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin WHERE T1.model_year = 1970 AND T2.country = 'USA' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Please state the segment, the name, the address, and the phone number of customer number 3. | segment refers to c_mktsegment; name refers to c_name; address refers to c_address; phone number refers to c_phone; customer number 3 refers to c_custkey = 3 | SELECT c_mktsegment, c_name, c_address, c_phone FROM customer WHERE c_custkey = 3 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | What percentage of customers engaged in the household segment are from Iran? | the household segment refers to c_mktsegment = 'HOUSEHOLD'; Iran is nation name which refers to n_name = 'IRAN'; percentage = divide(count(c_custkey where n_name = 'IRAN'), count(c_custkey)) where c_mktsegment = 'HOUSEHOLD' * 100% | SELECT CAST(SUM(IIF(T2.n_name = 'IRAN', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Which country produced the highest number of cars? Calculate the annual average number of cars that the said country produced from the very start to the present. | the highest number of cars refers to max(country); annual average number = divide(count(ID), count(model_year)) | SELECT T2.country, CAST(COUNT(T1.ID) AS REAL) / COUNT(DISTINCT T1.model_year) FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin GROUP BY T2.country ORDER BY COUNT(T2.country) DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Calculate the average profit of prom brushed steel products. | prom brushed steel refers to p_type = 'PROMO BRUSHED STEEL'; average profit = divide(sum(subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))), count(ps_partkey)) | SELECT SUM(T2.l_extendedprice * (1 - T2.l_discount) - T1.ps_supplycost * T2.l_quantity) / COUNT(T1.ps_partkey) FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_type = 'PROMO BRUSHED STEEL' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Which year did Europe produce the most cars? | year refers to model_year; Europe refers to country = 'Europe'; the most cars refers to max(model_year) | SELECT T1.model_year FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin WHERE T2.country = 'Europe' GROUP BY T1.model_year ORDER BY COUNT(T1.model_year) DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many products shipped on 19/11/1994 were ordered on 21/09/1994? | shipped on 19/11/1994 refers to l_shipdate = '1994-11-19'; ordered on 21/09/1994 refers to o_orderdate = '1994-09-21' | SELECT COUNT(T2.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1994-09-21' AND T2.l_shipdate = '1994-11-19' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the miles per square hour of the cheapest car produced by the USA? | miles per square hour refers to acceleration; the cheapest refers to min(price); produced by the USA refers to country = 'USA' | SELECT T4.acceleration FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T3.country = 'USA' ORDER BY T1.price ASC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many suppliers from Germany have left a comment with 'carefully regular packages'? | Germany is nation name which refers to n_name = 'GERMANY'; comment with 'carefully regular packages' refers to s_comment LIKE 'carefully regular packages%' | SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.s_comment LIKE '%carefully regular packages%' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Indicate the name of the parts without discount. | name of the part refers to p_name; without discount refers to l_discount = 0.0000 | SELECT T3.p_name FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T2.l_discount = 0.0000 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | List the name of the cars with model year 1975. | name of the car refers to car_name; model year 1975 refers to model_year = 1975 | SELECT T1.car_name FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T2.model_year = 1975 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many different clerks have served the customer with the address uFTe2u518et8Q8UC? | clerk who have served the customer refers to o_clerk
| SELECT COUNT(T1.o_clerk) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_address = 'uFTe2u518et8Q8UC' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Please list the names of the top 3 most expensive cars. | name of the car refers to car_name; the most expensive refers to max(price) | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T2.price DESC LIMIT 3 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Indicate the name of the product that is close to being sold out and that has the lowest cost price. | name of the product refers to p_name; close to being sold out refers to ps_availqty < 10; the lowest cost price refers to min(ps_supplycost) | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_availqty < 10 ORDER BY T2.ps_supplycost LIMIT 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | How many of the cars from Japan weighed less than 3000? | from Japan refers to country = 'Japan'; weighed less than 3000 refers to weight < 3000 | SELECT COUNT(*) FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T3.country = 'Japan' AND T4.weight < 3000 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many clients from Mozambique required orders with a low priority order? | Mozambique refers to n_name = 'MOZAMBIQUE'; low priority order refers to o_orderpriority = '5-LOW' | SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'MOZAMBIQUE' AND T3.o_orderpriority = '5-LOW' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the percentage of cars that was produced by Japan among those that have a sweep volume of no less than 30? | produced by Japan refers to country = 'Japan'; a sweep volume of no less than 30 refers to divide(displacement, cylinders) > 30; percentage = divide(count(ID where country = 'Japan'), count(ID)) * 100% where divide(displacement, cylinders) > 30 | SELECT CAST(SUM(CASE WHEN T3.country = 'Japan' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T1.displacement / T1.cylinders > 30 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What are the cost prices of large burnished copper? | cost price refers to ps_supplycost; large burnished copper refers to p_type = 'LARGE BURNISHED COPPER' | SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'LARGE BURNISHED COPPER' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the price of the car ID 15? | null | SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.ID = 15 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Lists all parts supplied by Supplier#000000034. | part refers to p_name; Supplier#000000034 refers to s_name = 'Supplier#000000034' | SELECT T3.p_name FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T2.s_name = 'Supplier#000000034' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | To which segment belongs the customer that made the most orders in April 1994? | segment refers to c_mktsegment; customer made the most orders in April 1994 refers to c_custkey where o_orderdate LIKE '1994-04-%' and MAX(COUNT(o_orderkey)); | SELECT T.c_mktsegment FROM ( SELECT T2.c_mktsegment, COUNT(T1.o_orderkey) AS num FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate LIKE '1994-04-%' GROUP BY T1.o_custkey ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Provide the ID of cars from Japan worth greater than 35000 and have an acceleration of 14. | from Japan refers to country = 'Japan'; worth greater than 35000 refers to price > 35000; have an acceleration of 14 refers to acceleration = 14 | SELECT T4.ID FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T3.country = 'Japan' AND T1.price > 3500 AND T4.acceleration = 14 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many European suppliers are there? | European suppliers refer to s_suppkey where r_name = 'EUROPE'; | SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Calculate the average price of cars from Europe. | from Europe refers to country = 'Europe'; average price = avg(price) where country = 'Europe' | SELECT AVG(T1.price) FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T3.country = 'Europe' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many items shipped by REG AIR were ordered on March 22, 1995? | items shipped by REG AIR refer to l_linenumber where l_shipmode = 'REG AIR'; ordered on March 22, 1995 refers to o_orderdate = '1995-03-22'; | SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'REG AIR' AND T1.o_orderdate = '1995-03-22' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | How many suppliers from Egypt have a debit balance? | suppliers refer to s_suppkey; Egypt is the name of the nation which refers to n_name = 'EGYPT'; the balance is in debt if s_acctbal < 0; | SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'EGYPT' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars produced in year 1973, how many of the cars have horsepower less than 100? | produced in year 1973 refers to model_year = 1973; have horsepower less than 100 refers to horsepower < 100 | SELECT COUNT(*) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T2.model_year = 1973 AND T1.horsepower < 100 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Of the orders with a lower delivery priority, how many have an urgent priority order? | an urgent priority order refers to o_orderkey where o_orderpriority = '1-URGENT'; earlier orderdate have higher priority in delivery; lower delivery priority refers to MAX(o_orderdate); | SELECT COUNT(o_orderkey) FROM orders WHERE o_orderpriority = '1-URGENT' GROUP BY o_orderdate ORDER BY o_orderdate DESC LIMIT 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | What is the total price charged for orders shipped by air without shipping instructions? | SUM(MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax))) where l_shipmode = 'AIR' and l_shipinstruct = 'NONE'; | SELECT l_extendedprice * (1 - l_discount) * (1 + l_tax) AS totalprice FROM lineitem WHERE l_shipmode = 'AIR' AND l_shipinstruct = 'NONE' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | How many orders of more than 10 items have been returned? | more than 10 items have been returned refer to l_returnflag = 'R' where l_quantity > 10; orders refer to l_orderkey; | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the horsepower and model year of the car named Subaru Dl? | the car named Subaru Dl refers to car_name = 'subaru dl' | SELECT T1.horsepower, T2.model_year FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'subaru dl' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | List by order number the 3 items with the lowest price after applying the discount. | order number refers to l_orderkey; the lowest price after applying the discount refers to MIN(MULTIPLY(l_extendedprice), SUBTRACT(1, l_discount)); | SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | List by their id all customers who have a debit balance in their accounts. | customers who have a debt balance refer to c_custkey where c_acctbal < 0; | SELECT c_custkey FROM customer WHERE c_acctbal < 0 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | How much US dollars does a Ford Torino cost? | cost refers to price; Ford Torino refers to car_name = 'ford torino' | SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'ford torino' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Calculate the difference in the average number of low-priority orders shipped by truck in each month of 1995 and 1996. | SUBTRACT(DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1995), 12), DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1996), 12)) where o_orderpriority = '5-LOW'; | SELECT (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1995, 1, 0)) AS REAL) / 12) - (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1996, 1, 0)) AS REAL) / 12) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderpriority = '5-LOW' AND T2.l_shipmode = 'TRUCK' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Among the suppliers in the European region, what percentage have a below-average account balance? | DIVIDE(COUNT(s_acctbal < AVG(s_acctbal)), COUNT(s_suppkey)) as percentage where r_name = 'EUROPE'; | SELECT CAST(SUM(IIF(T3.s_acctbal < ( SELECT AVG(supplier.s_acctbal) FROM supplier ), 1, 0)) AS REAL) * 100 / COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What are the names of the cars worth 20000? | name of the car refers to car_name; worth 20000 refers to price = 20000 | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T2.price = 20000 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | In the parts shipped by rail, how many are of medium priority? | parts shipped by rail refer to l_partkey where l_shipmode = 'RAIL'; medium priority refers to o_orderpriority = '3-MEDIUM'; | SELECT COUNT(T2.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'RAIL' AND T1.o_orderpriority = '3-MEDIUM' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Give the model year of the heaviest car. | the heaviest refers to max(weight) | SELECT T2.model_year FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID ORDER BY T1.weight DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the average discount for the parts made by Manufacturer#5? | DIVIDE(SUM(l_discount), COUNT(l_partkey)) where p_mfgr = 'Manufacturer#5'; | SELECT AVG(T3.l_discount) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineitem AS T3 ON T2.ps_suppkey = T3.l_suppkey WHERE T1.p_mfgr = 'Manufacturer#5' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Provide the price and country origin of the car named Ford Maverick. | country origin refers to country; Ford Maverick refers to car_name = 'ford maverick' | SELECT DISTINCT T1.price, T3.country FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T4.car_name = 'ford maverick' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Calculate the difference in the average retail price of parts shipped via ship and air. | SUBTRACT(DIVIDE(SUM(p_retailprice where l_shipmode = 'SHIP'), COUNT(l_shipmode = 'SHIP')), DIVIDE(SUM(p_retailprice where l_shipmode = 'AIR'), COUNT(l_shipmode = 'AIR'))); | SELECT (CAST(SUM(IIF(T3.l_shipmode = 'SHIP', T1.p_retailprice, 0)) AS REAL) / SUM(IIF(T3.l_shipmode = 'SHIP', 1, 0))) - (CAST(SUM(IIF(T3.l_shipmode = 'AIR', T1.p_retailprice, 0)) AS REAL) / SUM(IIF(T3.l_shipmode = 'AIR', 1, 0))) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineit... | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | List the name of the top ten items with the most quantity available in the descending order of availability. | items with the most quantity available refer to p_name where MAX(ps_availqty); | SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey ORDER BY T2.ps_availqty DESC LIMIT 10 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars originated from Japan, what is the name of the car with the highest price? | from Japan refers to country = 'Japan'; name of the car refers to car_name; the highest price refers to max(price) | SELECT T4.car_name FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country INNER JOIN data AS T4 ON T4.ID = T1.ID WHERE T3.country = 'Japan' ORDER BY T1.price DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What percentage of customers from the African region is in the household segment? | DIVIDE(COUNT(c_custkey where c_mktsegment = 'HOUSEHOLD' and r_name = 'AFRICA'), COUNT(c_custkey where r_name = 'AFRICA')) as percentage; | SELECT CAST(SUM(IIF(T2.r_name = 'AFRICA', 1, 0)) AS REAL) * 100 / COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN customer AS T3 ON T1.n_nationkey = T3.c_nationkey WHERE T3.c_mktsegment = 'HOUSEHOLD' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars from Asia, list the IDs of cars that were introduced in 1979. | from Asia refers to country = 'Japan'; introduced in 1979 refers to model_year = 1979 | SELECT T1.ID FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin WHERE T2.country = 'Japan' AND T1.model_year = 1979 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | List the names of the countries with the below-average number of customers in ascending order of customer numbers. | the names of countries with the below-average number of customers refer to n_name where COUNT(c_name) < DIVIDE(COUNT(c_name)), COUNT(n_name); | SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name HAVING COUNT(T1.c_name) > ( SELECT COUNT(customer.c_name) / COUNT(DISTINCT nation.n_name) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey ) ORDER BY COUNT(T1.c_name) | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Name the part which is most profitable. | profit can be calculated as SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))); part which is most profitable refers to p_name where MAX(profit); | SELECT T.p_name FROM ( SELECT T3.p_name , T2.l_extendedprice * (1 - T2.l_discount) - T1.ps_supplycost * T2.l_quantity AS num FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | How many cars worth greater than 40000 were from the USA? | worth greater than 40000 refers to price > 40000; from the USA refers to country = 'USA' | SELECT COUNT(*) FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T3.country = 'USA' AND T1.price > 40000 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What percentage of customers from France is in the automobile segment? | DIVIDE(COUNT(c_name where c_mktsegment = 'AUTOMOBILE' and n_name = 'FRANCE'), COUNT(c_name where n_name = 'FRANCE')) as percentage; | SELECT CAST(SUM(IIF(T1.c_mktsegment = 'AUTOMOBILE', 1, 0)) AS REAL) * 100 / COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'FRANCE' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Calculate the difference between the number of cars that has a horsepower of 130 with the model year 1970 and model year 1976 | a horsepower of 130 refers to horsepower = 130; difference = subtract(count(ID where model_year = 1970), count(ID where model_year = 1976)) where horsepower = 130 | SELECT SUM(CASE WHEN T2.model_year = 1970 THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.model_year = 1976 THEN 1 ELSE 0 END) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.horsepower = 130 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | In the parts supply by Supplier#000000654, list the top five parts with the most supply cost in descending order of supply cost. | Supplier#000000654 is the name of the supplier which refers to s_name; parts with the most supply cost refer to ps_partkey where MAX(ps_supplycost); | SELECT T2.ps_partkey FROM supplier AS T1 INNER JOIN partsupp AS T2 ON T1.s_suppkey = T2.ps_suppkey WHERE T1.s_name = 'Supplier#000000654' ORDER BY T2.ps_supplycost DESC LIMIT 5 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | List the name and phone number of customers in India who have an above-average account balance. | name of customer refers to c_name; phone number of customer refers to c_phone; customers in India who have an above-average account balance refer to n_name = 'INDIA' and c_acctbal > AVG(c_acctbal); | SELECT T1.c_name, T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal > ( SELECT AVG(c_acctbal) FROM customer ) ORDER BY T1.c_name | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Provide the name, model, sweep volume, and introduced year of the car with the best crash protection. | car's name refers to car_name; sweep volume = divide(displacement, cylinders); introduced year refers to model_year; the best crash protection refers to max(weight) | SELECT T1.car_name, T1.model, T1.displacement / T1.cylinders, T2.model_year FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID ORDER BY T1.weight DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | How many customers who are not in debt ordered an urgent order? | customers who are not in debt refer to c_custkey where c_acctbal > 0; the order is urgent if o_orderpriority = '1-URGENT' ; | SELECT COUNT(T2.c_custkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal > 0 AND T1.o_orderpriority = '1-URGENT' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | List the car's name with a price worth greater than 85% of the average price of all cars. | car's name refers to car_name; a price worth greater than 85% of the average price of all cars refers to price > multiply(avg(price), 0.85) | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T2.price * 100 > ( SELECT AVG(price) * 85 FROM price ) | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Find the supply key of the top ten suppliers with the most account balance, and list the supply key along with the account balance in descending order of account balance. | supply key refers to s_suppkey; the most amount account balance refers to MAX(s_acctbal); | SELECT s_suppkey, s_acctbal FROM supplier ORDER BY s_acctbal DESC LIMIT 10 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Which country produced the car with the lowest mileage per gallon? | the lowest mileage per gallon refers to min(mpg) | SELECT T3.country FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country ORDER BY T1.mpg ASC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Calculate the percentage of part supply that costs more than 500. | DIVIDE(COUNT(ps_suppkey where ps_supplycost > 500)), COUNT(ps_suppkey) as percentage; | SELECT CAST(SUM(IIF(ps_supplycost > 500, 1, 0)) AS REAL) * 100 / COUNT(ps_suppkey) FROM partsupp | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Provide the name and model of the car with the highest price. | car's name refers to car_name; the highest price refers to max(price) | SELECT T1.car_name, T1.model FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T2.price DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Find and list the part key of the parts which has an above-average retail price. | part key of the parts which has an above-average retail price refer to p_partkey where p_retailprice > AVG(p_retailprice); | SELECT p_partkey FROM part WHERE p_retailprice > ( SELECT AVG(p_retailprice) FROM part ) | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Please list the names of all the car models whose origin country is the USA. | name of car model refers to car_name; origin country is the USA refers to country = 'USA' | SELECT DISTINCT T1.car_name FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T2.country = T3.origin WHERE T3.country = 'USA' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | List the order key of the orders with a total price between 200000 and 300000. | orders with a total price between 200000 and 300000 refer to o_totalprice between 200000 and 300000; | SELECT o_orderkey FROM orders WHERE o_totalprice BETWEEN 200000 AND 300000 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | What is the average number of items shipped each day in April of 1994? | AVG(l_linenumber) where l_shipdate between '1994-01-01' and '1994-01-30'; | SELECT AVG(l_linenumber) FROM lineitem WHERE l_shipdate BETWEEN '1994-01-01' AND '1994-01-30' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the average price per car produced in Japan? | produced in Japan refers to country = 'Japan'; average price per car = avg(price) where country = 'Japan' | SELECT AVG(T1.price) FROM price AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T3.country = 'Japan' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Give the name and phone number of the customers who have more than 9000 account balance. | the name of the customer refers to c_name; phone number of the customer refers to c_phone; have more than 9000 account balance refers to c_acctbal > 9000; | SELECT c_name, c_phone FROM customer WHERE c_acctbal > 9000 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars introduced in 1977, provide the names and the horse powers of cars from Europe. | introduced in 1977 refers to model_year = 1977; car's name refers to car_name; from Europe refers to country = 'Europe' | SELECT T1.car_name, T1.horsepower FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T2.model_year = 1977 AND T3.country = 'Europe' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Among the customers with an account balance lower than 4000, what is the percentage of the customers in the US? | DIVIDE(COUNT(c_custkey where n_name = 'United States' and c_acctbal < 4000), COUNT(c_custkey where c_acctbal < 4000)) as percentage; | SELECT CAST(SUM(IIF(T2.n_name = 'United States', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal < 4000 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | List the country name of the customers in the building marketing segment with an account balance greater than 80% of the average account balance of all customers. | country name refers to n_name; building marketing segment refers to c_mktsegment = 'BUILDING'; account balance greater than 80% of the average account balance of all customers refers to c_acctbal > MULTIPLY(AVG(c_acctbal), 0.8); | SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN ( SELECT AVG(c_acctbal) * 0.8 AS avg_acctbal FROM customer ) AS T3 WHERE T1.c_acctbal > T3.avg_acctbal | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | What is the price of a Chevrolet Bel Air? | Chevrolet Bel Air refers to car_name = 'chevrolet bel air' | SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'chevrolet bel air' | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Among all the customers in Brazil, how many of them have an account balance of less than 1000? | customers refer to c_custkey; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; account balance of less than 1000 refers to c_acctbal < 1000; | SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL' AND T1.c_acctbal < 1000 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars produced in 1975, provide IDs, names, and producing countries of the cars with the maximum number of cylinders. | produced in 1975 refers to model_year = 1975; names refers to car_name; producing countries refers to country; the maximum number of cylinders refers to max(cylinders) | SELECT T1.ID, T1.car_name, T3.country FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T2.model_year = 1975 ORDER BY T1.cylinders DESC LIMIT 1 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Provide the nation and region of the customer with the address of wH55UnX7 VI? | nation refers to n_name; region refers to r_name; address of wH55UnX7 VI refers to c_address = 'wH55UnX7 VI'; | SELECT T1.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_address = 'wH55UnX7 VI' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | Among the cars over 3000lbs, how many of them cost less than $30000? | over 3000lbs refers to weight > 3000; cost less than $30000 refers to price < 30000 | SELECT COUNT(T1.car_name) FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.weight > 3000 AND T2.price < 30000 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | What is the name and marketing segment of the customer with the total order price of 199180.63? | name of the customer refers to c_name; total order price of 199180.63 refers o_totalprice = 199180.63; marketing segment refers to c_mktsegment; | SELECT T2.c_name, T2.c_mktsegment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_totalprice = 199180.63 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
retails | Among the products that have a retail price greater than 1,000, how many products were shipped via ship? | products refer to l_partkey; retail price greater than 1,000 refers to p_retailprice > 1000; shipped via ship refers to l_shipmode = 'SHIP'; | SELECT COUNT(T1.ps_suppkey) FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_retailprice > 1000 AND T2.l_shipmode = 'SHIP' | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
cars | List the names and prices of the cars with model 82 and mileage per gallon of greater than 30. | car's name refers to car_name; model 82 refers to model = 82; mileage per gallon of greater than 30 refers to mpg > 30 | SELECT T2.car_name, T1.price FROM price AS T1 INNER JOIN data AS T2 ON T1.ID = T2.ID WHERE T2.model = 82 AND T2.mpg > 30 | CREATE TABLE data
(
foreign key (ID) references price(ID),
acceleration REAL, --
model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0
horsepower INTEGER, --
weight INTEGER, --
displacement REAL, --
ID INTEGER primary key,
c... |
retails | Provide the phone number of the customer with the highest total price in an order. | phone number of the customer refers to c_phone; the highest total price refers to MAX(o_totalprice); | SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1 | CREATE TABLE partsupp
(
ps_supplycost REAL not null, --
foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade,
ps_comment TEXT null, --
ps_availqty INTEGER null, --
ps_suppkey INTEGER not null, --
ps_partkey INTEGER not null, --
primary key (ps_partkey, ps_suppkey... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.