input
stringlengths
201
2.7k
output
stringlengths
24
744
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: What is the proportion of English-speaking citizens in the countries that rely on the United States compared to the total number of citizens in those countries? [/INST] [/INST]
SELECT T2.Percentage * T1.Population FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE T3.Dependent = 'USA' AND T2.Name = 'English';
[INST] Here is a database schema: economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: Which federal republic country in Europe has the most provinces, and what proportion of GDP is devoted to services? Calculate the population density as well. [/INST] [/INST]
SELECT T1.Country, T2.Service , SUM(T1.Population) / SUM(T1.Area) FROM province AS T1 INNER JOIN economy AS T2 ON T1.Country = T2.Country WHERE T1.Country IN ( SELECT Country FROM encompasses WHERE Continent = 'Europe' ) GROUP BY T1.Country, T2.Service ORDER BY COUNT(T1.Name) DESC LIMIT 1;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: What is the capital of the 3rd most populated country in Asia and what is the capital city's ratio in percentage (%) against the overall population of the country? [/INST] [/INST]
SELECT T4.Capital, CAST(T3.Population AS REAL) * 100 / T4.Population FROM city AS T3 INNER JOIN ( SELECT T1.Capital , T1.Population FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia' ORDER BY T1.Population DESC LIMIT 2, 1 ) AS T4 ON T3.Name = T4.Capital;
[INST] Here is a database schema: desert : Name [ TEXT ] primary_key Area [ REAL ] Longitude [ REAL ] Latitude [ REAL ] Please write me a SQL statement that answers the following question: What's the name of the second biggest desert? [/INST] [/INST]
SELECT Name FROM desert ORDER BY Area DESC LIMIT 1, 1;
[INST] Here is a database schema: language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: What is the main spoken language in MNE? [/INST] [/INST]
SELECT Name FROM language WHERE Country = 'MNE' ORDER BY Percentage DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: What's the percentage of people in Cayman Islands speak English? [/INST] [/INST]
SELECT T1.Percentage FROM language AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Cayman Islands' AND T1.Name = 'English';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Please write me a SQL statement that answers the following question: Which country was the source of Pjandsh River? Give the full name of the country. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country WHERE T2.River = 'Pjandsh';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: For the countries have the population north of a billion, which one has the lowest GDP? Give the full name of the country. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population > 1000000000 ORDER BY T2.GDP ASC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] geo_mountain : Mountain [ TEXT ] Country [ TEXT ] Province [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: What is the capital of the country that has the Licancabur Mountain? [/INST] [/INST]
SELECT T4.Capital FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN country AS T4 ON T4.Province = T3.Name WHERE T1.Name = 'Licancabur';
[INST] Here is a database schema: island : Name [ TEXT ] primary_key Islands [ TEXT ] Area [ REAL ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] islandIn : Island [ TEXT ] Sea [ TEXT ] Lake [ TEXT ] River [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] mountainOnIsland : Mountain [ TEXT ] Island [ TEXT ] Please write me a SQL statement that answers the following question: How much sea is around the island where Kerinci Mountain is located? [/INST] [/INST]
SELECT COUNT(T4.Sea) FROM mountain AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Mountain INNER JOIN island AS T3 ON T3.Name = T2.Island INNER JOIN islandIn AS T4 ON T4.Island = T3.Name WHERE T1.Name = 'Kerinci';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: Which three countries does the Amazonas flow through? Give the full name of the countries. [/INST] [/INST]
SELECT DISTINCT T4.Name FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River INNER JOIN country AS T4 ON T4.Code = T2.Country WHERE T3.Name = 'Amazonas';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: Which country became independent on 1492-01-01? Give the full name of the country. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1492-01-01';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: How many cities in France have a population of more than 100,000? [/INST] [/INST]
SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN city AS T2 ON T2.Country = T1.Code WHERE T1.Name = 'France' AND T2.Population > 100000;
[INST] Here is a database schema: river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] sea : Name [ TEXT ] primary_key Depth [ REAL ] Please write me a SQL statement that answers the following question: Among all the rivers finally flows to the sea of 540m in depth, which one has the longest length? [/INST] [/INST]
SELECT T2.Name FROM sea AS T1 INNER JOIN river AS T2 ON T2.Sea = T1.Name WHERE T1.Depth = 540 ORDER BY T2.Length DESC LIMIT 1;
[INST] Here is a database schema: geo_mountain : Mountain [ TEXT ] Country [ TEXT ] Province [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: In which Country is the second highest volcanic mountain located in? Give the code of the country. [/INST] [/INST]
SELECT T3.Country FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province ORDER BY T1.Height DESC LIMIT 1, 1;
[INST] Here is a database schema: island : Name [ TEXT ] primary_key Islands [ TEXT ] Area [ REAL ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] mountainOnIsland : Mountain [ TEXT ] Island [ TEXT ] Please write me a SQL statement that answers the following question: What is the longitude of the island on which Mount Olympos is located? [/INST] [/INST]
SELECT T3.Longitude FROM mountain AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Mountain INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T1.Name = 'Olympos';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: For all the countries that is smaller than 100 square kilometres, which one has the most GDP? [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area < 100 ORDER BY T2.GDP DESC LIMIT 1;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: What is the total number of cities that Japan have? [/INST] [/INST]
SELECT COUNT(T3.Name) FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T1.Name = 'Japan';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: Which city has most population other than its capital in Bangladesh? [/INST] [/INST]
SELECT T3.Name FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T1.Name = 'Bangladesh' AND T3.Name <> T1.Capital ORDER BY T3.Population DESC LIMIT 1;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: Which non capital city has the most people of all? [/INST] [/INST]
SELECT T3.Name FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name <> T1.Capital ORDER BY T3.Population DESC LIMIT 1;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: In which country is the city of Grozny? Give the full name of the country. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Grozny';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] religion : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Which religion has the majority of the people in Japan? [/INST] [/INST]
SELECT T2.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' ORDER BY T2.Percentage DESC LIMIT 1;
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: Which two countries have the border in length of 803 km? Give the full names of the countries. [/INST] [/INST]
SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T2.Length = 803;
[INST] Here is a database schema: continent : Name [ TEXT ] primary_key Area [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: How many percent of the total area of Russia is in Europe? [/INST] [/INST]
SELECT T2.Percentage FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Russia' AND T1.Name = 'Europe';
[INST] Here is a database schema: continent : Name [ TEXT ] primary_key Area [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Give the full names of the countries that are located in more than one continent. [/INST] [/INST]
SELECT T3.Name FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country GROUP BY T3.Name HAVING COUNT(T3.Name) > 1;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: How many people are there in Fareham's mother country? [/INST] [/INST]
SELECT T1.Population FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Fareham';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] population : Country [ TEXT ] primary_key Population_Growth [ REAL ] Infant_Mortality [ REAL ] Please write me a SQL statement that answers the following question: What's the number of infant mortality in Switzerland in a year? [/INST] [/INST]
SELECT T2.Infant_Mortality * T1.Population * T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Switzerland';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] geo_mountain : Mountain [ TEXT ] Country [ TEXT ] Province [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: How many mountains are there in the United States? [/INST] [/INST]
SELECT COUNT(T1.Name) FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN country AS T4 ON T4.Province = T3.Name WHERE T4.Name = 'United States';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: When did Equatorial Guinea become independent? [/INST] [/INST]
SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Equatorial Guinea';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: What is the GDP per capita in Switzerland? [/INST] [/INST]
SELECT T2.GDP / T1.Population FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Switzerland';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: What is the GDP for Service of the country with Fuenlabrada as its city. [/INST] [/INST]
SELECT T4.Service * T4.GDP FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name INNER JOIN economy AS T4 ON T4.Country = T2.Country WHERE T3.Name = 'Fuenlabrada';
[INST] Here is a database schema: located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: How many times longer is the longest river in Tajikistan than the shortest river? [/INST] [/INST]
SELECT MAX(T2.Length) / MIN(T2.Length) FROM located AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name WHERE T1.Country = 'TJ';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: What is the population density of Hanoi's home country? [/INST] [/INST]
SELECT T1.Population / T1.Area FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Hanoi';
[INST] Here is a database schema: ethnicGroup : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: In countries where there is more than one ethnic group, name the ethnic group with the greatest presence in each country and the country to which it corresponds. [/INST] [/INST]
SELECT Country, Name FROM ethnicGroup AS T1 WHERE Percentage < 100 AND Percentage = ( SELECT MAX(Percentage) FROM ethnicGroup AS T2 WHERE T1.Country = T2.Country );
[INST] Here is a database schema: geo_desert : Desert [ TEXT ] Country [ TEXT ] Province [ TEXT ] Please write me a SQL statement that answers the following question: How many deserts are not located in a single country? Name them. [/INST] [/INST]
SELECT Desert FROM geo_desert GROUP BY Desert HAVING COUNT(DISTINCT Country) > 1;
[INST] Here is a database schema: geo_river : River [ TEXT ] Country [ TEXT ] Province [ TEXT ] Please write me a SQL statement that answers the following question: How many rivers belong to more than one country? Name the provinces where we can find them. [/INST] [/INST]
SELECT River, GROUP_CONCAT(Province) FROM geo_river GROUP BY River HAVING COUNT(DISTINCT Country) > 1;
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: What percentage of the border does Angola share with each of the countries with which it borders? [/INST] [/INST]
SELECT SUM(CASE WHEN T2.Name = 'Angola' THEN T1.Length ELSE 0 END) * 100 / SUM(T1.Length) FROM borders AS T1 LEFT JOIN country AS T2 ON T1.Country1 = T2.Code;
[INST] Here is a database schema: island : Name [ TEXT ] primary_key Islands [ TEXT ] Area [ REAL ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] Please write me a SQL statement that answers the following question: What percent of the non volcanic islands in the Lesser Antilles group of islands have an area of no more than 300 square kilometers? [/INST] [/INST]
SELECT SUM(CASE WHEN Area <= 300 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM island WHERE Islands = 'Lesser Antilles' AND (Type != 'volcanic' OR Type IS NULL);
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Of all the countries in which English is spoken, what percentage has English as their only language? [/INST] [/INST]
SELECT CAST(SUM(CASE WHEN T2.Percentage = 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'English';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: Name of the capitals of the countries that have less than 99.95% less population than the country that has the most population. [/INST] [/INST]
SELECT Capital FROM country WHERE Population <= ( SELECT MAX(Population) - MAX(Population) * 0.9995 FROM country );
[INST] Here is a database schema: river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: Average length of the rivers flowing into the Donau River. [/INST] [/INST]
SELECT * FROM river WHERE Name = 'Donau';
[INST] Here is a database schema: target : Country [ TEXT ] primary_key Target [ TEXT ] Please write me a SQL statement that answers the following question: Based on the data shown at Target, what percentage of countries are non-Christian? [/INST] [/INST]
SELECT 100 - (CAST(SUM(CASE WHEN Target = 'Christian' THEN 1 ELSE 0 END) AS REAL)) * 100 / COUNT(Country) FROM target;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] isMember : Country [ TEXT ] Organization [ TEXT ] Type [ TEXT ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: Which country with a city with a population between 50,000 and 300,000 inhabitants and which is a member of an organization established between 03/01/1991 and 04/30/1991 is also a member of the EBRD? [/INST] [/INST]
SELECT T2.Country FROM country AS T1 INNER JOIN isMember AS T2 ON T1.Code = T2.Country INNER JOIN organization AS T3 ON T3.Country = T2.Country INNER JOIN city AS T4 ON T4.Country = T3.Country WHERE T3.Abbreviation = 'EBRD' AND T4.Population BETWEEN 50000 AND 300000 AND T3.Established BETWEEN '1991-01-31' AND '1991-04-30';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] geo_river : River [ TEXT ] Country [ TEXT ] Province [ TEXT ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: Which river with its mouth in the Donau River and a length greater than 500 km is located in Slovenia? [/INST] [/INST]
SELECT T2.River FROM country AS T1 INNER JOIN geo_river AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Slovenia' AND T2.River IN ( SELECT NAME FROM river WHERE Length > 500 AND River = 'Donau' );
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] sea : Name [ TEXT ] primary_key Depth [ REAL ] Please write me a SQL statement that answers the following question: In which city is the sea whose depth is 4232 meters less than that of the Bay of Bengal? [/INST] [/INST]
SELECT T2.City FROM sea AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Sea INNER JOIN city AS T3 ON T3.Name = T2.City WHERE ( SELECT Depth FROM sea WHERE Name LIKE '%Bengal%' ) - T1.Depth = 4235;
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] lake : Name [ TEXT ] primary_key Area [ REAL ] Depth [ REAL ] Altitude [ REAL ] Type [ TEXT ] River [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: In which city is the lake located at coordinates longitude -85.35 and latitude 11.6? [/INST] [/INST]
SELECT T2.City FROM lake AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Lake INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN city AS T4 ON T4.Province = T3.Name WHERE T1.Longitude = -85.35 AND T1.Latitude = 11.6;
[INST] Here is a database schema: continent : Name [ TEXT ] primary_key Area [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: On which continent is the country with the most erosion of real income? [/INST] [/INST]
SELECT T1.Name FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN economy AS T4 ON T4.Country = T3.Code ORDER BY T4.Inflation DESC LIMIT 1;
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] continent : Name [ TEXT ] primary_key Area [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Which two Asian countries share a border that is 1,782 kilometers long? [/INST] [/INST]
SELECT T4.Country1, T4.Country2 FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN borders AS T4 ON T4.Country1 = T3.Code WHERE T1.Name = 'Asia' AND T4.Length = 1782;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] geo_lake : Lake [ TEXT ] Country [ TEXT ] Province [ TEXT ] lake : Name [ TEXT ] primary_key Area [ REAL ] Depth [ REAL ] Altitude [ REAL ] Type [ TEXT ] River [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: Of all the lakes in Bolivia, which is the deepest? [/INST] [/INST]
SELECT T1.Name FROM lake AS T1 INNER JOIN geo_lake AS T2 ON T1.Name = T2.Lake INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN country AS T4 ON T4.Code = T3.Country WHERE T4.Name = 'Bolivia' ORDER BY T1.Depth DESC LIMIT 1;
[INST] Here is a database schema: lake : Name [ TEXT ] primary_key Area [ REAL ] Depth [ REAL ] Altitude [ REAL ] Type [ TEXT ] River [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: In which lake flows the river that is, in turn, the mouth of the Manicouagan River? [/INST] [/INST]
SELECT NAME FROM lake WHERE river = ( SELECT river FROM river WHERE NAME = 'Manicouagan' );
[INST] Here is a database schema: island : Name [ TEXT ] primary_key Islands [ TEXT ] Area [ REAL ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] mountainOnIsland : Mountain [ TEXT ] Island [ TEXT ] Please write me a SQL statement that answers the following question: In which group of islands is Rinjani Mountain located? [/INST] [/INST]
SELECT T1.Islands FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T3.Name = 'Rinjani';
[INST] Here is a database schema: mergesWith : Sea1 [ TEXT ] Sea2 [ TEXT ] sea : Name [ TEXT ] primary_key Depth [ REAL ] Please write me a SQL statement that answers the following question: List all the seas with which the deepest sea merges. [/INST] [/INST]
SELECT T2.Sea2 FROM sea AS T1 INNER JOIN mergesWith AS T2 ON T1.Name = T2.Sea1 WHERE T1.Name = ( SELECT Name FROM sea ORDER BY Depth DESC LIMIT 1 );
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Of all the countries that share territory with more than one continent, in which of them does the average population not exceed 10 inhabitants per square kilometer? [/INST] [/INST]
SELECT NAME FROM country WHERE CODE IN ( SELECT country FROM encompasses GROUP BY country HAVING COUNT(continent) > 1 ) AND population / Area <= 10;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] religion : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Of all the countries of the Hindu religion, which has the lowest ratio of people per square meter of surface? [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Hindu' ORDER BY T1.Population / T1.Area ASC LIMIT 1;
[INST] Here is a database schema: economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: On what date did the country have a gross domestic product 400% higher than Saint Kitts and Nevis become independent? [/INST] [/INST]
SELECT Independence FROM politics WHERE country = ( SELECT country FROM economy WHERE GDP = 1100 );
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: What is the average population ratio of the countries in which organizations were established in 1947? [/INST] [/INST]
SELECT T1.Population / T1.Area FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE STRFTIME('%Y', T2.Established) = '1947';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: What is the name of Anguilla's capital, and where is it located? [/INST] [/INST]
SELECT Capital, Province FROM country WHERE Name = 'Anguilla';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: Which nation has the smallest population, and where is its capital located? [/INST] [/INST]
SELECT Name, Capital FROM country ORDER BY Population ASC LIMIT 1;
[INST] Here is a database schema: continent : Name [ TEXT ] primary_key Area [ REAL ] Please write me a SQL statement that answers the following question: How much more space does Asia have than Europe? [/INST] [/INST]
SELECT MAX(Area) - MIN(Area) FROM continent WHERE Name = 'Asia' OR Name = 'Europe';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] Please write me a SQL statement that answers the following question: What is the geographic location of Aarhus city? Please provide the answer with the coordinates of the location. [/INST] [/INST]
SELECT Longitude, Latitude FROM city WHERE Name = 'Aarhus';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: What is the population gap between the United Kingdom and Italy? [/INST] [/INST]
SELECT MAX(Population) - MIN(Population) FROM country WHERE Name = 'United Kingdom' OR Name = 'Italy';
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: In which city is the European Bank for Reconstruction and Development's headquarters? Please include the city and province where the headquarters are located in your answer. [/INST] [/INST]
SELECT City, Province FROM organization WHERE Name = 'European Bank for Reconstruction and Development';
[INST] Here is a database schema: lake : Name [ TEXT ] primary_key Area [ REAL ] Depth [ REAL ] Altitude [ REAL ] Type [ TEXT ] River [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] Please write me a SQL statement that answers the following question: Which lake is the largest in terms of both surface area and depth? [/INST] [/INST]
SELECT Name FROM lake ORDER BY Area * Depth DESC LIMIT 1;
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] Please write me a SQL statement that answers the following question: Which two nations are separated from one another by the longest border? Please include the entire names of the nations in your answer. [/INST] [/INST]
SELECT Country1, Country2 FROM borders ORDER BY Length DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: Which nation has the highest GDP? Please give the nation's full name. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] ethnicGroup : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Which nation has the lowest proportion of people who speak an African language? Please state the nation's full name. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'African' ORDER BY T2.Percentage ASC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] religion : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Which country has three different religions-Anglicanism, Christianity, and Roman Catholicism and uses 100% English? [/INST] [/INST]
SELECT T2.Country FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country INNER JOIN language AS T3 ON T3.Country = T2.Country WHERE (T2.Name = 'Anglican' OR T2.Name = 'Christian' OR T2.Name = 'Roman Catholic') AND T3.Name = 'English' AND T3.Percentage = 100 GROUP BY T1.Name HAVING COUNT(T1.Name) = 3;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: Please list the top 3 countries with the highest inflation rate. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.Inflation DESC LIMIT 3;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] language : Country [ TEXT ] Name [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: Please provide a list of every nation where English is spoken and utilized entirely. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'English' AND T2.Percentage = 100;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: How many businesses were founded after 1960 in a nation that wasn't independent? [/INST] [/INST]
SELECT COUNT(T3.Name) FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN organization AS T3 ON T3.Country = T2.Country WHERE T2.Independence = NULL AND STRFTIME('%Y', T3.Established) > '1960';
[INST] Here is a database schema: city : Name [ TEXT ] Country [ TEXT ] Province [ TEXT ] Population [ INTEGER ] Longitude [ REAL ] Latitude [ REAL ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: What province did the river Klaeaelv travel through and how long is the river? [/INST] [/INST]
SELECT T1.Province FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = 'Klaraelv';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] sea : Name [ TEXT ] primary_key Depth [ REAL ] Please write me a SQL statement that answers the following question: How many Italian regions are bordered by the Mediterranean Sea? How deep is the Mediterranean Sea? [/INST] [/INST]
SELECT COUNT(DISTINCT T2.province), T3.Depth FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country INNER JOIN sea AS T3 ON T3.Name = T2.Sea WHERE T1.Code = 'I' AND T3.Name = 'Mediterranean Sea' GROUP BY T3.Depth;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: What nations are considered British Overseas Territories? [/INST] [/INST]
SELECT name FROM country WHERE CODE IN ( SELECT country FROM politics WHERE government = 'British Overseas Territories' );
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] economy : Country [ TEXT ] primary_key GDP [ REAL ] Agriculture [ REAL ] Service [ REAL ] Industry [ REAL ] Inflation [ REAL ] Please write me a SQL statement that answers the following question: Which of the top 3 economies by GDP has the lowest proportion of the economy devoted to agriculture? [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC, T2.Agriculture ASC LIMIT 1;
[INST] Here is a database schema: continent : Name [ TEXT ] primary_key Area [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] encompasses : Country [ TEXT ] Continent [ TEXT ] Percentage [ REAL ] Please write me a SQL statement that answers the following question: How big is Africa, and how many nations make up the continent? [/INST] [/INST]
SELECT T1.Area, COUNT(T3.Name) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T1.Name = 'Asia' GROUP BY T1.Name, T1.Area;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: Which United States province is home to the greatest number of corporations' corporate headquarters? [/INST] [/INST]
SELECT T1.Province FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'United States' GROUP BY T1.Province ORDER BY COUNT(T1.Name) DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: What are the most recent three independent nations? [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country ORDER BY T2.Independence DESC LIMIT 3;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: Please name any three sovereign nations that have been governed by the republic since 1991. [/INST] [/INST]
SELECT country FROM politics WHERE government = 'republic' AND STRFTIME('%Y', independence) >= '1991' AND country IN ( SELECT country FROM country ) ORDER BY independence LIMIT 3;
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: Which company falls under the category of an associated member? Please provide the organization's full name. [/INST] [/INST]
SELECT NAME FROM organization WHERE country IN ( SELECT country FROM politics WHERE dependent != '' );
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] desert : Name [ TEXT ] primary_key Area [ REAL ] Longitude [ REAL ] Latitude [ REAL ] geo_desert : Desert [ TEXT ] Country [ TEXT ] Province [ TEXT ] Please write me a SQL statement that answers the following question: Which nations have a boundary with the Kalahari Desert? [/INST] [/INST]
SELECT T3.Name FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T1.Name = 'Kalahari';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] desert : Name [ TEXT ] primary_key Area [ REAL ] Longitude [ REAL ] Latitude [ REAL ] geo_desert : Desert [ TEXT ] Country [ TEXT ] Province [ TEXT ] Please write me a SQL statement that answers the following question: Which desert in Kazakhstan is the largest? [/INST] [/INST]
SELECT T1.Name FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Kazakstan' ORDER BY T1.Area DESC LIMIT 1;
[INST] Here is a database schema: mergesWith : Sea1 [ TEXT ] Sea2 [ TEXT ] sea : Name [ TEXT ] primary_key Depth [ REAL ] Please write me a SQL statement that answers the following question: What sea does the Baltic Sea converge with, and how deep is the Baltic Sea? [/INST] [/INST]
SELECT T2.Sea2, T1.Depth FROM sea AS T1 INNER JOIN mergesWith AS T2 ON T1.Name = T2.Sea1 WHERE T1.Name = 'Baltic Sea';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: Which constitutional monarchy nations saw the greatest growth in the number of organizations after 1907? [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE STRFTIME('%Y', T2.Established) > '1907' AND T3.Government = 'constitutional monarchy' GROUP BY T1.Name ORDER BY COUNT(DISTINCT T2.Name) DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] geo_mountain : Mountain [ TEXT ] Country [ TEXT ] Province [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: What kind of mountain is Ampato? Which province and nation does this mountain belong to? [/INST] [/INST]
SELECT T1.Type, T3.Name, T4.Name FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN country AS T4 ON T3.Country = T4.Code WHERE T1.Name = 'Ampato';
[INST] Here is a database schema: geo_mountain : Mountain [ TEXT ] Country [ TEXT ] Province [ TEXT ] mountain : Name [ TEXT ] primary_key Mountains [ TEXT ] Height [ REAL ] Type [ TEXT ] Longitude [ REAL ] Latitude [ REAL ] province : Name [ TEXT ] Country [ TEXT ] Population [ INTEGER ] Area [ REAL ] Capital [ TEXT ] CapProv [ TEXT ] Please write me a SQL statement that answers the following question: Please provide a list of every volcano mountain in the province of Ecuador. [/INST] [/INST]
SELECT T1.Name FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province WHERE T3.Name = 'Ecuador' AND T1.Type = 'volcano';
[INST] Here is a database schema: politics : Country [ TEXT ] primary_key Independence [ DATE ] Dependent [ TEXT ] Government [ TEXT ] Please write me a SQL statement that answers the following question: What percentage of nations have achieved independence since 1993 and practice parliamentary democracy? Please include any three parliament-based democracies that attained independence after 1993. [/INST] [/INST]
SELECT SUM(IIF(government = 'parliamentary democracy', 1, 0)) , CAST(SUM(IIF(government = 'parliamentary democracy', 1, 0)) AS REAL) * 100 / COUNT(*) FROM politics AS t1 WHERE STRFTIME('%Y', independence) >= '1993';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] located : City [ TEXT ] Province [ TEXT ] Country [ TEXT ] River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] river : Name [ TEXT ] primary_key River [ TEXT ] Lake [ TEXT ] Sea [ TEXT ] Length [ REAL ] SourceLongitude [ REAL ] SourceLatitude [ REAL ] Mountains [ TEXT ] SourceAltitude [ REAL ] EstuaryLongitude [ REAL ] EstuaryLatitude [ REAL ] Please write me a SQL statement that answers the following question: What proportion of rivers have a length of more than 3,000 miles? Please provide the name of a Russian river that is more than 3,000 miles long. [/INST] [/INST]
SELECT CAST(SUM(CASE WHEN T1.Length > 3000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM river AS T1 INNER JOIN located AS T2 ON T1.Name = T2.River INNER JOIN country AS T3 ON T3.Code = T2.Country;
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: What is the full name of ABEDA and when was it established? [/INST] [/INST]
SELECT Name, Established FROM organization WHERE Abbreviation = 'ABEDA';
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: Name all the organisations that were established from 1970 to 1980. [/INST] [/INST]
SELECT Name FROM organization WHERE STRFTIME('%Y', Established) BETWEEN '1970' AND '1980';
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: Provide a list of all organisations with headquarters in London? [/INST] [/INST]
SELECT Name FROM organization WHERE City = 'London';
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: For each organisations with headquarters in the USA, provide the its full name and the city where the headquarter is located at. [/INST] [/INST]
SELECT Name, City FROM organization WHERE Country = 'USA';
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: Name the first organisation established in the Paris city. State its abbreviation, full name and date of establishment. [/INST] [/INST]
SELECT Abbreviation, Name, Established FROM organization WHERE City = 'Paris' ORDER BY Established ASC LIMIT 1;
[INST] Here is a database schema: organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: List all the organisations that where its name contains 'United Nation'. State its full name and its headquarter city. [/INST] [/INST]
SELECT Name, City FROM organization WHERE Name LIKE '%United Nation%';
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: Which 2 countries' border span across the longest length? Provide the country's full name. [/INST] [/INST]
SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 ORDER BY T2.Length DESC LIMIT 1;
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: Name all countries in which have border with Bulgaria. [/INST] [/INST]
SELECT T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = 'Bulgaria';
[INST] Here is a database schema: borders : Country1 [ TEXT ] Country2 [ TEXT ] Length [ REAL ] country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] Please write me a SQL statement that answers the following question: State all countries with border greater than 4,000. List the full country name. [/INST] [/INST]
SELECT T1.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 WHERE T2.Length > 4000;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] isMember : Country [ TEXT ] Organization [ TEXT ] Type [ TEXT ] Please write me a SQL statement that answers the following question: Among the country member of 'IOC' organization, which country has the most population? [/INST] [/INST]
SELECT T2.Name FROM isMember AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Organization = 'IOC' ORDER BY T2.Population DESC LIMIT 1;
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] isMember : Country [ TEXT ] Organization [ TEXT ] Type [ TEXT ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: List all members and member type of the Islamic Development Bank. [/INST] [/INST]
SELECT T2.Country, T2.Type FROM organization AS T1 INNER JOIN isMember AS T2 ON T1.Abbreviation = T2.Organization INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T1.Name = 'Islamic Development Bank';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: State the area and population of the country where Asia Pacific Economic Cooperation headquarter is located. [/INST] [/INST]
SELECT T2.Name, T2.Population FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Asia Pacific Economic Cooperation';
[INST] Here is a database schema: country : Name [ TEXT ] Code [ TEXT ] primary_key Capital [ TEXT ] Province [ TEXT ] Area [ REAL ] Population [ INTEGER ] isMember : Country [ TEXT ] Organization [ TEXT ] Type [ TEXT ] organization : Abbreviation [ TEXT ] primary_key Name [ TEXT ] City [ TEXT ] Country [ TEXT ] Province [ TEXT ] Established [ DATE ] Please write me a SQL statement that answers the following question: What is the organization(s) that has 'National Society' as member type. [/INST] [/INST]
SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T2.Type = 'National Society';