1sf/bird-sql-train-with-schema huggingface dataset:
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Which two products has the highest and lowest expected profits? Determine the total price for each product in terms of the largest quantity that was ordered.
Evidence: expected profits = SUBTRACT(msrp, buyPrice); total price = MULTIPLY(quantityOrdered, priceEach)
SQL: SELECT T2.productName, SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice DESC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode UNION SELECT T2.productName, SUM(quantityOrdered * priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice ASC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many different orders with a total price greater than 4000 are cancelled?
Evidence: total price = MULTIPLY(quantityOrdered, priceEach) > 4000; cancelled orders refer to status = 'Cancelled';
SQL: SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered * T1.priceEach > 4000 AND T2.status = 'Cancelled'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many distinct orders were there in 2003 when the quantity ordered was less than 30?
Evidence: year(orderDate) = '2003'; quantityOrdered < 30;
SQL: SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered < 30 AND STRFTIME('%Y', T2.orderDate) = '2003'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: What is the total value of cancelled orders?
Evidence: total value = SUM(MULTIPLY(quantityOrdered, priceEach)); cancelled orders refers to status = 'Cancelled';
SQL: SELECT SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T2.status = 'Cancelled'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please calculate the total value of Motorcycles orders.
Evidence: Motorcycle is a product line; total value = SUM(MULTIPLY(quantityOrdered, priceEach));
SQL: SELECT SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productLine = 'Motorcycles'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many Planes orders were there?
Evidence: Planes is a product line;
SQL: SELECT COUNT(T1.productCode) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productLine = 'Planes'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many orders which expected profits greater than 100?
Evidence: expected profits greater than 100 = (SUBTRACT(msrp, buyPrice))>100;
SQL: SELECT COUNT(T1.productCode) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.MSRP - T2.buyPrice > 100
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please calculate the average total price of orders from Exoto Designs Vendor in 2005.
Evidence: average total price = DIVIDE(SUM(MULTIPLY(quantityOrdered, priceEach))), COUNT(orderNumber)); year(orderDate) = '2005';
SQL: SELECT SUM(T2.quantityOrdered * T2.priceEach) / COUNT(T3.orderNumber) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber WHERE T1.productVendor = 'Exoto Designs' AND STRFTIME('%Y', T3.orderDate) = '2005'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many sales representatives who have office code is 1?
Evidence: sales representative refers to jobTitle = 'Sales Rep';
SQL: SELECT COUNT(officeCode) FROM employees WHERE jobTitle = 'Sales Rep' AND officeCode = 1
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please list different customer names with the payment amount of over 50,000.
Evidence: amount > 50000;
SQL: SELECT DISTINCT T2.customerName FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.amount > 50000
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please calculate the total payment amount of customers who come from the USA.
Evidence: USA is a country; total amount payment refers to SUM(amount);
SQL: SELECT SUM(T1.amount) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.country = 'USA'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: What are the total payments of customers with no credit limit in 2003?
Evidence: total payment refers to SUM(amount); no credit limit refers to creditLimit = 0; year(paymentDate) = '2003';
SQL: SELECT SUM(amount) FROM payments WHERE STRFTIME('%Y', paymentDate) = '2003' AND customerNumber IN ( SELECT customerNumber FROM customers WHERE creditLimit = 0 )
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please list the name and phone number of the customer whose order was cancelled.
Evidence: cancelled order refers to status = 'Cancelled';
SQL: SELECT T2.customerName, T2.phone FROM orders AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.status = 'Cancelled'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many French customers shipped 2 orders which have been cancelled?
Evidence: French is a nationality of country = 'France'; cancelled orders refers to status = 'Cancelled';
SQL: SELECT COUNT(T2.country) FROM orders AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.status = 'Shipped' AND T2.country = 'France' GROUP BY T2.customerNumber HAVING COUNT(T1.status) = 2
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: Please calculate the average total price of shipped orders from German customers.
Evidence: average total price = DIVIDE(MULTIPLY(quantityOrdered, priceEach)), COUNT(orderNumber)); German is a nationality of country = 'Germany'; shipped orders refers to status = 'Shipped';
SQL: SELECT SUM(T3.quantityOrdered * T3.priceEach) / COUNT(T2.orderNumber) FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN orderdetails AS T3 ON T2.orderNumber = T3.orderNumber WHERE T2.status = 'Shipped' AND T1.country = 'Germany'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: List out full name of employees who are working in Tokyo?
Evidence: Tokyo is a city; full name = firstName+lastName;
SQL: SELECT T1.firstName, T1.lastName FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Tokyo'
Database: car_retails
Tables: offices, employees, customers, orders, payments, productlines, products, orderdetails
Columns (table index, column name): -1, *, 0, officeCode, 0, city, 0, phone, 0, addressLine1, 0, addressLine2, 0, state, 0, country, 0, postalCode, 0, territory, 1, employeeNumber, 1, lastName, 1, firstName, 1, extension, 1, email, 1, officeCode, 1, reportsTo, 1, jobTitle, 2, customerNumber, 2, customerName, 2, contactLastName, 2, contactFirstName, 2, phone, 2, addressLine1, 2, addressLine2, 2, city, 2, state, 2, postalCode, 2, country, 2, salesRepEmployeeNumber, 2, creditLimit, 3, orderNumber, 3, orderDate, 3, requiredDate, 3, shippedDate, 3, status, 3, comments, 3, customerNumber, 4, customerNumber, 4, checkNumber, 4, paymentDate, 4, amount, 5, productLine, 5, textDescription, 5, htmlDescription, 5, image, 6, productCode, 6, productName, 6, productLine, 6, productScale, 6, productVendor, 6, productDescription, 6, quantityInStock, 6, buyPrice, 6, MSRP, 7, orderNumber, 7, productCode, 7, quantityOrdered, 7, priceEach, 7, orderLineNumber
Question: How many Sales Rep who are working in Tokyo? List out email and full name of those employees.
Evidence: Sales Rep is a job title; Tokyo is a city; full name = firstName+lastName;
SQL: SELECT T1.firstName, T1.lastName, T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Tokyo' AND T1.jobTitle = 'Sales Rep'