input
stringlengths
201
2.7k
output
stringlengths
24
744
[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 companies are there in the city of London? [/INST...
SELECT COUNT(CompanyName) FROM Customers WHERE City = 'London';
[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: Indicate the address of the company Eastern Connection who...
SELECT Address FROM Customers WHERE CompanyName = 'Eastern Connection' AND ContactName = 'Ann Devon';
[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: Indicate which company is located in France? [/INST] [/INS...
SELECT CompanyName FROM Customers WHERE Country = '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 = Su...
SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids';
[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 = Su...
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: 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 = Su...
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.City = 'London' ORDER BY T1.UnitsInStock 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 = Su...
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids' ORDER BY T1.ReorderLevel DESC LIMIT 1;
[INST] Here is a database schema: Categories : CategoryID [ INTEGER ] primary_key CategoryName [ TEXT ] Description [ TEXT ] Suppliers : SupplierID [ INTEGER ] primary_key SupplierName [ TEXT ] ContactName [ TEXT ] Address [ TEXT ] City [ TEXT ] PostalCode [ TEXT ] Country [ TEXT ] Phone [ TEXT ] Products : ProductID [...
SELECT T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T1.CompanyName = 'New Orleans Cajun Delights' AND T2.ProductName LIKE 'Chef Anton%s Gumbo Mix';
[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 = Su...
SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Ipoh Coffee' AND T2.CompanyName = 'Leka Trading';
[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.Categor...
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.UnitsOnOrder = ( SELECT MAX(T1.UnitsOnOrder) 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 ] Products : ProductID [ INTEGER ] primary_key ProductName [ TEXT ] SupplierID [ INTEGER ] Products.SupplierID = Su...
SELECT ( SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights' AND T1.ProductName LIKE 'Chef Anton%s Cajun Seasoning' ) - ( SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierI...
[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 = Su...
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'Cooperativa de Quesos%' AND T1.UnitPrice > 20;
[INST] Here is a database schema: Categories : CategoryID [ INTEGER ] primary_key CategoryName [ TEXT ] Description [ TEXT ] Suppliers : SupplierID [ INTEGER ] primary_key SupplierName [ TEXT ] ContactName [ TEXT ] Address [ TEXT ] City [ TEXT ] PostalCode [ TEXT ] Country [ TEXT ] Phone [ TEXT ] Products : ProductID [...
SELECT T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T2.UnitsInStock > 100 AND T1.CompanyName = 'Exotic Liquids';
[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 position of Robert King? [/INST] [/INST]
SELECT Title FROM Employees WHERE FirstName = 'Robert' AND LastName = 'King';
[INST] Here is a database schema: Shippers : ShipperID [ INTEGER ] primary_key ShipperName [ TEXT ] Phone [ TEXT ] Please write me a SQL statement that answers the following question: Write the shipping company name with the telephone number of (503) 555-9931. [/INST] [/INST]
SELECT CompanyName FROM Shippers WHERE Phone = '(503) 555-9931';
[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: Write the address and phone number of Margaret Peacock. [/INST] [/INST]
SELECT Address, HomePhone FROM Employees WHERE FirstName = 'Margaret' AND LastName = 'Peacock';
[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 t...
SELECT DISTINCT ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry FROM Orders WHERE ShipName = 'Rattlesnake Canyon Grocery';
[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.Categor...
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Confections';
[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 = Su...
SELECT T2.CompanyName, T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName LIKE 'Sir Rodney%s Marmalade';
[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 who is in charge of the territory of Denver? ...
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 = 'Denver';
[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 all the territories where Laura Callahan is in charge. [/INST] [/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.FirstName = 'Laura' AND T1.LastName = 'Callahan';
[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 [ I...
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping' AND T1.ShipVia = 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 = Su...
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Finland';
[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.Categor...
SELECT T2.CategoryName, T2.Description FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Mozzarella di Giovanni';
[INST] Here is a database schema: Categories : CategoryID [ INTEGER ] primary_key CategoryName [ TEXT ] Description [ TEXT ] Suppliers : SupplierID [ INTEGER ] primary_key SupplierName [ TEXT ] ContactName [ TEXT ] Address [ TEXT ] City [ TEXT ] PostalCode [ TEXT ] Country [ TEXT ] Phone [ TEXT ] Products : ProductID [...
SELECT DISTINCT T1.CompanyName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.Description = 'Cheeses';
[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 = Su...
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Zaanse Snoepfabriek';
[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 = Su...
SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Plutzer Lebensmittelgromrkte AG' AND T1.Discontinued = 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 [ I...
SELECT CAST(COUNT(CASE WHEN T1.ShipCountry = 'Sweden' 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 T2.CompanyName = 'Speedy Express';
[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 from UK? [/INST] [/I...
SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'UK';
[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: Please give the contact name for Tokyo Trad...
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Tokyo Traders';
[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 from USA with Sales Representative title? [/INST] [/INST]
SELECT COUNT(Country) FROM Employees WHERE Country = 'USA' AND Title = 'Sales Representative';
[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 are the highest salary earn by the the employee and what is his/her position i...
SELECT Salary, Title FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees );
[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 = Su...
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Plutzer Lebensmittelgromrkte AG' AND T1.UnitsInStock = 0 AND T1.UnitsOnOrder = 0;
[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 = Emplo...
SELECT T1.Title FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.Title ORDER BY COUNT(T2.OrderID) 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: How many employees is a UK citizen and are they all covering the same region? [/INS...
SELECT COUNT(T1.EmployeeID), T3.RegionID 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.Country = 'UK' GROUP BY T3.RegionID;
[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 followin...
SELECT ProductName FROM Products WHERE ProductID = 77;
[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: State the company name of all suppliers in ...
SELECT CompanyName FROM Suppliers WHERE Country = 'USA';
[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 position title for Laura Callahan? [/INST] [/INST]
SELECT Title FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan';
[INST] Here is a database schema: Customers : CustomerID [ INTEGER ] primary_key CustomerName [ TEXT ] ContactName [ TEXT ] Address [ TEXT ] City [ TEXT ] PostalCode [ TEXT ] Country [ TEXT ] Employees : EmployeeID [ INTEGER ] primary_key LastName [ TEXT ] FirstName [ TEXT ] BirthDate [ DATE ] Photo [ TEXT ] Notes [ TE...
SELECT DISTINCT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T3.CompanyName = 'Victuailles en stock';
[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 [ I...
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: 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 was taking charge of orders from Morristown? [/INST] [/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 = 'Morristown';
[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 = Emplo...
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: List down the territory IDs, descriptions and region description which are under th...
SELECT T3.RegionID, T3.TerritoryDescription, 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 WHERE T1.LastName = 'Davolio' AND 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 = Emplo...
SELECT T1.FirstName, T1.LastName, COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.Title = 'Sales Representative' AND STRFTIME('%Y', T1.HireDate) = '1992' GROUP BY T1.EmployeeID, T1.FirstName, T1.LastName;
[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 [ I...
SELECT T1.CompanyName FROM Shippers AS T1 INNER JOIN Orders AS T2 ON T1.ShipperID = T2.ShipVia WHERE STRFTIME('%Y', T2.ShippedDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1;
[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 located in London? [/INST] [/INST]
SELECT COUNT(CustomerID) FROM Customers WHERE City = 'London';
[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 Michael Suyama? [/INST] [/INST]
SELECT Title FROM Employees WHERE FirstName = 'Michael' AND 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: List out the full name of employee who has birth day on "3/4/1955 12:00:00 AM". [/I...
SELECT FirstName, LastName FROM Employees WHERE BirthDate = '1955-03-04 00:00:00';
[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 = Emplo...
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10250;
[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 = Emplo...
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.City = 'Tacoma';
[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 = Emplo...
SELECT T1.Country FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10257;
[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 = Emplo...
SELECT T1.Title FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10257;
[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 ] ...
SELECT T1.Phone FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10264;
[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 ] ...
SELECT T1.Region FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10276;
[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 = Emplo...
SELECT T1.FirstName, T1.LastName, AVG(T1.Salary) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCountry = 'Brazil' GROUP BY T1.FirstName, T1.LastName ORDER BY SUM(T1.Salary) 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 = Emplo...
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T2.ShippedDate) = '1996' THEN T1.Salary ELSE 0 END) AS REAL) * 100 / SUM(T1.Salary) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID;
[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 = Emplo...
SELECT T1.HireDate FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10281;
[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 = Emplo...
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.ReportsTo = 5;
[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 = Emplo...
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10280;
[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 [ I...
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10260;
[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 [ I...
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: 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 [ I...
SELECT T2.Phone FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10260;
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_orderkey = 5 AND l_returnflag = 'R';
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT MAX(l_shipdate) FROM lineitem WHERE l_orderkey = 1;
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT l_orderkey FROM lineitem WHERE l_orderkey IN (4, 36) ORDER BY l_shipdate DESC LIMIT 1;
[INST] Here is a database schema: orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_key o_custkey [ INTEGER ] orders.o_custkey = customer.c_custkey o_orderpriority [ TEXT ] o_shippriority [ INTEGER ] o_clerk [ TEXT ] o_orderstatus [ TEXT ] o_totalprice [ REAL ] o_comment [ TEXT ] Please write me a SQL state...
SELECT o_comment FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders );
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] Please write me a SQL statement that answers the following que...
SELECT c_phone FROM customer WHERE c_name = 'Customer#000000001';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT MAX(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT T1.o_comment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT T1.o_orderkey FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal < 0;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT COUNT(T1.o_orderpriority) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD' AND T1.o_orderpriority = '1-URGENT';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'BRAZIL';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.c_acctbal > 1000;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT COUNT(T2.c_custkey) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT SUM(T3.o_totalprice) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT T3.o_orderkey FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY' ORDER BY T3.o_orderdate LIMIT 1;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT AVG(T3.o_totalprice) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT CAST(SUM(IIF(T2.n_name = 'GERMANY', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] Please write me a SQL statement that answers the following question: How many countries are there in the No.2 region? [/INST] [/INST]
SELECT COUNT(n_nationkey) FROM nation WHERE n_regionkey = 2;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] supplier : s_suppkey [ INTEGER ] primary_key s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey s_comment [ TEXT ] s_name [ TEX...
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 34;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] region : r_regionkey [ INTEGER ] primary_key r_name [ TEXT ] r_comment [ TEXT ] supplier : s_suppkey [ INTEGER ] primary_key s_nationkey [ INT...
SELECT T3.r_name FROM nation AS T1 INNER JOIN supplier AS T2 ON T1.n_nationkey = T2.s_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.s_name = 'Supplier#000000129';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_custkey = 106936;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_...
SELECT COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'MOROCCO' AND T1.c_acctbal < 0;
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT T1.l_extendedprice * (1 - T1.l_discount) AS DISCOUNTERPRICE FROM lineitem AS T1 INNER JOIN orders AS T2 ON T2.o_orderkey = T1.l_orderkey WHERE T1.l_suppkey = 9397 AND T2.o_totalprice = 231499.38;
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT T2.l_suppkey FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_totalprice = 218195.43 AND T2.l_returnflag = 'R';
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax) AS num FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_clerk = 'Clerk#000000936' AND T2.l_shipmode = 'TRUCK' AND T1.o_orderstatus = '4-NOT SPECIFIED' AND T1.o_orderdate = '1995-03-13';
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = '129301' AND T1.o_orderdate = '1996-07-27';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] orders : o_orderdate [ DATE ] o_orderkey [ INTEGER ] primary_ke...
SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate = '1997-12-10' AND T1.o_clerk = 'Clerk#000000803';
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_suppkey = 7414 AND T1.l_orderkey = 817154;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] supplier : s_suppkey [ INTEGER ] primary_key s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey s_comment [ TEXT ] s_name [ TEX...
SELECT T.n_name FROM ( SELECT T2.n_name, SUM(T1.s_acctbal) AS num FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 GROUP BY T2.n_name ) AS T ORDER BY T.num LIMIT 1;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] region : r_regionkey [ INTEGER ] primary_key r_name [ TEXT ] r_comment [ TEXT ] Please write me a SQL statement that answers the following qu...
SELECT CAST(SUM(IIF(T2.r_name = 'EUROPE', 1, 0)) AS REAL) * 100 / COUNT(T1.n_name) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey;
[INST] Here is a database schema: nation : n_nationkey [ INTEGER ] primary_key n_name [ TEXT ] n_regionkey [ INTEGER ] nation.n_regionkey = region.r_regionkey n_comment [ TEXT ] supplier : s_suppkey [ INTEGER ] primary_key s_nationkey [ INTEGER ] supplier.s_nationkey = nation.n_nationkey s_comment [ TEXT ] s_name [ TEX...
SELECT CAST(SUM(IIF(T2.n_name = 'JAPAN', 1, 0)) AS REAL) * 100 / COUNT(T1.s_name) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0;
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] Please write me a SQL statement that answers the following que...
SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer );
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1998';
[INST] Here is a database schema: customer : c_custkey [ INTEGER ] primary_key c_mktsegment [ TEXT ] c_nationkey [ INTEGER ] customer.c_nationkey = nation.n_nationkey c_name [ TEXT ] c_address [ TEXT ] c_phone [ TEXT ] c_acctbal [ REAL ] c_comment [ TEXT ] Please write me a SQL statement that answers the following que...
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0;
[INST] Here is a database schema: lineitem : l_shipdate [ DATE ] l_orderkey [ INTEGER ] lineitem.l_orderkey = orders.o_orderkey l_discount [ REAL ] l_extendedprice [ REAL ] l_suppkey [ INTEGER ] lineitem.l_suppkey = partsupp.ps_suppkey l_quantity [ INTEGER ] l_returnflag [ TEXT ] l_partkey [ INTEGER ] lineitem.l_partke...
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_returnflag = 'R' AND l_shipmode = 'AIR' AND STRFTIME('%Y', l_shipdate) = '1994';