Chinastark/bird_dataset huggingface dataset:
Database: codebase_comments
Question: How many methods does solution 1 have? And please tell me if solution 1 needs to be compiled.
Evidence: method refers to Name; solution refers to Solution.Id; Solution.Id = 1; solution needs to be compiled refers to WasCompiled = 0;
SQL: SELECT COUNT(T2.SolutionId) , CASE WHEN T1.WasCompiled = 0 THEN 'Needs' ELSE 'NoNeeds' END needToCompile FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.SolutionId = 1
Database: codebase_comments
Question: What is the percentage of the methods' solutions that need to be compiled among the methods whose comments is XML format?
Evidence: comment is XML format refers to CommentIsXml = 1; solution needs to be compiled refesr to WasCompiled = 0; percentage = MULTIPLY(DIVIDE(SUM(WasCompiled = 0), COUNT(Solution.Id)), 100);
SQL: SELECT CAST(SUM(CASE WHEN T1.WasCompiled = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.CommentIsXml = 1
Database: codebase_comments
Question: Please list the names of methods with the solution path "wallerdev_htmlsharp\HtmlSharp.sln".
Evidence: name of the methods refers to Name; solution path refers to Path; Path = 'wallerdev_htmlsharp\HtmlSharp.sln';
SQL: SELECT T2.Name FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'wallerdev_htmlsharpHtmlSharp.sln'
Database: codebase_comments
Question: What is the percentage of respositories that receive more than 2,000 stars?
Evidence: stars>2000; percentage = DIVIDE(MULTIPLY(COUNT(Stars>2000), 100), COUNT(Id));
SQL: SELECT CAST(SUM(CASE WHEN Stars > 2000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Stars) FROM Repo
Database: codebase_comments
Question: What is the url of solution 1?
Evidence: solution refers to Solution.Id; Solution.Id = 1;
SQL: SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Id = 1
Database: codebase_comments
Question: Please provide the id of the respository that received the most forks among the respositories that receive 21 stars.
Evidence: repository that received the most forks refers to MAX(Forks);
SQL: SELECT Id FROM Repo WHERE Stars = 21 AND Forks = ( SELECT MAX(Forks) FROM Repo WHERE Stars = 21 )
Database: codebase_comments
Question: What the percentage of the english methods among the methods whose comments is XML format?
Evidence: english methods refers to lang = 'en'; comment is XML format refers to CommentIsXml = 1;
SQL: SELECT CAST(SUM(CASE WHEN Lang = 'en' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Name) FROM Method WHERE CommentIsXml = 1
Database: codebase_comments
Question: Please provide the path of solution of method whose tokenized name is html parser feed.
Evidence: path of solution refers to Path; method refers to Name; tokenized name refers to NameTokenized; Name = ''html parser feed';
SQL: SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'html parser feed'
Database: codebase_comments
Question: Please provide the solution id of the respository among the respository that receive 238 forks.
Evidence: solution id of the repository refers to solution.Id;
SQL: SELECT T2.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks = 238
Database: codebase_comments
Question: Among the english methods,please list the tokenized names of methods whose solutions need to be compiled.
Evidence: english methods refers to lang = 'en'; tokenized name refers to NameTokenized; methods refers to Name; solution needs to be compiled refers to WasCompiled = 0;
SQL: SELECT NameTokenized FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE Lang = 'en' AND WasCompiled = 0
Database: codebase_comments
Question: How many solutions whose repository's stars are a third more than forks?
Evidence: solutions refers to Solution.Id; repository stars are a third more than forks = (MULTIPLY(Stars, 1/3))>Forks;
SQL: SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks < T1.Stars * 1 / 3
Database: codebase_comments
Question: Please provide the path of solution of method whose full comment is Feeds data into the parser.
Evidence: path of solution refers to Path; method refers to name; full comment = 'Feeds data into the parser';
SQL: SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.FullComment = 'Feeds data into the parser'
Database: codebase_comments
Question: Among the repository "3", how many methods whose comments is XML format?
Evidence: repository refers to RepoId; RepoId = 3; method refers to Name; method whose comment is XML format refers to CommentIsXml = 1;
SQL: SELECT COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.RepoId = 3 AND T2.CommentIsXml = 1
Database: codebase_comments
Question: What is the percentage of solutions for the method that needs to be compiled in the English methods?
Evidence: method that needs to be compiled refers to WasCompiled = 0; English method refers to Lang = 'en'; percentage of solutions = MULTIPLY(DIVIDE(SUM(WasCompiled = 0), COUNT(Solution.Id)), 100);
SQL: SELECT CAST(SUM(CASE WHEN T1.WasCompiled = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Lang) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Lang = 'en'
Database: codebase_comments
Question: How many more stars in percentage are there for the repository of solution "1" than solution "2"?
Evidence: solution refers to Solution.Id; Solution.Id = 1 OR 2; percentage = DIVIDE(MULTIPLY(SUBTRACT(SUM(Solution.Id = 1), SUM(Solution.Id = 2)), 100)), SUM(Solution.Id = 2);
SQL: SELECT CAST(SUM(CASE WHEN T2.Id = 1 THEN T1.Stars ELSE 0 END) - SUM(CASE WHEN T2.Id = 2 THEN T1.Stars ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 2 THEN T1.Stars ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId
Database: codebase_comments
Question: How many solutions are there whose respositories received the number of stars more than one third of the number of forks?
Evidence: number of solutions are there whose repositories received the number of stars more than one third of the number of forks refers to Stars>DIVIDE(Forks, 3);
SQL: SELECT COUNT(DISTINCT T1.Id) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars > CAST(T1.Forks AS REAL) / 3
Database: codebase_comments
Question: What is the task of method number 2?
Evidence: task of the method refers to the second part of the Name after the "."; method number refers to Method_100k.Id; Method_100k.Id = 2;
SQL: SELECT SUBSTR(SUBSTR(Name, INSTR(Name, '.') + 1), 1, INSTR(SUBSTR(Name, INSTR(Name, '.') + 1), '.') - 1) task FROM Method WHERE Id = 2
Database: codebase_comments
Question: What format does the method number 8's comment have?
Evidence: format refers CommentIsXml; method number refers to Method_100k.Id; Method_100k.Id = 8;
SQL: SELECT CASE WHEN CommentIsXml = 0 THEN 'isNotXMLFormat' WHEN CommentIsXml = 1 THEN 'isXMLFormat' END format FROM Method WHERE Id = 8
Database: codebase_comments
Question: Please provide a link to the most well-known repository's Github address.
Evidence: link refers to Url; well-known repository refers to MAX(Watchers);
SQL: SELECT Url FROM Repo WHERE Watchers = ( SELECT MAX(Watchers) FROM Repo )
Database: codebase_comments
Question: What is the task of the method that is in the Czech language?
Evidence: method refers to Name; task of the method refers to the second part of the Name after the "."; Czech language refers to Lang = 'cs'
SQL: SELECT DISTINCT SUBSTR(SUBSTR(Name, INSTR(Name, '.') + 1), 1, INSTR(SUBSTR(Name, INSTR(Name, '.') + 1), '.') - 1) task FROM Method WHERE Lang = 'cs'
Database: codebase_comments
Question: What is the solution path for method number 3?
Evidence: solution path refers to Path; method number refers to Method_100k.Id; Method_100k.Id = 3;
SQL: SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Id = 3
Database: codebase_comments
Question: What is the language of method number 28 that can be found in the repository number 3?
Evidence: language of method refers to Lang; method number refers to Method_100k.Id; Method_100k.Id = 28; repository number refers to RepoId; RepoID = 3;
SQL: SELECT T2.Lang FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Id = 28 AND T1.RepoId = 3
Database: codebase_comments
Question: What is solution 1's processing time and how many methods have been using this solution?
Evidence: solution refers to Solution.Id and SolutionId; Solution.Id = 1; SolutionId = 1; processing time refers to ProcessedTime; methods refers to Name;
SQL: SELECT T1.ProcessedTime, COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.SolutionId = 1
Database: codebase_comments
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Database: trains
Question: Please list the directions in which the trains with 4 short cars run.
Evidence: short refers to len = 'short'; 4 cars run refers to position = 4
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.len = 'short' AND T1.position = 4
Database: trains
Question: What is the average number of cars on trains that run in the east direction?
Evidence: calculation = DIVIDE(count(id), count(train_id))
SQL: SELECT CAST(COUNT(T1.id) AS REAL) / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'
Database: trains
Question: Among the trains that have at least one non-regular shaped car, what is the percentage of it running in the east direction?
Evidence: non-regular shaped car refers to shape in ('bucket', 'ellipse'); calculation = MULTIPLY(DIVIDE(count(direction = 'east' then train_id)), count(train_id), 100)
SQL: SELECT CAST(COUNT(DISTINCT CASE WHEN T2.direction = 'east' THEN T1.train_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.shape IN ('bucket', 'ellipse')
Database: trains
Question: How many short cars are in the shape of hexagon?
Evidence: short cars refers to len = 'short'; in the shape of hexagon refers to shape = 'hexagon'
SQL: SELECT COUNT(id) FROM cars WHERE shape = 'hexagon' AND len = 'short'
Database: trains
Question: How many trains are running west?
Evidence: west is a direction
SQL: SELECT COUNT(id) FROM trains WHERE direction = 'west'
Database: trains
Question: What are the load shapes of all the short ellipse cars?
Evidence: short refers to len = 'short'; ellipse cars refers to shape = 'ellipse'
SQL: SELECT load_shape FROM cars WHERE shape = 'ellipse' AND len = 'short'
Database: trains
Question: What are the ids of the train running east?
Evidence: east is a direction
SQL: SELECT id FROM trains WHERE direction = 'east'
Database: trains
Question: How many wheels do the long cars have?
Evidence: long cars refers to len = 'long'
SQL: SELECT SUM(wheels) FROM cars WHERE len = 'long'
Database: trains
Question: Which direction do the majority of the trains are running?
Evidence: majority of train refers to MAX(count(id))
SQL: SELECT direction FROM trains GROUP BY direction ORDER BY COUNT(id) DESC