Chinastark/bird_dataset huggingface dataset:
Database: car_retails
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
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
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'
Database: car_retails
Question: State the email of those who are staff of Murphy Diane whose number is 1002 and living in San Francisco
Evidence: staff of refers to reportsTO; San Francisco is a city;
SQL: SELECT T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.reportsTo = 1002 AND T2.city = 'San Francisco'
Database: car_retails
Question: Determine the email and Code of employee who are working at United State, state MA
Evidence: code of employee refers to employeeNumber; United States of America refers to country = 'USA';
SQL: SELECT T1.email, T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.state = 'MA' AND T2.country = 'USA'
Database: car_retails
Question: How many Sales Manager who are working in Sydney? List out their email.
Evidence: Sales Manager is a job title; Sydney is a city;
SQL: SELECT T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.jobTitle LIKE '%Sales Manager%' AND T2.city = 'Sydney'
Database: car_retails
Question: How many employees who are living in Australia and have the credit limit under 200000? State their email address and countries where they are working.
Evidence: Australia is a country; creditLimit < 20000;
SQL: SELECT T2.email, T3.country FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber INNER JOIN offices AS T3 ON T2.officeCode = T3.officeCode WHERE T3.country = 'Australia' AND T1.creditLimit < 200000 AND T2.jobTitle = 'Sales Rep'
Database: car_retails
Question: State 10 emails of UK Sales Rep who have the lowest credit limit.
Evidence: UK is a country; Sales Rep is a job title;
SQL: SELECT DISTINCT T2.email FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' AND T1.country = 'UK' ORDER BY T1.creditLimit LIMIT 10
Database: car_retails
Question: How many Australian customers who have credit line under 220000?
Evidence: Australian is a nationality of country = 'Australia'; credit line refers to creditLimit; creditLimit < 220000;
SQL: SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Australia'
Database: car_retails
Question: List out 3 customer numbers who have highest amount payment
Evidence: amount of payment refers to amount;
SQL: SELECT customerNumber FROM payments ORDER BY amount DESC LIMIT 3
Database: car_retails
Question: Determine the email and Code of employee who are working at United State, state CA
Evidence: United States of America refers to country = 'USA'; code of employee refers to employeeNumber;
SQL: SELECT T1.email, T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.country = 'USA' AND T2.state = 'CA' GROUP BY T1.email, T1.officeCode
Database: car_retails
Question: List out full name of employees who are working in Boston?
Evidence: full name = contactFirstName, contactLastName; Boston is a city;
SQL: SELECT T1.firstName, T1.lastName FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Boston'
Database: car_retails
Question: State top 3 emails of UK Sales Rep who have the highest credit limit.
Evidence: UK is a country; Sales Rep is a job title;
SQL: SELECT T2.email FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' AND T1.country = 'UK' GROUP BY T1.customerName, T2.email ORDER BY SUM(T1.creditLimit) DESC LIMIT 3
Database: car_retails
Question: How many customers who are in Norway and have credit line under 220000?
Evidence: Norway is a country; credit line refers to creditLimit; creditLimit<220000;
SQL: SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Norway'
Database: car_retails
Question: List out full name and email of employees who are working in Paris?
Evidence: full name = firstName+LastName; Paris is a city;
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 = 'Paris'
Database: car_retails
Question: List the product code of the top five motorcycles, by descending order, the number of quantity in stock.
Evidence: motorcycle is a product line;
SQL: SELECT productCode, quantityInStock FROM products WHERE productLine = 'Motorcycles' ORDER BY quantityInStock DESC LIMIT 5
Database: car_retails
Question: Among the German customers, how many of the them has credit limit of zero?
Evidence: German is a nationality of country = 'Germany'; CREDITLIMIT = 0
SQL: SELECT COUNT(customerNumber) FROM customers WHERE creditLimit = 0 AND country = 'Germany'
Database: car_retails
Question: From 2003 to 2004, how many customers have paid more than three times?
Evidence: paymentdate BETWEEN '2003-01-01' AND '2004-12-31'; customers who have paid more than three times refers to (COUNT(customernumber)>3);
SQL: SELECT COUNT(customernumber) FROM ( SELECT customernumber FROM payments WHERE STRFTIME('%Y', paymentDate) >= '2003' AND STRFTIME('%Y', paymentDate) <= '2004' GROUP BY customernumber HAVING COUNT(customernumber) > 3 ) T
Database: car_retails
Question: What is the average actual profit by 1937 Lincoln Berline?
Evidence: average actual profit = AVG(SUBTRACT(priceEach, buyPrice)); 1937 Lincoln Berline is a product name;
SQL: SELECT SUM(T1.priceEach - T2.buyPrice) / COUNT(*) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productName = '1937 Lincoln Berline'
Database: car_retails
Question: Among the motorcycles with product scale of 1:10, which of them is the most ordered by American customers?
Evidence: motorcycle is a product line; American is a nationality of country = 'USA';
SQL: SELECT T1.productName FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T1.productLine = 'Motorcycles' AND T1.productScale = '1:10' AND T4.country = 'USA' GROUP BY T1.productName ORDER BY SUM(T2.quantityOrdered) DESC LIMIT 1
Database: car_retails
Question: Between 8/1/2003 and 8/30/2004, how many checks were issued by Mini Gifts Distributors Ltd.? Please list their check numbers.
Evidence: paymentDate BETWEEN '2003-08-01' AND '2004-08-30'; Mini Gifts Distributors Ltd. Is a customer name;
SQL: SELECT T1.checkNumber FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate >= '2003-08-01' AND T1.paymentDate <= '2004-08-30' AND T2.customerName = 'Mini Gifts Distributors Ltd.'
Database: car_retails
Question: For the planes which has the hightest total price, how much it exceeds the average?
Evidence: plane is a product line; total price = MULTIPLY(quantityOrdered, priceEach); how much the total price exceeds the average = SUBTRACT(MAX(MULTIPLY(quantityOrdered, priceEach))), AVG(priceEach));
SQL: SELECT MAX(quantityOrdered * priceEach) - AVG(priceEach) FROM orderdetails WHERE productCode IN ( SELECT productCode FROM products WHERE productLine = 'Planes' )
Database: car_retails
Question: What is the total value of shipped vintage car orders from 2003-2004?
Evidence: total value = SUM(MULTIPLY(quantityOrdered, priceEach)); shipped orders refers to status = 'Shipped'; vintage car is a product line; year(orderDate) between 2003 and 2004;
SQL: SELECT SUM(T2.priceEach * T2.quantityOrdered) 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 T3.status = 'Shipped' AND T3.orderDate BETWEEN '2003-01-01' AND '2004-12-31'
Database: car_retails
Question: Who is the sales agent of the customer who has made the highest payment? Include the full names of employee and his/her supervisor.
Evidence: payment refers to amount; full name = firstName+lastName; supervisor refers to reportsTO; 'reportsTO' is the leader of the 'employeeNumber';
SQL: SELECT T1.firstName, T1.lastName, T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber ORDER BY T3.amount DESC LIMIT 1
Database: car_retails
Question: What is the highest amount of order made by the sales representative in Boston? Please give the name of the product and amount.
Evidence: Boston is a city; amount of order = MULTIPLY(quantityOrdered, priceEach);
SQL: SELECT T2.productName, T1.quantityOrdered * T1.priceEach FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T1.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T4.city = 'Boston' AND T4.salesRepEmployeeNumber IN ( SELECT employeeNumber FROM employees WHERE jobTitle = 'Sales Rep' ) ORDER BY T1.quantityOrdered DESC LIMIT 1
Database: car_retails
Question: What is the total actual profit gained from orders made by American customers from 2003-01-06 to 2005-05-09?
Evidence: total actual profit = SUM(SUBTRACT(priceEach, buyPrice)); American is a nationality of country = 'USA'; orderDate BETWEEN '2003-01-06' AND '2005-05-09';
SQL: SELECT SUM(T2.priceEach - T1.buyPrice) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T3.orderDate > '2003-01-05' AND T3.orderDate < '2005-05-10'
Database: car_retails
Question: From which branch does the sales representative employee who made the most sales in 2005? Please indicates its full address and phone number.
Evidence: orderDate between '2005-01-01' and '2005-12-31'; full address = addressLine1+addressLine2;
SQL: SELECT T3.addressLine1, T3.addressLine2, T3.phone FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber INNER JOIN customers AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN employees AS T4 ON T3.salesRepEmployeeNumber = T4.employeeNumber INNER JOIN offices AS T5 ON T4.officeCode = T5.officeCode WHERE STRFTIME('%Y', T2.orderDate) = '2005' AND T4.jobTitle = 'Sales Rep' ORDER BY T1.quantityOrdered DESC LIMIT 1
Database: car_retails
Question: What is the phone number of all companies where the last name of the contact person starts with the letter M and are not from Germany?
Evidence: last name of contact person starts with M refers to lastName LIKE 'M%'; Germany is a country; not from Germany refers to country<>'Germany';
SQL: SELECT phone FROM customers WHERE contactLastName LIKE 'M%' AND country != 'Germany'
Database: car_retails
Question: Calculate the average amount of payments made by customers during the first half of 2004.
Evidence: average amount of payments = DIVIDE(SUM(amount), COUNT(customerNumber); first half of 2014 refers to paymentDate > = '2004-01-01' AND paymentDate < '2004-07-01;
SQL: SELECT AVG(amount) FROM payments WHERE paymentDate BETWEEN '2004-01-01' AND '2004-06-30'
Database: car_retails
Question: Of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186?
Evidence: shipped orders refers to status = 'shipped'; year(shippedDate) = 2005; percentage = DIVIDE(SUM(customerNumber = 186)), COUNT(orderNumber)) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN customerNumber = 186 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(orderNumber) FROM orders WHERE status = 'Shipped' AND shippedDate BETWEEN '2005-01-01' AND '2005-12-31'
Database: car_retails
Question: How many customers with a canceled shipment have a credit limit greater than 115,000?
Evidence: cancelled shipment refers to status = 'cancelled'; creditLimit > 115000;
SQL: SELECT COUNT(T1.customerNumber) FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.status = 'Cancelled' AND T1.creditLimit > 115000
Database: car_retails
Question: On what date did the customer with the lowest credit limit serviced by sales representative Barry Jones make payments for his/her orders?
SQL: SELECT T3.paymentDate FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber WHERE T1.firstName = 'Barry' AND T1.lastName = 'Jones' AND T1.jobTitle = 'Sales Rep' ORDER BY T2.creditLimit ASC LIMIT 1
Database: car_retails
Question: To whom does the employee have to inform that is the sales representative of the French customer?
Evidence: inform refers to reportsTo; 'reportsTO' is the leader of the 'employeeNumber'; France is a country; country = 'France';
SQL: SELECT T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber WHERE T2.country = 'France'
Database: car_retails
Question: What is the full address of the customer who commented that DHL be used for the order that was shipped on April 4, 2005?
Evidence: full address = addressLine1+addressLine2; shippedDate = '2005-04-04';
SQL: SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.shippedDate = '2005-04-04' AND T2.status = 'Shipped'
Database: car_retails
Question: What is the full address of the office where the employee who is a sales representative for the customer whose business is located in the city of New York works?
Evidence: full address = addressLine1 + addressLine2; NYC is a shortname of New York City.
SQL: SELECT T2.addressLine1, T2.addressLine2 FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN offices AS T3 ON T1.officeCode = T3.officeCode WHERE T2.city = 'NYC' AND T1.jobTitle = 'Sales Rep'
Database: car_retails
Question: What is the full address of the office where 4 people work and one of them is Sales Representation?
Evidence: full address = addressLine1+addressLine2; Sales Manager is a job title;
SQL: SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep'
Database: car_retails
Question: What profit can the seller Carousel DieCast Legends make from the sale of the product described as "The perfect holiday or anniversary gift for executives"?
Evidence: seller and product vendor are synonyms; Carousel DieCast Legends is a product vendor; profit = SUM(SUBTRACT(msrp, buyPrice));
SQL: SELECT SUM(T2.MSRP - T2.buyPrice) FROM productlines AS T1 INNER JOIN products AS T2 ON T1.productLine = T2.productLine WHERE T2.productVendor = 'Carousel DieCast Legends' AND T1.textDescription LIKE '%perfect holiday or anniversary gift for executives%'
Database: car_retails
Question: Of the clients whose businesses are located in the city of Boston, calculate which of them has a higher average amount of payment.
Evidence: average amount payment = AVG(amount);
SQL: SELECT T1.customerNumber FROM customers AS T1 INNER JOIN payments AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.city = 'Boston' GROUP BY T1.customerNumber ORDER BY SUM(T2.amount) / COUNT(T2.paymentDate) DESC LIMIT 1
Database: car_retails
Question: Calculate the total quantity ordered for 18th Century Vintage Horse Carriage and the average price.
Evidence: 18th Century Vintage Horse Carriage is a product name; average price = AVG(priceEach);
SQL: SELECT SUM(T2.quantityOrdered) , SUM(T2.quantityOrdered * T2.priceEach) / SUM(T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode WHERE T1.productName = '18th Century Vintage Horse Carriage'
Database: car_retails
Question: How many kinds of products did order No. 10252 contain?
Evidence: Products refer to productCode;
SQL: SELECT COUNT(t.productCode) FROM orderdetails t WHERE t.orderNumber = '10252'
Database: car_retails
Question: Who is the sales representative that made the order which was sent to 25 Maiden Lane, Floor No. 4?
Evidence: Sales representative is an employee;
SQL: SELECT T2.firstName, T2.lastName FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T1.addressLine1 = '25 Maiden Lane' AND T1.addressLine2 = 'Floor No. 4'
Database: car_retails
Question: Where's Foon Yue Tseng's office located at? Give the detailed address.
Evidence: Detailed address comprises addressLine1 and addressLine2;
SQL: SELECT T1.addressLine1, T1.addressLine2 FROM offices AS T1 INNER JOIN employees AS T2 ON T1.officeCode = T2.officeCode WHERE T2.firstName = 'Foon Yue' AND T2.lastName = 'Tseng'
Database: car_retails
Question: Compared with the orders happened on 2005-04-08 and two days later, which day's order had a higher value?
Evidence: 2005-04-08 and two days later refer to orderDate = '2005-04-08' and orderDate = '2005-04-10'; order with a higher value refers to MAX(Total price) = MULTIPLY(quantityOrdered, priceEach); 
SQL: SELECT T2.orderDate FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-08' OR STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-10' ORDER BY T1.quantityOrdered * T1.priceEach DESC LIMIT 1
Database: car_retails
Question: How many products with the highest expected profits were sold in total?
Evidence: Products refer to productCode; Expected profits = SUBTRACT(MSRP, buyPrice);
SQL: SELECT SUM(t2.quantityOrdered) FROM orderdetails AS t2 INNER JOIN ( SELECT t1.productCode FROM products AS t1 ORDER BY t1.MSRP - t1.buyPrice DESC LIMIT 1 ) AS t3 ON t2.productCode = t3.productCode
Database: car_retails
Question: How much did Petit Auto pay on 2004-08-09?
Evidence: Petit Auto is name of customer; paymentDate = '2004-08-09';
SQL: SELECT t1.amount FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.customerName = 'Petit Auto' AND t1.paymentDate = '2004-08-09'
Database: car_retails
Question: What was the contact name for the check "NR157385"?
Evidence: Contact name refers to customerName;
SQL: SELECT t2.contactFirstName, t2.contactLastName FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.checkNumber = 'NR157385'
Database: car_retails
Question: Which customer made the order No. 10160? Give the contact name.
SQL: SELECT t2.contactFirstName, t2.contactLastName FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.orderNumber = '10160'
Database: car_retails
Question: Where was the order No. 10383 shipped to? Show me the address.
Evidence: Address comprises addressLine1 and addressLine2;
SQL: SELECT t2.addressLine1, t2.addressLine2 FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.orderNumber = '10383'
Database: car_retails
Question: For the productline where the product No.S18_2949 was produced, what's the text description for that product line?
SQL: SELECT t1.textDescription FROM productlines AS t1 INNER JOIN products AS t2 ON t1.productLine = t2.productLine WHERE t2.productCode = 'S18_2949'
Database: car_retails
Question: If Dragon Souveniers, Ltd. aren't satisfied with their order and want to send a complain e-mail, which e-mail address should they send to?
Evidence: E-mail address belongs to employee; customerName = 'Dragon Souveniers, Ltd.';
SQL: SELECT t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Dragon Souveniers, Ltd.'
Database: car_retails
Question: How many French customers does Gerard Hernandez take care of?
Evidence: Gerakd Hermandez is an employee; French customer refers to customer from France where country = 'France'
SQL: SELECT COUNT(t1.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.country = 'France' AND t2.firstName = 'Gerard' AND t2.lastName = 'Hernandez'
Database: car_retails
Question: What was the latest order that customer No.114 made? Give the name of the product.
Evidence: The latest refers to the most recent orderDate;
SQL: SELECT t3.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN products AS t3 ON t1.productCode = t3.productCode WHERE t2.customerNumber = '114' ORDER BY t2.orderDate DESC LIMIT 1
Database: car_retails
Question: For the product No. S18_3482 in the Order No.10108, how much discount did the customer have?
Evidence: DIVIDE(SUBTRACT(MSRP, priceEach)), MSRP); product No. S18_3482 refers to productCode = 'S18_3482'
SQL: SELECT (t1.MSRP - t2.priceEach) / t1.MSRP FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode WHERE t1.productCode = 'S18_3482' AND t2.orderNumber = '10108'
Database: car_retails
Question: To whom does Steve Patterson report? Please give his or her full name.
Evidence: reportsTO' is the leader of the 'employeeNumber';
SQL: SELECT t2.firstName, t2.lastName FROM employees AS t1 INNER JOIN employees AS t2 ON t2.employeeNumber = t1.reportsTo WHERE t1.firstName = 'Steve' AND t1.lastName = 'Patterson'
Database: car_retails
Question: How do I contact the President of the company?
Evidence: President refers to the jobTitle;
SQL: SELECT t.email FROM employees t WHERE t.jobTitle = 'President'
Database: car_retails
Question: Who is the sales representitive of Muscle Machine Inc? Please give the employee's full name.
Evidence: Sales representative refers to jobTitle = 'Sales Rep'; Muscle Machine Inc is name of customer;
SQL: SELECT t2.firstName, t2.lastName FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc'
Database: car_retails
Question: If I'm from the Muscle Machine Inc, to which e-mail adress should I write a letter if I want to reach the superior of my sales representitive?
Evidence: Muscle Machine Inc is name of customer; superior refers to 'reportsTO', who is the leader of the 'employeeNumber'
SQL: SELECT t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc'
Database: car_retails
Question: Please list all the customers that have Steve Patterson as their sales representitive.
Evidence: Steve Patterson is an employee;
SQL: SELECT t1.customerName FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t2.firstName = 'Steve' AND t2.lastName = 'Patterson'
Database: car_retails
Question: How many customers have an employee who reports to William Patterson as their sales representitive?
Evidence: reportsTO' is the leader of the 'employeeNumber';
SQL: SELECT COUNT(t1.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t2.firstName = 'William' AND t2.lastName = 'Patterson'