db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
retail_world
select cast(count(case when t2.companyname = 'speedy express' then 1 else null end) as real) * 100 / count(t1.shipvia) from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid
Question: calculate the percentage of shipping done through speedy express. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID,...
calculate the percentage of shipping done through speedy express.
retail_world
select titleofcourtesy from employees order by salary limit 3
Question: indicate the courtesy title of the 3 employees who have the lowest salary. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> S...
indicate the courtesy title of the 3 employees who have the lowest salary.
retail_world
select lastname from employees where reportsto = ( select employeeid from employees where title = 'vice president, sales' )
Question: what is the last name of the employees who must report to the vice president of sales? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. S...
what is the last name of the employees who must report to the vice president of sales?
retail_world
select unitprice * quantity * (1 - discount) as thetop from `order details` order by unitprice * quantity * (1 - discount) desc limit 1
Question: what is the highest total price paid for an order? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, P...
what is the highest total price paid for an order?
retail_world
select productname from products order by unitsinstock + unitsonorder desc limit 3
Question: which 3 products are produced in greater quantity? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, P...
which 3 products are produced in greater quantity?
retail_world
select productid from products order by reorderlevel asc, unitprice desc limit 1
Question: of the 10 products with the highest unit price, identify by their id the ones that have generated the least satisfaction. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, Fi...
of the 10 products with the highest unit price, identify by their id the ones that have generated the least satisfaction.
retail_world
select count(t1.categoryid) from categories as t1 inner join products as t2 on t1.categoryid = t2.categoryid where t1.categoryname = 'dairy products' and t2.discontinued = 0
Question: how many non-discontinued products are there in the dairy category? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperI...
how many non-discontinued products are there in the dairy category?
retail_world
select t3.territorydescription from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid where t1.title = 'inside sales coordinator'
Question: what territories is the inside sales coordinator in charge of? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Sh...
what territories is the inside sales coordinator in charge of?
retail_world
select t1.companyname from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid where t2.freight > 2000000
Question: indicate the name of the companies that have freighted products for a value greater than 2,000,000. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Ph...
indicate the name of the companies that have freighted products for a value greater than 2,000,000.
retail_world
select t2.companyname from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t1.shipcity = 'aachen' group by t2.companyname order by count(t1.shipvia) desc limit 1
Question: through which companies have products been shipped the most times to the city of aachen? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes....
through which companies have products been shipped the most times to the city of aachen?
retail_world
select distinct t1.firstname, t1.lastname from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid inner join region as t4 on t3.regionid = t4.regionid where t4.regiondescription = 'northern'
Question: list the full name of all employees who work in the northern region. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shipper...
list the full name of all employees who work in the northern region.
retail_world
select t2.contactname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.productname = 'pavlova'
Question: what is the name of the contact person of the pavlova supplier company? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Ship...
what is the name of the contact person of the pavlova supplier company?
retail_world
select t3.productname from orders as t1 inner join `order details` as t2 on t1.orderid = t2.orderid inner join products as t3 on t2.productid = t3.productid where t1.shipcity = 'paris'
Question: indicate the name of the products that have been shipped to the city of paris. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers ...
indicate the name of the products that have been shipped to the city of paris.
retail_world
select t4.productname from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid inner join `order details` as t3 on t2.orderid = t3.orderid inner join products as t4 on t3.productid = t4.productid where t1.postalcode = 28023 order by t3.quantity limit 1
Question: what product is the least shipped to the postal code 28023? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipp...
what product is the least shipped to the postal code 28023?
retail_world
select distinct t1.firstname, t1.lastname from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid inner join region as t4 on t3.regionid = t4.regionid where t4.regiondescription = 'southern' and t1.reportsto = ( select em...
Question: what is the full name of the employee in charge of the southern region who is to report to andrew fuller? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDa...
what is the full name of the employee in charge of the southern region who is to report to andrew fuller?
retail_world
select t2.orderdate from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid inner join `order details` as t3 on t2.orderid = t3.orderid inner join products as t4 on t3.productid = t4.productid where t4.productname = 'filo mix' and t3.quantity = 9 and t1.companyname = 'du monde entier'
Question: on what date did the du monde entier company request that 9 units of filo mix be sent to it? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, No...
on what date did the du monde entier company request that 9 units of filo mix be sent to it?
retail_world
select t3.categoryname from products as t1 inner join `order details` as t2 on t1.productid = t2.productid inner join categories as t3 on t1.categoryid = t3.categoryid where t2.orderid = 10933
Question: indicate the name of the categories to which the products of order number 10933 belong. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. ...
indicate the name of the categories to which the products of order number 10933 belong.
retail_world
select t1.homephone from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid where t3.territorydescription = 'portsmouth'
Question: what is the phone number for the employee in charge of the portsmouth territory? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shipper...
what is the phone number for the employee in charge of the portsmouth territory?
retail_world
select cast(sum(t2.quantity) as real) / count(t2.orderid) from orders as t1 inner join `order details` as t2 on t1.orderid = t2.orderid inner join shippers as t3 on t1.shipvia = t3.shipperid where t1.shippeddate like '1996-11%' and t3.companyname = 'federal shipping'
Question: what is the average quantity of product that have been shipped by federal shipping in november 1996? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, P...
what is the average quantity of product that have been shipped by federal shipping in november 1996?
retail_world
select cast(count(case when t1.shippeddate like '1996-09%' then 1 else null end) as real) * 100 / count(t1.shipvia) from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t2.companyname = 'united package' and t1.shippeddate like '1996%'
Question: of all the shipments made by united package throughout the year 1996, what percentage correspond to the month of september? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, ...
of all the shipments made by united package throughout the year 1996, what percentage correspond to the month of september?
retail_world
select count(contacttitle) from customers where country = 'mexico' and contacttitle = 'owner'
Question: how many owners are located in mexico? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Suppli...
how many owners are located in mexico?
retail_world
select address, city, region, postalcode, country from customers where contactname = 'andr fonseca'
Question: what is the full address of andr fonseca? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Sup...
what is the full address of andr fonseca?
retail_world
select companyname from customers where phone like '(171)%'
Question: what are the companies that have the same phone area code as 171? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID,...
what are the companies that have the same phone area code as 171?
retail_world
select ( select count(title) from employees where country = 'uk' and title = 'sales representative' ) - ( select count(title) from employees where country = 'usa' and title = 'sales representative' ) as difference
Question: what is the difference in the number of employees from the uk and the usa who work as sales representatives? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, Birt...
what is the difference in the number of employees from the uk and the usa who work as sales representatives?
retail_world
select count(customerid) from customers where city = 'sao paulo' and country = 'brazil' and contacttitle = 'sales associate'
Question: how many sales associates are located in sao paulo, brazil? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipp...
how many sales associates are located in sao paulo, brazil?
retail_world
select t1.lastname from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t2.orderid = 10521 and t2.customerid = 'cactu'
Question: what is the family name of the employee who shipped the order 10521 to cactu? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -...
what is the family name of the employee who shipped the order 10521 to cactu?
retail_world
select t2.freight from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid where t2.orderid = 10692 and t1.companyname = 'alfreds futterkiste'
Question: what is the shipping cost for order number 10692 from the company alfreds futterkiste? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. S...
what is the shipping cost for order number 10692 from the company alfreds futterkiste?
retail_world
select t2.companyname from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t1.orderid = 10558
Question: what is the shipping company for order number 10558? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName,...
what is the shipping company for order number 10558?
retail_world
select t1.orderid from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t2.companyname = 'speedy express' limit 3
Question: please list any three order numbers that have been shipped using speedy express. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shipper...
please list any three order numbers that have been shipped using speedy express.
retail_world
select t2.productname from categories as t1 inner join products as t2 on t1.categoryid = t2.categoryid where t1.categoryname = 'beverages'
Question: what are the products that belong to the beverage category? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipp...
what are the products that belong to the beverage category?
retail_world
select t1.description from categories as t1 inner join products as t2 on t1.categoryid = t2.categoryid where t2.productname = 'tofu'
Question: what is the description of the category that tofu belongs to? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shi...
what is the description of the category that tofu belongs to?
retail_world
select t2.companyname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.productname = 'gula malacca'
Question: which company supplies gula malacca? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Supplier...
which company supplies gula malacca?
retail_world
select t1.productname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'aux joyeux ecclsiastiques'
Question: what are the products that are supplied by aux joyeux ecclsiastiques? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shippe...
what are the products that are supplied by aux joyeux ecclsiastiques?
retail_world
select t1.unitprice from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname like 'mayumi%' and t1.productname = 'konbu'
Question: how much per unit of konbu does mayumi's charge? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Pho...
how much per unit of konbu does mayumi's charge?
retail_world
select t2.contactname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.productname = 'camembert pierrot'
Question: who is the person to contact to get camembert pierrot? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperNam...
who is the person to contact to get camembert pierrot?
retail_world
select t2.productname from categories as t1 inner join products as t2 on t1.categoryid = t2.categoryid where t2.discontinued = 1 and t1.categoryname = 'meat/poultry' limit 3
Question: please name any three products that have been discontinued in the meat or poultry category. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Not...
please name any three products that have been discontinued in the meat or poultry category.
retail_world
select t1.productname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'heli swaren gmbh & co. kg' order by t1.reorderlevel desc limit 2
Question: please name any two products that have the highest satisfaction levels among users of heli swaren gmbh & co. kg. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, ...
please name any two products that have the highest satisfaction levels among users of heli swaren gmbh & co. kg.
retail_world
select contactname from suppliers where companyname = 'heli swaren gmbh & co. kg'
Question: who is the one representing the company 'heli swaren gmbh & co. kg'? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shipper...
who is the one representing the company 'heli swaren gmbh & co. kg'?
retail_world
select country from customers where companyname = 'drachenblut delikatessen'
Question: from which country is the company 'drachenblut delikatessen' from? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID...
from which country is the company 'drachenblut delikatessen' from?
retail_world
select count(territoryid) from territories
Question: how many territories are there? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Suppliers -> ...
how many territories are there?
retail_world
select sum(unitprice) from `order details` group by orderid order by sum(unitprice) desc limit 1
Question: what is the largest total price for an order? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone....
what is the largest total price for an order?
retail_world
select productname from products where unitprice = ( select max(unitprice) from products )
Question: which product is the most expensive? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Supplier...
which product is the most expensive?
retail_world
select count(shipcountry) from orders where shipcountry = 'france'
Question: how many of the orders are shipped to france? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone....
how many of the orders are shipped to france?
retail_world
select t2.regiondescription from territories as t1 inner join region as t2 on t1.regionid = t2.regionid where t1.territorydescription = 'hoffman estates'
Question: which region does hoffman estates belong to? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. ...
which region does hoffman estates belong to?
retail_world
select t2.homepage from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.productname = 'thringer rostbratwurst'
Question: what is the homepage link for the company that supplies the product 'thringer rostbratwurst'? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, N...
what is the homepage link for the company that supplies the product 'thringer rostbratwurst'?
retail_world
select distinct t1.firstname from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t2.shipcity = 'reims'
Question: list the first names of the employees who take the orders that ship to the city of 'reims'. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Not...
list the first names of the employees who take the orders that ship to the city of 'reims'.
retail_world
select t2.quantity from products as t1 inner join `order details` as t2 on t2.productid = t1.productid where t1.productname = 'manjimup dried apples' order by t2.quantity desc limit 1
Question: what is the largest quantity of 'manjimup dried apples' for an order? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shippe...
what is the largest quantity of 'manjimup dried apples' for an order?
retail_world
select count(t1.orderid) from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t2.companyname = 'speedy express'
Question: how many orders were shipped by 'speedy express'? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Ph...
how many orders were shipped by 'speedy express'?
retail_world
select distinct t1.territorydescription from territories as t1 inner join region as t2 on t1.regionid = t2.regionid where t2.regiondescription = 'southern'
Question: make a list of all the territories in the southern region. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shippe...
make a list of all the territories in the southern region.
retail_world
select t2.unitprice from categories as t1 inner join products as t2 on t1.categoryid = t2.categoryid where t1.description = 'cheeses'
Question: what are the prices on cheese products? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. Suppl...
what are the prices on cheese products?
retail_world
select count(t2.orderid) from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid where t1.companyname = 'laughing bacchus wine cellars'
Question: how many orders did 'laughing bacchus wine cellars' make? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipper...
how many orders did 'laughing bacchus wine cellars' make?
retail_world
select t3.productname from orders as t1 inner join `order details` as t2 on t1.orderid = t2.orderid inner join products as t3 on t2.productid = t3.productid where t1.shipaddress = 'starenweg 5' group by t3.productname
Question: list all the products that were shipped to starenweg 5. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperNa...
list all the products that were shipped to starenweg 5.
retail_world
select t1.productname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'bigfoot breweries'
Question: what are the products by the company 'bigfoot breweries'? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipper...
what are the products by the company 'bigfoot breweries'?
retail_world
select t3.territorydescription from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid where t1.lastname = 'king' and t1.firstname = 'robert'
Question: what are the names of robert king's territories? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Pho...
what are the names of robert king's territories?
retail_world
select t1.contactname from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid where t2.shipcountry = 'switzerland' group by t1.contactname
Question: provide the name of the contact person who made the orders that shipped to switzerland. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. ...
provide the name of the contact person who made the orders that shipped to switzerland.
retail_world
select cast(count(case when t1.title = 'sales representative' then 1 else null end) as real) * 100 / count(t2.orderid) from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid
Question: what proportion of orders are taken by the sales representative? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ...
what proportion of orders are taken by the sales representative?
retail_world
select count(country) from employees where titleofcourtesy = 'dr.' and country = 'usa'
Question: among the usa employess, how many of them has phd title of courtesy? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shipper...
among the usa employess, how many of them has phd title of courtesy?
retail_world
select avg(salary) from employees where employeeid between 1 and 9
Question: what is the average salary for employees from id 1 to 9? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperN...
what is the average salary for employees from id 1 to 9?
retail_world
select sum(salary) from employees where country = 'uk'
Question: calculate the total salary for employees from uk. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Ph...
calculate the total salary for employees from uk.
retail_world
select case when homephone = '(206) 555-1189' then 'yes' else 'no' end from employees where firstname = 'laura' and lastname = 'callahan'
Question: is (206) 555-1189 the home phone number for laura callahan? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipp...
is (206) 555-1189 the home phone number for laura callahan?
retail_world
select notes from employees where salary = ( select max(salary) from employees )
Question: write down the notes of employee with the highest salary. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipper...
write down the notes of employee with the highest salary.
retail_world
select t2.customerid from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t1.firstname = 'michael' and t1.lastname = 'suyama'
Question: list down the customer ids who placed order with michael suyama. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ...
list down the customer ids who placed order with michael suyama.
retail_world
select distinct t2.shipcountry from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t1.firstname = 'janet' and t1.lastname = 'leverling'
Question: where are the ship countries of orders placed by janet leverling? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID,...
where are the ship countries of orders placed by janet leverling?
retail_world
select count(t2.employeeid) from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t1.firstname = 'margaret' and t1.lastname = 'peacock'
Question: how many orders have margaret peacock placed? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone....
how many orders have margaret peacock placed?
retail_world
select cast(sum(t1.salary) as real) / count(t2.employeeid) from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t1.firstname = 'andrew' and t1.lastname = 'fuller'
Question: calculate the average salary per order for andrew fuller. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipper...
calculate the average salary per order for andrew fuller.
retail_world
select t1.productname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'exotic liquids'
Question: what are the product names of exotic liquids? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone....
what are the product names of exotic liquids?
retail_world
select t1.quantityperunit from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'tokyo traders'
Question: list down the quantity per unit for products of tokyo traders. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Sh...
list down the quantity per unit for products of tokyo traders.
retail_world
select count(t1.discontinued) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'new orleans cajun delights'
Question: how many products have been discountinued by new orleans cajun delights? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shi...
how many products have been discountinued by new orleans cajun delights?
retail_world
select sum(t1.unitprice) / count(t1.supplierid) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'formaggi fortini s.r.l.'
Question: please calculate the average unit price for products of formaggi fortini s.r.l. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers...
please calculate the average unit price for products of formaggi fortini s.r.l.
retail_world
select count(t1.supplierid) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.country = 'japan'
Question: calculate the total products that are supplied by japan suppliers. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID...
calculate the total products that are supplied by japan suppliers.
retail_world
select t2.contactname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.productname = 'teatime chocolate biscuits'
Question: what is the contact name for product teatime chocolate biscuits? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ...
what is the contact name for product teatime chocolate biscuits?
retail_world
select distinct t2.companyname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.reorderlevel = ( select max(reorderlevel) from products )
Question: list down the company names that have the highest reorder level. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ...
list down the company names that have the highest reorder level.
retail_world
select t2.contacttitle from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.quantityperunit = '10 boxes x 12 pieces'
Question: what is the contact title for the person who supplied a product that is 10 boxes x 12 pieces. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, N...
what is the contact title for the person who supplied a product that is 10 boxes x 12 pieces.
retail_world
select sum(t1.unitsonorder) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'exotic liquids'
Question: what is the total units on order from exotic liquids? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName...
what is the total units on order from exotic liquids?
retail_world
select cast(count(case when t2.companyname = 'gai pturage' then 1 else null end) as real) * 100 / count(t1.supplierid) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid
Question: calculate the percentage of products supplied by gai pturage over all products. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers...
calculate the percentage of products supplied by gai pturage over all products.
retail_world
select productid from products order by unitsinstock desc limit 5
Question: list the product id of the top five products, by descending order, the number of quantities in stock. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, ...
list the product id of the top five products, by descending order, the number of quantities in stock.
retail_world
select count(*) from products where discontinued = 1
Question: among the products, how many of them were discontinued in production? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shippe...
among the products, how many of them were discontinued in production?
retail_world
select address, homephone, salary from employees where title = 'sales manager'
Question: give me the address, home phone and salary of the sales manager. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ...
give me the address, home phone and salary of the sales manager.
retail_world
select firstname, lastname from employees where title = 'vice president, sales'
Question: what is the full name of the vice president of sales. give me the url of his/her photo. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. ...
what is the full name of the vice president of sales. give me the url of his/her photo.
retail_world
select companyname from `sales totals by amount` order by saleamount desc limit 10
Question: write down the top ten companies with the most total sales by amount. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shippe...
write down the top ten companies with the most total sales by amount.
retail_world
select avg(productsales) from `sales by category` group by categoryname
Question: what is the average sales for each categories? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone...
what is the average sales for each categories?
retail_world
select sum(t2.quantity) from products as t1 inner join `order details` as t2 on t1.productid = t2.productid where t1.productname like 'uncle bob%s organic dried pears'
Question: compute the total order quantity for uncle bob's organic dried pears so far. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers ->...
compute the total order quantity for uncle bob's organic dried pears so far.
retail_world
select count(t1.productid) from products as t1 inner join `order details` as t2 on t1.productid = t2.productid inner join categories as t3 on t1.categoryid = t3.categoryid where t3.categoryname = 'seafood' and t2.quantity > 50
Question: among the seafoods, how many of them have an order quantity of more than 50? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers ->...
among the seafoods, how many of them have an order quantity of more than 50?
retail_world
select t1.productname, t1.productid, t1.reorderlevel from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'pavlova, ltd.'
Question: list the products whose supplier is pavlova, ltd. please include the product id and re-order level. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Ph...
list the products whose supplier is pavlova, ltd. please include the product id and re-order level.
retail_world
select distinct t2.companyname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.discontinued = 1
Question: who are the suppliers of the discontinued products? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, ...
who are the suppliers of the discontinued products?
retail_world
select t1.firstname, t1.lastname from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid where t2.employeeid < 4
Question: among the employees, give me the full names of those who have less than 4 territories. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. S...
among the employees, give me the full names of those who have less than 4 territories.
retail_world
select count(distinct t1.firstname) from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid inner join territories as t3 on t2.territoryid = t3.territoryid inner join region as t4 on t3.regionid = t4.regionid where t4.regiondescription = 'eastern'
Question: how many employees have territories in the eastern region? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shippe...
how many employees have territories in the eastern region?
retail_world
select count(t1.orderid) from orders as t1 inner join shippers as t2 on t1.shipvia = t2.shipperid where t2.companyname = 'federal shipping' and t1.shippeddate between '1997-03-01 00:00:00' and '1997-10-08 23:59:59'
Question: from 1/3/97 to 8/10/97, how many orders were shipped via federal shipping? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> S...
from 1/3/97 to 8/10/97, how many orders were shipped via federal shipping?
retail_world
select distinct t2.customerid from employees as t1 inner join orders as t2 on t1.employeeid = t2.employeeid where t1.lastname = 'peacock' and t1.firstname = 'margaret' and t2.shipcountry = 'brazil' and t2.shippeddate between '1997-03-31 00:00:00' and '1997-12-10 23:59:59'
Question: tally the customer id of orders that were shipped to brazil by margaret peacock from 3/31/97 to 12/10/97. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDa...
tally the customer id of orders that were shipped to brazil by margaret peacock from 3/31/97 to 12/10/97.
retail_world
select t1.reorderlevel from products as t1 inner join `order details` as t2 on t1.productid = t2.productid where t2.quantity = 1
Question: what is the re-order level of products that have an order quantity of 1? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> Shi...
what is the re-order level of products that have an order quantity of 1?
retail_world
select t1.unitprice * t1.unitsinstock from products as t1 inner join categories as t2 on t1.categoryid = t2.categoryid
Question: what is the stock value of every condiments? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Phone. ...
what is the stock value of every condiments?
retail_world
select count(t2.territoryid) from employees as t1 inner join employeeterritories as t2 on t1.employeeid = t2.employeeid where t1.firstname = 'anne' and t1.lastname = 'dodsworth'
Question: how many territories are owned by anne dodsworth? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Ph...
how many territories are owned by anne dodsworth?
retail_world
select t1.companyname, timestampdiff(day, t2.shippeddate, t2.requireddate) from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid where t1.country = 'usa' and timestampdiff(day, t2.shippeddate, t2.requireddate) < 0
Question: which of the american customers have experienced a delay in the shipment and how long was the longest? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate,...
which of the american customers have experienced a delay in the shipment and how long was the longest?
retail_world
select t1.contactname, t1.phone from customers as t1 inner join orders as t2 on t1.customerid = t2.customerid inner join `order details` as t3 on t2.orderid = t3.orderid group by t2.orderid, t1.contactname, t1.phone order by sum(t3.unitprice * t3.quantity * (1 - t3.discount)) desc limit 1
Question: what is the contact name and phone number of the customer who has made the most total payment on the order to date? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstNam...
what is the contact name and phone number of the customer who has made the most total payment on the order to date?
retail_world
select t4.lastname, t4.firstname, t4.reportsto , t1.quantity * t1.unitprice * (1 - t1.discount) as payment from `order details` as t1 inner join orders as t2 on t1.orderid = t2.orderid inner join customers as t3 on t2.customerid = t3.customerid inner join employees as t4 on t2.employeeid = t4.employeeid order by paymen...
Question: who is the sales representative of the customer who has made the highest payment? include the full name of employee and his/her supervisor. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> Employ...
who is the sales representative of the customer who has made the highest payment? include the full name of employee and his/her supervisor.
retail_world
select count(city) from customers where country = 'germany' and city = 'berlin'
Question: how many customers are there in berlin, germany? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName, Pho...
how many customers are there in berlin, germany?
retail_world
select count(t1.productname) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'exotic liquids'
Question: how many products does the company exotic liquids supply? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shipper...
how many products does the company exotic liquids supply?
retail_world
select t2.companyname, t1.productname from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t1.unitprice = ( select min(unitprice) from products )
Question: which company has the lowest unit price? please give the company name and the product name. | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Not...
which company has the lowest unit price? please give the company name and the product name.
retail_world
select sum(t1.unitprice) / count(t2.supplierid) from products as t1 inner join suppliers as t2 on t1.supplierid = t2.supplierid where t2.companyname = 'tokyo traders'
Question: what is the average unit price of tokyo traders' products? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, Shippe...
what is the average unit price of tokyo traders' products?
retail_world
select count(t1.regionid) from territories as t1 inner join region as t2 on t1.regionid = t2.regionid where t2.regiondescription = 'eastern'
Question: how many territories are there in the eastern region? | Tables: Categories -> CategoryID, CategoryName, Description. Customers -> CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. Employees -> EmployeeID, LastName, FirstName, BirthDate, Photo, Notes. Shippers -> ShipperID, ShipperName...
how many territories are there in the eastern region?