1sf/bird-sql-train-with-schema huggingface dataset:
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many methods in the same repository share a tokenized name that begins with "query language..."?
Evidence: methods refers to Name; tokenized name refers to NameTokenized; NameTokenized LIKE 'query language%';
SQL: SELECT COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized LIKE 'query language%'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: Please state the API calls for method number 10 and its intended course of action.
Evidence: method number refers to Method_100k.Id; Method_100k.Id = 10; intended course of action refers to Path;
SQL: SELECT T2.ApiCalls, T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Id = 10
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many methods in repository 150 did not have a comment and a summary?
Evidence: methods refers to Name; repository that did not have a comment and a summary refers to FullComment IS NULL AND Summary IS NULL;
SQL: SELECT COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.RepoId = 150 AND T2.FullComment IS NULL AND T2.Summary IS NULL
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: What is the comment format of method number 50 with the solution path "managedfusion_managedfusion\ManagedFusion.sln"?
Evidence: comment format refers to CommentIsXml; method number refers to Method_100k.Id; Method_100k.Id = 50; solution path refers to Path; Path = 'managedfusion_managedfusion\ManagedFusion.sln';
SQL: SELECT CASE WHEN T2.CommentIsXml = 0 THEN 'isNotXMLFormat' WHEN T2.CommentIsXml = 1 THEN 'isXMLFormat' END format FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Id = 50 AND T1.Path = 'managedfusion_managedfusionManagedFusion.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: What is the task method of the tokenized name "string extensions to pascal case
"?
Evidence: method refers to Name; task of the method refers to the second part of the Name after the "."; tokenized name refers to NameTokenized; NameTokenized = 'string extensions to pascal case';
SQL: SELECT DISTINCT SUBSTR(SUBSTR(Name, INSTR(Name, '.') + 1), 1, INSTR(SUBSTR(Name, INSTR(Name, '.') + 1), '.') - 1) task FROM Method WHERE NameTokenized = 'string extensions to pascal case'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: Provide the tokenized name of the method "Sky.Excel.ExcelBook.TypeConvert".
Evidence: tokenized name refers to NameTokenized; NameTokenized = 'Sky.Excel.ExcelBook.TypeConvert';
SQL: SELECT NameTokenized FROM Method WHERE Name = 'Sky.Excel.ExcelBook.TypeConvert'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many path does the github address "https://github.com/jeffdik/tachy.git" have?
Evidence: github address refers to Url; Url = 'https://github.com/jeffdik/tachy.git';
SQL: SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/jeffdik/tachy.git'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many watchers does the path "maff_se3ue7\US7.sln" have?
SQL: SELECT T1.Watchers FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'maff_se3ue7US7.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: List 5 github address that the solutions can be implemented without the need of compilation.
Evidence: github address refers to Url; solution can be implemented without the need of compliation refers to WasCompiled = 1;
SQL: SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.WasCompiled = 1 LIMIT 5
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: What are the solution path of the tokenized name "matrix multiply"?
Evidence: solution path refers to Path; tokenized name refers to NameTokenized; NameTokenized = 'matrix multiply';
SQL: SELECT DISTINCT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'matrix multiply'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many XML format does the github address "https://github.com/dogeth/vss2git.git" have?
Evidence: Xml format refers to CommentisXml, github address refers to Url; Url = 'https://github.com/dogeth/vss2git.git';
SQL: SELECT COUNT(T3.CommentIsXml) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/dogeth/vss2git.git' AND T3.CommentIsXml = 1
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: List 5 solution path that has sampling time of 636431758961741000.
Evidence: solution path refers to Path; sampling time refers to SampledAt; SampledAt = '636431758961741000';
SQL: SELECT DISTINCT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.SampledAt = 636431758961741000 LIMIT 5
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: What is the github address of the solution path "joeyrobert_bloomfilter\DataTypes.BloomFilter.sln"?
Evidence: github address refers to Url; solution path refers to Path; Path = 'joeyrobert_bloomfilter\DataTypes.BloomFilter.sln';
SQL: SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'joeyrobert_bloomfilterDataTypes.BloomFilter.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: List all the method name of the solution path "graffen_NLog.Targets.Syslog\src\NLog.Targets.Syslog.sln
".
Evidence: method name refers to Name; solution path refers to Path; Path = 'graffen_NLog.Targets.Syslog\src\NLog.Targets.Syslog.sln';
SQL: SELECT DISTINCT T2.Name FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'graffen_NLog.Targets.SyslogsrcNLog.Targets.Syslog.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: List all the tokenized name of the solution path "jurney_P4Backup\P4Backup\P4Backup.sln
".
Evidence: tokenized name refers to NameTokenized; solution path refers to Path; Path = 'jurney_P4Backup\P4Backup\P4Backup.sln';
SQL: SELECT DISTINCT T2.NameTokenized FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'jurney_P4BackupP4BackupP4Backup.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: Provide the github address with the summary of method "A test for Decompose
".
Evidence: github address refers to Url; summary of method refers to Summary; Summary = 'A test for Decompose';
SQL: SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T3.Summary = 'A test for Decompose'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many liked by people does the solution path "ninject_Ninject\Ninject.sln
" have?
Evidence: how many liked by people refers to Stars; solution path refers to Path; Path = 'ninject_Ninject\Ninject.sln';
SQL: SELECT DISTINCT T1.Stars FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'ninject_NinjectNinject.sln'
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many solution path does the repository with 111 stars, 58 forks, and 111 watchers?
Evidence: solution path refers to Path;
SQL: SELECT COUNT(T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = 111 AND T1.Forks = 58 AND T1.Watchers = 111
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: What is the average processed time of the solution with a repository of 254 likes, 88 followers, and 254 watchers?
Evidence: average processed time = AVG(ProcessedTime);
SQL: SELECT CAST(SUM(T2.ProcessedTime) AS REAL) / COUNT(T2.ProcessedTime) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = 254 AND T1.Forks = 88 AND T1.Watchers = 254
Database: codebase_comments
Tables: Method, MethodParameter, Repo, Solution
Columns (table index, column name): -1, *, 0, Id, 0, Name, 0, FullComment, 0, Summary, 0, ApiCalls, 0, CommentIsXml, 0, SampledAt, 0, SolutionId, 0, Lang, 0, NameTokenized, 1, Id, 1, MethodId, 1, Type, 1, Name, 2, Id, 2, Url, 2, Stars, 2, Forks, 2, Watchers, 2, ProcessedTime, 3, Id, 3, RepoId, 3, Path, 3, ProcessedTime, 3, WasCompiled
Question: How many language code of method is used for the github address "https://github.com/managedfusion/managedfusion.git
"?
Evidence: language code of method refers to Lang; github address refers to Url; Url = 'https://github.com/managedfusion/managedfusion.git';
SQL: SELECT COUNT(DISTINCT T3.Lang) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/managedfusion/managedfusion.git'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many trains are there that run in the east direction?
Evidence: east is a direction
SQL: SELECT COUNT(id) FROM trains WHERE direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many cars are there on train no.1?
Evidence: train no.1 refers to train_id = 1
SQL: SELECT COUNT(id) FROM cars WHERE train_id = 1
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What is the shape of the tail car on train no.1?
Evidence: train no.1 refers to train_id = 1; tail car refers to position = 4
SQL: SELECT shape FROM cars WHERE train_id = 1 AND position = 4
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the IDs of all the trains with at least one car in a non-regular shape.
Evidence: non-regular shape refers to shape in ('elipse', 'bucket')
SQL: SELECT train_id FROM cars WHERE shape IN ('elipse', 'bucket') GROUP BY train_id
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many cars on train no.1 have the roof open?
Evidence: train no. 1 refers to train_id = 1; roof open refers to roof = 'none'
SQL: SELECT COUNT(id) FROM cars WHERE train_id = 1 AND roof = 'none'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the IDs of all the cars on train no.1 that have 2 wheels.
Evidence: train no.1 refers to train_id = 1; 2 wheels refers to wheels = 2
SQL: SELECT id FROM cars WHERE train_id = 1 AND wheels = 2
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains that run in the east direction, how many of them have at least one car in a non-regular shape?
Evidence: non-regular shape refers to shape in ('elipse', 'bucket')
SQL: SELECT SUM(CASE WHEN T1.shape IN ('bucket', 'elipse') THEN 1 ELSE 0 end)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the IDs of all the trains that run in the east direction and have less than 4 cars.
Evidence: less than 4 cars refers to carsNum < 4
SQL: SELECT T1.id FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS carsNum FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T1.direction = 'east' AND T2.carsNum < 4
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the IDs of all the cars with double sides on trains that run in the west direction.
Evidence: double sides on trains refers to sides = 'double'
SQL: SELECT T1.id FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east' AND T1.sides = 'double'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains that run in the east direction, how many of them have more than 2 long cars?
Evidence: more than 2 long cars refers to longCarsNum > 2
SQL: SELECT SUM(CASE WHEN T2.longCarsNum > 2 THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS longCarsNum FROM cars WHERE len = 'long' GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T1.direction = 'west'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the directions in which the trains with at least one empty-loaded car run.
Evidence: at least one empty-loaded car run refers to load_num = 0
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.load_num = 0
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: In which direction does the train with an ellipse-shape car run?
Evidence: shape = 'ellipse'
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.shape = 'ellipse'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What is the total number of short cars on all the trains that run in the east direction?
Evidence: short cars refers to len = 'short'
SQL: SELECT SUM(CASE WHEN T1.len = 'short' then 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the shapes of all the head cars on the trains that run in the east direction.
Evidence: head cars refers to position = 1;
SQL: SELECT T1.shape FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east' AND T1.position = 1 GROUP BY T1.shape
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many cars on a train that runs in the east direction have a flat roof?
Evidence: flat roof refers to roof = 'flat'
SQL: SELECT SUM(CASE WHEN T1.roof = 'flat' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the cars on a train that runs in the east direction, how many of them have a flat roof and a circle load shape?
Evidence: flat roof refers to roof = 'flat'; load_shape = 'circle'
SQL: SELECT SUM(CASE WHEN T1.load_shape = 'circle' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east' AND T1.roof = 'flat'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Trains that run in which direction have more rectangle-shaped cars in total?
Evidence: more rectangle-shaped cars refers to MAX(rectCarsNum)
SQL: SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS rectCarsNum FROM cars WHERE shape = 'rectangle' GROUP BY train_id ) AS T2 ON T1.id = T2.train_id ORDER BY T2.rectCarsNum DESC