input
stringlengths 193
2.69k
| output
stringlengths 24
744
|
|---|---|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: How many employees in the UK takes charge of the sales in over 4 territories? [/INST]
|
SELECT COUNT(COUNTEID) FROM ( SELECT T1.EmployeeID AS COUNTEID FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.Country = 'UK' GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4 ) T1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Please list the home phone numbers of the employees who are in charge of the sales in the territories in the Eastern Region. [/INST]
|
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 INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T4.RegionDescription = 'Eastern ' GROUP BY T1.HomePhone;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the name of the supplier company for Aniseed Syrup? [/INST]
|
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Aniseed Syrup';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Please list the names of all the products whose supplier is in Japan. [/INST]
|
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Please list the phone numbers of the suppliers of the products that have a higher units on order than units in stock. [/INST]
|
SELECT DISTINCT T2.Phone FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitsInStock < T1.UnitsOnOrder;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Among the products that are no longer in continuous production, how many of them have their supplier in the USA? [/INST]
|
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Who is the supplier of the product with the highest unit price? [/INST]
|
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MAX(UnitPrice) FROM Products );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average salary of the employees who takes charge of the sales of over 4 territories? [/INST]
|
SELECT AVG(T1.Salary) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Give the full name of the youngest employee. [/INST]
|
SELECT FirstName, LastName FROM Employees WHERE BirthDate = ( SELECT MAX(BirthDate) FROM Employees );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Who is the newest hired employee? Give the full name. [/INST]
|
SELECT FirstName, LastName FROM Employees WHERE HireDate = ( SELECT MAX(HireDate) FROM Employees );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Provide the number of orders that were handled by Michael Suyama. [/INST]
|
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Give the name of the territory where Mr. Robert King works. [/INST]
|
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.TitleOfCourtesy = 'Mr.' AND T1.FirstName = 'Robert' AND T1.LastName = 'King';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Which territory does Ms. Laura Callahan's direct supervisor work in? Give the name of the territory. [/INST]
|
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.EmployeeID = ( SELECT ReportsTo FROM Employees WHERE TitleOfCourtesy = 'Ms.' AND FirstName = 'Laura' AND LastName = 'Callahan' );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Who is in charge of the "Santa Monica" territory? Give the full name. [/INST]
|
SELECT 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 WHERE T3.TerritoryDescription = 'Santa Monica';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Give the home phone number of the employee who is in charge of "Savannah" territory. [/INST]
|
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 = 'Savannah';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Tell the name of the shipper company for the order No.10585. [/INST]
|
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10585;
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Give the number of orders that were shipped by "Federal Shipping". [/INST]
|
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How many kinds of products are there in the the category of "dairy products"? [/INST]
|
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Dairy Products';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which category does "tofu" belong to? [/INST]
|
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Tofu';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the total production of the products from the supplier “Escargots Nouveaux”? [/INST]
|
SELECT SUM(T1.UnitsInStock + T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Escargots Nouveaux';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Give the reorder level for the products from the supplier "Nord-Ost-Fisch Handelsgesellschaft mbH". [/INST]
|
SELECT T1.ReorderLevel FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Nord-Ost-Fisch Handelsgesellschaft mbH';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How many kinds of products are supplied by "Karkki Oy" company? [/INST]
|
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Karkki Oy';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Give the contact name of the supplier for the product "Gudbrandsdalsost". [/INST]
|
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gudbrandsdalsost';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Tell the country name of the supplier for "Scottish Longbreads". [/INST]
|
SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Scottish Longbreads';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: For the orders of Customer "WHITC", what is the percentage of the orders were fulfilled with shipper company "United Package"? [/INST]
|
SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.CustomerID = 'WHITC';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: How many percent more orders were fulfilled with shipper company "United Package" than with "Speedy Express"? [/INST]
|
SELECT CAST((COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END)) AS REAL) * 100 / COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID;
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: How many customers are there in the country with the highest number of customers? [/INST]
|
SELECT COUNT(CustomerID) FROM Customers GROUP BY Country ORDER BY COUNT(CustomerID) DESC LIMIT 1;
|
[INST] Here is a database schema:
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What are the order ids of the orders with freight of over 800? [/INST]
|
SELECT OrderID FROM Orders WHERE Freight > 800;
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: What is the Island Trading customer's complete address? [/INST]
|
SELECT Address, City, Region, Country, PostalCode FROM Customers WHERE CompanyName = 'Island Trading';
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the most expensive product? [/INST]
|
SELECT ProductName FROM Products WHERE UnitPrice = ( SELECT MAX(UnitPrice) FROM Products );
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Please write me a SQL statement that answers the following question: How many suppliers are there in the United States of America? [/INST]
|
SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'USA';
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which product have the highest user satisfaction? [/INST]
|
SELECT ProductName FROM Products WHERE ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full name of the employee with the highest salary? [/INST]
|
SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees );
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What are the names of the products that were discountinued? [/INST]
|
SELECT ProductName FROM Products WHERE Discontinued = 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average salary of sales representatives in the United Kingdom? [/INST]
|
SELECT AVG(Salary) FROM Employees WHERE Title = 'Sales Representative' AND Country = 'UK';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What is the most widely used shipping company in the United States of America? [/INST]
|
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.ShipCountry = 'USA' GROUP BY T2.CompanyName ORDER BY COUNT(T2.CompanyName) DESC LIMIT 1;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How many products were supplied by Pavlova, Ltd.? [/INST]
|
SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Pavlova, Ltd.';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: How many orders were shipped to GREAL via United Package? [/INST]
|
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.CustomerID = 'GREAL' AND T2.CompanyName = 'United Package';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What are the names of the suppliers whose products have the highest user satisfaction? [/INST]
|
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 );
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: In total, how many orders were shipped via United Package? [/INST]
|
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How many suppliers in Australia whose products were discontinued? [/INST]
|
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.Discontinued = 1 AND T2.Country = 'Australia';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the name of the supplier that supplies the most products to the company? [/INST]
|
SELECT T1.SupplierID FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID GROUP BY T1.SupplierID ORDER BY COUNT(*) DESC LIMIT 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the title of the employee with the highest number of territories in charge? [/INST]
|
SELECT T1.Title FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.Title ORDER BY COUNT(T2.TerritoryID) DESC LIMIT 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Which territories is the employee with a doctorate in charge of? List all of the territory descriptions. [/INST]
|
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.TitleOfCourtesy = 'Dr.';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average number of territories do each sales representative is in charge of? [/INST]
|
SELECT CAST(COUNT(T2.TerritoryID) AS REAL) / COUNT(DISTINCT T1.EmployeeID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.Title = 'Sales Representative';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Among the beverages, which product has the highest customer satisfaction? [/INST]
|
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Beverages' ORDER BY T1.ReorderLevel DESC LIMIT 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What is the full name of the employee who handled the highest amount of orders? [/INST]
|
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.FirstName, T1.LastName ORDER BY COUNT(*) DESC LIMIT 1;
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Among the seafood products, which product have the highest total production of the production? [/INST]
|
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Seafood' ORDER BY T1.UnitsInStock + T1.UnitsOnOrder DESC LIMIT 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the difference in salary of the top 2 employees with the highest number of territories in charge? [/INST]
|
SELECT MAX(Salary) - MIN(Salary) FROM ( SELECT T1.Salary FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID, T1.Salary ORDER BY COUNT(T2.TerritoryID) DESC LIMIT 2 ) T1;
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the average price of products with more than fifty units in stock? [/INST]
|
SELECT SUM(UnitPrice) / COUNT(UnitPrice) FROM Products WHERE UnitsInStock > 50;
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: Find and list the company name, company contact name, and contact title of customers from Madrid. [/INST]
|
SELECT CompanyName, ContactName, ContactTitle FROM Customers WHERE City = 'Madrid';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Give the full name and contact number of employees in descending order of age. [/INST]
|
SELECT FirstName, LastName, HomePhone FROM Employees ORDER BY BirthDate DESC;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: List the name, address, and phone number of companies that supply products for more than thirty dollars per unit. [/INST]
|
SELECT T2.CompanyName, T2.Address, T2.Phone FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice > 30;
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Among the customers, list customers' company names and addresses who paid more than average in freight. [/INST]
|
SELECT DISTINCT T1.CompanyName, T1.Address FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Freight > ( SELECT AVG(Freight) FROM Orders );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Find and list the full name of employees who are from the territory, Wilton. [/INST]
|
SELECT 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 WHERE T3.TerritoryDescription = 'Wilton';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: List the names of non-US suppliers that have discontinued. [/INST]
|
SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.Discontinued = 1 AND T2.Country != 'USA';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Of the customers who are from Canada, how many used Federal Shipping? [/INST]
|
SELECT COUNT(T3.CustomerID) FROM Shippers AS T1 INNER JOIN Orders AS T2 ON T1.ShipperID = T2.ShipVia INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T2.ShipName = 'Federal Shipping';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which supplier supplies the most amount of products? [/INST]
|
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID GROUP BY T2.SupplierID, T2.CompanyName ORDER BY COUNT(T1.ProductName) DESC LIMIT 1;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Please list the full name and region of each employee in alphabetical order. [/INST]
|
SELECT DISTINCT T1.FirstName, T1.LastName, T4.RegionDescription 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 ORDER BY T1.FirstName;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Which employee handled the most amount of orders in 1996? Give the full name, title, and address of this employee. [/INST]
|
SELECT FirstName, LastName, Title, address FROM Employees WHERE EmployeeID = ( SELECT T1.EmployeeID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderDate BETWEEN '1996-01-01 00:00:00' AND '1997-01-01 00:00:00' GROUP BY T1.EmployeeID ORDER BY COUNT(T2.OrderID) DESC LIMIT 1 );
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Calculate the percentage of shipping done through Speedy Express. [/INST]
|
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;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: Indicate the courtesy title of the 3 employees who have the lowest salary. [/INST]
|
SELECT TitleOfCourtesy FROM Employees ORDER BY Salary LIMIT 3;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the last name of the employees who must report to the Vice President of Sales? [/INST]
|
SELECT LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Vice President, Sales' );
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which 3 products are produced in greater quantity? [/INST]
|
SELECT ProductName FROM Products ORDER BY UnitsInStock + UnitsOnOrder DESC LIMIT 3;
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Of the 10 products with the highest unit price, identify by their ID the ones that have generated the least satisfaction. [/INST]
|
SELECT ProductID FROM Products ORDER BY ReorderLevel ASC, UnitPrice DESC LIMIT 1;
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How many non-discontinued products are there in the dairy category? [/INST]
|
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;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What territories is the Inside Sales Coordinator in charge of? [/INST]
|
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';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Indicate the name of the companies that have freighted products for a value greater than 2,000,000. [/INST]
|
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Freight > 2000000;
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Through which companies have products been shipped the most times to the city of Aachen? [/INST]
|
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;
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: List the full name of all employees who work in the Northern region. [/INST]
|
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';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the name of the contact person of the Pavlova supplier company? [/INST]
|
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Pavlova';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full name of the employee in charge of the Southern region who is to report to Andrew Fuller? [/INST]
|
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 EmployeeID FROM Employees WHERE FirstName = 'Andrew' AND LastName = 'Fuller' );
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the phone number for the employee in charge of the Portsmouth territory? [/INST]
|
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';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Of all the shipments made by United Package throughout the year 1996, what percentage correspond to the month of September? [/INST]
|
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%';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: How many owners are located in Mexico? [/INST]
|
SELECT COUNT(ContactTitle) FROM Customers WHERE Country = 'Mexico' AND ContactTitle = 'Owner';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full address of Andr Fonseca? [/INST]
|
SELECT Address, City, Region, PostalCode, Country FROM Customers WHERE ContactName = 'Andr Fonseca';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: What are the companies that have the same phone area code as 171? [/INST]
|
SELECT CompanyName FROM Customers WHERE Phone LIKE '(171)%';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Please write me a SQL statement that answers the following question: What is the difference in the number of employees from the UK and the USA who work as sales representatives? [/INST]
|
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;
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: How many sales associates are located in Sao Paulo, Brazil? [/INST]
|
SELECT COUNT(CustomerID) FROM Customers WHERE City = 'Sao Paulo' AND Country = 'Brazil' AND ContactTitle = 'Sales Associate';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What is the family name of the employee who shipped the order 10521 to CACTU? [/INST]
|
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';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What is the shipping cost for order number 10692 from the company Alfreds Futterkiste? [/INST]
|
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';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: What is the shipping company for order number 10558? [/INST]
|
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10558;
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: Please list any three order numbers that have been shipped using Speedy Express. [/INST]
|
SELECT T1.OrderID FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' LIMIT 3;
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What are the products that belong to the beverage category? [/INST]
|
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the description of the category that tofu belongs to? [/INST]
|
SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which company supplies Gula Malacca? [/INST]
|
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gula Malacca';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What are the products that are supplied by Aux joyeux ecclsiastiques? [/INST]
|
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Aux joyeux ecclsiastiques';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: How much per unit of Konbu does Mayumi's charge? [/INST]
|
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';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Who is the person to contact to get Camembert Pierrot? [/INST]
|
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Please name any three products that have been discontinued in the meat or poultry category. [/INST]
|
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;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Please name any two products that have the highest satisfaction levels among users of Heli Swaren GmbH & Co. KG. [/INST]
|
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;
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Please write me a SQL statement that answers the following question: Who is the one representing the company "Heli Swaren GmbH & Co. KG"? [/INST]
|
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Heli Swaren GmbH & Co. KG';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Please write me a SQL statement that answers the following question: From which country is the company "Drachenblut Delikatessen" from? [/INST]
|
SELECT Country FROM Customers WHERE CompanyName = 'Drachenblut Delikatessen';
|
[INST] Here is a database schema:
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: Which product is the most expensive? [/INST]
|
SELECT ProductName FROM Products WHERE UnitPrice = ( SELECT MAX(UnitPrice) FROM Products );
|
[INST] Here is a database schema:
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: How many of the orders are shipped to France? [/INST]
|
SELECT COUNT(ShipCountry) FROM Orders WHERE ShipCountry = 'France';
|
[INST] Here is a database schema:
Suppliers :
SupplierID [ INTEGER ] primary_key
SupplierName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Phone [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What is the homepage link for the company that supplies the product "Thringer Rostbratwurst"? [/INST]
|
SELECT T2.HomePage FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Thringer Rostbratwurst';
|
[INST] Here is a database schema:
Employees :
EmployeeID [ INTEGER ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
BirthDate [ DATE ]
Photo [ TEXT ]
Notes [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: List the first names of the employees who take the orders that ship to the city of "Reims". [/INST]
|
SELECT DISTINCT T1.FirstName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCity = 'Reims';
|
[INST] Here is a database schema:
Shippers :
ShipperID [ INTEGER ] primary_key
ShipperName [ TEXT ]
Phone [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: How many orders were shipped by "Speedy Express"? [/INST]
|
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express';
|
[INST] Here is a database schema:
Categories :
CategoryID [ INTEGER ] primary_key
CategoryName [ TEXT ]
Description [ TEXT ]
Products :
ProductID [ INTEGER ] primary_key
ProductName [ TEXT ]
SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID
CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID
Unit [ TEXT ]
Price [ REAL ]
Please write me a SQL statement that answers the following question: What are the prices on cheese products? [/INST]
|
SELECT T2.UnitPrice FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Description = 'Cheeses';
|
[INST] Here is a database schema:
Customers :
CustomerID [ INTEGER ] primary_key
CustomerName [ TEXT ]
ContactName [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
PostalCode [ TEXT ]
Country [ TEXT ]
Orders :
OrderID [ INTEGER ] primary_key
CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID
EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID
OrderDate [ DATETIME ]
ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID
Please write me a SQL statement that answers the following question: How many orders did "Laughing Bacchus Wine Cellars" make? [/INST]
|
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';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.