aherntech/sparc huggingface dataset:
Database: music_1
Question sequence:
For each language, how many songs are there?
For each language group in order, what is the average duration value of the songs in the group?
How about the maximum duration and resolution?
SQL query sequence:
SELECT languages,COUNT(*) FROM song GROUP BY languages
SELECT avg(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id GROUP BY T2.languages ORDER BY T2.languages
SELECT max(T1.duration) ,  max(T2.resolution) ,  T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id GROUP BY T2.languages ORDER BY T2.languages
Final question: What are the maximum duration and resolution of songs grouped and ordered by languages?
Final SQL: SELECT max(T1.duration) ,  max(T2.resolution) ,  T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id GROUP BY T2.languages ORDER BY T2.languages
Database: music_1
Question sequence:
How many genres are there in total?
How many songs for each of them, show the result in the order of genre?
What are the shortest duration and lowest rating for each group?
SQL query sequence:
SELECT COUNT(DISTINCT genre_is) FROM song
SELECT genre_is,COUNT(*) FROM song GROUP BY genre_is
SELECT min(T1.duration) ,  min(T2.rating) ,  T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is
Final question: What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre?
Final SQL: SELECT min(T1.duration) ,  min(T2.rating) ,  T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is
Database: music_1
Question sequence:
List the number of songs for each artist.
How many songs does Farida has?
How about Prity?
What about the people who has at least an English song?
SQL query sequence:
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name having T1.artist_name = 'Farida'
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name having T1.artist_name = 'Prity'
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "english" GROUP BY T2.artist_name HAVING count(*)  >=  1
Final question: Find the names and number of works of all artists who have at least one English songs.
Final SQL: SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "english" GROUP BY T2.artist_name HAVING count(*)  >=  1
Database: music_1
Question sequence:
Which songs have a resolution to be lower than 800?
List artist names and the countries of these songs?
What about the artist names and countries who have at least one song of resolution above 900?
SQL query sequence:
SELECT song_name from song where resolution  <  800
SELECT T1.artist_name ,  T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.resolution  < 800
SELECT T1.artist_name ,  T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.resolution  >  900 GROUP BY T2.artist_name HAVING count(*)  >=  1
Final question: Find the name and country of origin for all artists who have release at least one song of resolution above 900.
Final SQL: SELECT T1.artist_name ,  T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.resolution  >  900 GROUP BY T2.artist_name HAVING count(*)  >=  1
Database: music_1
Question sequence:
Order the artist names by the number of songs.
How about the names and the number of songs for the top one artist?
How about top three?
SQL query sequence:
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*)
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 1
SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
Final question: Find the names and number of works of the three artists who have produced the most songs.
Final SQL: SELECT T1.artist_name ,  count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
Database: music_1
Question sequence:
For each artist, count how many songs.
What is the country of origin for the artist who made the least number of songs?
SQL query sequence:
SELECT T1.artist_name, count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name group by T1.artist_name
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1
Final question: Find the country of origin for the artist who made the least number of songs?
Final SQL: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1
Database: music_1
Question sequence:
What are the minimum, maximum and average values of the ratings?
Which songs have a higher rating than the average, list the song names.
What about the names which rating is higher than the rating of all songs in English?
How about lower?
SQL query sequence:
SELECT min(rating), max(rating), avg(rating) FROM song
SELECT song_name FROM song WHERE rating  > (SELECT avg(rating) FROM song)
SELECT song_name FROM song WHERE rating  >  (SELECT min(rating) FROM song WHERE languages  =  'english')
SELECT song_name FROM song WHERE rating  <   (SELECT min(rating) FROM song WHERE languages  =  'english')
Final question: What are the names of the songs whose rating is below the rating of all songs in English?
Final SQL: SELECT song_name FROM song WHERE rating  <   (SELECT min(rating) FROM song WHERE languages  =  'english')
Database: music_1
Question sequence:
What are the minimum, maximum and average values of the ratings?
Which songs have a higher rating than the average, list the song ids.
What about the song ids whose resolution is higher than the resolution of any songs with rating lower than 8?
SQL query sequence:
SELECT min(rating), max(rating), avg(rating) FROM song
SELECT f_id FROM song WHERE rating  > (SELECT avg(rating) FROM song)
SELECT f_id FROM song WHERE resolution  >  (SELECT max(resolution) FROM song WHERE rating  <  8)
Final question: What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
Final SQL: SELECT f_id FROM song WHERE resolution  >  (SELECT max(resolution) FROM song WHERE rating  <  8)
Database: music_1
Question sequence:
What are the minimum, maximum and average values of the resolution?
Which songs have a higher value than the average, list the song ids.
How about the ones that is higher than the average resolution value for the modern genre songs?
SQL query sequence:
SELECT min(resolution), max(resolution), avg(resolution) FROM song
SELECT f_id FROM song WHERE resolution  > (SELECT avg(resolution) FROM song)
SELECT f_id FROM song WHERE resolution  >  (SELECT avg(resolution) FROM song WHERE genre_is  =  "modern")
Final question: What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
Final SQL: SELECT f_id FROM song WHERE resolution  >  (SELECT avg(resolution) FROM song WHERE genre_is  =  "modern")
Database: music_1
Question sequence:
For each artist, count how many songs.
Among those, only count the Bangla songs.
Which is the top one artist who has the most counts?
How about top 3?
SQL query sequence:
SELECT T1.artist_name, count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name GROUP BY T2.artist_name
SELECT T1.artist_name, count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "bangla" GROUP BY T2.artist_name
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "bangla" GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 1
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "bangla" GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
Final question: Find the top 3 artists who have the largest number of songs works whose language is Bangla.
Final SQL: SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name  =  T2.artist_name WHERE T2.languages  =  "bangla" GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
Database: music_1
Question sequence:
What is the average rating of the Bangla songs?
How about English songs?
How many of them in total?
What are the id, genre and artist name of these songs in the order of rating?
SQL query sequence:
SELECT avg(rating) FROM song WHERE languages = "bangla"
SELECT avg(rating) FROM song WHERE languages = "english"
SELECT count(*) FROM song WHERE languages = "english"
SELECT f_id ,  genre_is ,  artist_name FROM song WHERE languages  =   "english" ORDER BY rating
Final question: List the id, genre and artist name of English songs ordered by rating.
Final SQL: SELECT f_id ,  genre_is ,  artist_name FROM song WHERE languages  =   "english" ORDER BY rating
Database: music_1
Question sequence:
What is the average duration of the blues songs?
How about that of pop songs?
What about the duration, file size and format of those songs, order the results by title?
SQL query sequence:
SELECT avg(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id WHERE T2.genre_is  =  "blues"
SELECT avg(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id WHERE T2.genre_is  =  "pop"
SELECT T1.duration ,  T1.file_size ,  T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id WHERE T2.genre_is  =  "pop" ORDER BY T2.song_name
Final question: List the duration, file size and format of songs whose genre is pop, ordered by title?
Final SQL: SELECT T1.duration ,  T1.file_size ,  T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id WHERE T2.genre_is  =  "pop" ORDER BY T2.song_name
Database: music_1
Question sequence:
How many artists have Bangla songs?
How about English?
What are the names of them?
Which of them have never received rating higher than 8.
SQL query sequence:
SELECT count(DISTINCT artist_name) FROM song WHERE languages  = 'bangla'
SELECT count(DISTINCT artist_name) FROM song WHERE languages  = 'bangla'
SELECT artist_name FROM song WHERE languages  =  "english"
SELECT DISTINCT artist_name FROM song WHERE languages  =  "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating  >  8
Final question: Find the names of the artists who have produced English songs but have never received rating higher than 8.
Final SQL: SELECT DISTINCT artist_name FROM song WHERE languages  =  "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating  >  8
Database: machine_repair
Question sequence:
How many technicians are there?
Show me their names.
What about those that are either 36 or 37 years old?
SQL query sequence:
SELECT count(*) FROM technician
SELECT Name FROM technician
SELECT Name FROM technician WHERE Age  =  36 OR Age  =  37
Final question: Show the name of technicians aged either 36 or 37
Final SQL: SELECT Name FROM technician WHERE Age  =  36 OR Age  =  37
Database: machine_repair
Question sequence:
How many technicians are there?
Show me the name of the oldest one.
What about his starting year?
SQL query sequence:
SELECT count(*) FROM technician
SELECT Name FROM technician ORDER BY Age DESC LIMIT 1
SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1
Final question: What is the starting year of the oldest technicians?
Final SQL: SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1
Database: machine_repair
Question sequence:
How many technicians are there?
What about in terms of teams?
Show me the team with the most of them.
SQL query sequence:
SELECT count(*) FROM technician
SELECT Team, count(*) FROM technician GROUP BY Team
SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1
Final question: Please show the team that has the most number of technicians.
Final SQL: SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1
Database: machine_repair
Question sequence:
How many technicians are there?
What about in terms of teams?
Show me the teams that have at least two.
SQL query sequence:
SELECT count(*) FROM technician
SELECT Team, count(*) FROM technician GROUP BY Team
SELECT Team FROM technician GROUP BY Team HAVING COUNT(*)  >=  2
Final question: Show the team that have at least two technicians.
Final SQL: SELECT Team FROM technician GROUP BY Team HAVING COUNT(*)  >=  2
Database: machine_repair
Question sequence:
How many repair assignments are there in file?
Show me the name of technicians assigned to those repairs.
What about the series of machines they repaired?
SQL query sequence:
SELECT count(*) FROM repair_assignment
SELECT T2.Name FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID
SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
Final question: Show names of technicians and series of machines they are assigned to repair.
Final SQL: SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
Database: machine_repair
Question sequence:
How many repair assignments are there in file?
Show me the name of technicians assigned to those repairs.
What about the series of machines they repaired?
Show me those machines' quality ranks.
Show them in ascending order of quality rank.
Only show me the names.
SQL query sequence:
SELECT count(*) FROM repair_assignment
SELECT T2.Name FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID
SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
SELECT T3.Name ,  T2.Machine_series, T2.quality_rank FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
SELECT T3.Name ,  T2.Machine_series, T2.quality_rank FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID ORDER BY T2.quality_rank
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID ORDER BY T2.quality_rank
Final question: Show names of technicians in ascending order of quality rank of the machine they are assigned.
Final SQL: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID ORDER BY T2.quality_rank
Database: machine_repair
Question sequence:
How many repair assignments are there in file?
Show me the name of technicians assigned to those repairs.
What about the series of machines they repaired?
Show me those with machine's value points higher than 70.
Only show me the names.
SQL query sequence:
SELECT count(*) FROM repair_assignment
SELECT T2.Name FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID
SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
SELECT T3.Name, T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID WHERE T2.value_points  >  70
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID WHERE T2.value_points  >  70
Final question: Show names of technicians who are assigned to repair machines with value point more than 70.
Final SQL: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID WHERE T2.value_points  >  70
Database: machine_repair
Question sequence:
How many repair assignments are there in file?
What about in terms of technicians?
Show me their names instead of ids.
SQL query sequence:
SELECT count(*) FROM repair_assignment
SELECT technician_ID, count(*) FROM repair_assignment GROUP BY technician_ID
SELECT T2.Name ,  COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID GROUP BY T2.Name
Final question: Show names of technicians and the number of machines they are assigned to repair.
Final SQL: SELECT T2.Name ,  COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID GROUP BY T2.Name
Database: machine_repair
Question sequence:
How many repair assignments are there in file?
Show me their names.
What about the technicians in file who are not one of those?
Show me their names.
SQL query sequence:
SELECT count(*) FROM repair_assignment
SELECT technician_id FROM repair_assignment
SELECT technician_id FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment)
SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment)
Final question: List the names of technicians who have not been assigned to repair machines.
Final SQL: SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment)
Database: tracking_grants_for_research
Question sequence:
Show me the grant id for grants where the documents were sent before '1986-08-26 20:49:27'.
Which of those grant ended after '1989-03-16 18:27:16'? Show their id.
What are the distinct grant amount of these grants?
SQL query sequence:
SELECT T1.grant_id FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id WHERE T2.sent_date  <  '1986-08-26 20:49:27';
SELECT T1.grant_id FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id WHERE T2.sent_date  <  '1986-08-26 20:49:27' INTERSECT SELECT grant_id FROM grants WHERE grant_end_date  >  '1989-03-16 18:27:16'
SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id WHERE T2.sent_date  <  '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date  >  '1989-03-16 18:27:16';
Final question: What are the distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'?
Final SQL: SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id WHERE T2.sent_date  <  '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date  >  '1989-03-16 18:27:16';
Database: tracking_grants_for_research
Question sequence:
What are the project details of all projects?
Which ones of the result produced patent?
Among the current result, which ones also had paper outcome?
SQL query sequence:
SELECT project_details FROM Projects;
SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id WHERE T2.outcome_code  =  'Patent';
SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id WHERE T2.outcome_code  =  'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id WHERE T2.outcome_code  =  'Patent'
Final question: List the project details of the project both producing patent and paper as outcomes.
Final SQL: SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id WHERE T2.outcome_code  =  'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id WHERE T2.outcome_code  =  'Patent'
Database: tracking_grants_for_research
Question sequence:
Show me the grant amount of the organisations described as sponser?
How about the organisations described as research?
Show me the sum of the result.
SQL query sequence:
SELECT grant_amount FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type  =  T3.organisation_type WHERE T3.organisation_type_description  =  'Sponsor';
SELECT grant_amount FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type  =  T3.organisation_type WHERE T3.organisation_type_description  =  'Research';
SELECT sum(grant_amount) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type  =  T3.organisation_type WHERE T3.organisation_type_description  =  'Research';
Final question: What is the total grant amount of the organisations described as research?
Final SQL: SELECT sum(grant_amount) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type  =  T3.organisation_type WHERE T3.organisation_type_description  =  'Research';
Database: tracking_grants_for_research
Question sequence:
Which project hires the most staffs?
Who's the leader of this project? Show me the id.
What's his from-date and to-date of working?
SQL query sequence:
SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1;
SELECT staff_id FROM Project_Staff WHERE project_id IN( SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1 ) UNION SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  'leader';
SELECT date_from ,  date_to FROM Project_Staff WHERE project_id IN( SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1 ) UNION SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  'leader';
Final question: List from which date and to which date these staff work: project staff of the project which hires the most staffs
Final SQL: SELECT date_from ,  date_to FROM Project_Staff WHERE project_id IN( SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1 ) UNION SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  'leader';
Database: tracking_grants_for_research
Question sequence:
Show me the id of organizations involved in less then 3000$ grant amount.
How about those with a total of more than 6000$ grants?
List their description as well.
SQL query sequence:
SELECT T2.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount)  <  3000;
SELECT T2.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount)  >  6000;
SELECT T2.organisation_id ,  T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount)  >  6000;
Final question: Find the organisation ids and details of the organisations which are involved in more than 6000 grant amount.
Final SQL: SELECT T2.organisation_id ,  T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id  =  T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount)  >  6000;