context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Chemicals (Id INT, Name VARCHAR(50), Type VARCHAR(50), ManufacturingDate DATE); INSERT INTO Chemicals (Id, Name, Type, ManufacturingDate) VALUES (1, 'Acetone', 'Solvent', '2021-01-01'), (2, 'Ammonia', 'Gas', '2022-02-01'); | Identify chemicals not manufactured in 2022. | SELECT * FROM Chemicals WHERE YEAR(ManufacturingDate) != 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_waste_generation (state VARCHAR(20), year INT, material VARCHAR(20), quantity FLOAT); INSERT INTO state_waste_generation (state, year, material, quantity) VALUES ('California', 2021, 'Plastic', 1000000); INSERT INTO state_waste_generation (state, year, material, quantity) VALUES ('California', 2021, ... | What is the total waste generation by material type for the state of California for the year 2021?' | SELECT material, SUM(quantity) as total_quantity FROM state_waste_generation WHERE state = 'California' AND year = 2021 GROUP BY material; | gretelai_synthetic_text_to_sql |
CREATE TABLE asia_item_sales(item VARCHAR(20), location VARCHAR(20), quantity INT, sale_date DATE); INSERT INTO asia_item_sales (item, location, quantity, sale_date) VALUES ('Jeans', 'Asia', 200, '2022-10-01'); INSERT INTO asia_item_sales (item, location, quantity, sale_date) VALUES ('Shirt', 'Asia', 150, '2022-10-02')... | What is the total quantity of 'Jeans' items sold in 'Asia' in Q4 2022? | SELECT SUM(quantity) FROM asia_item_sales WHERE item = 'Jeans' AND location = 'Asia' AND sale_date BETWEEN '2022-10-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AnimalPopulation (AnimalID int, AnimalName varchar(50), Population int); INSERT INTO AnimalPopulation (AnimalID, AnimalName, Population) VALUES (1, 'Tiger', 2000), (2, 'Elephant', 500), (3, 'Giraffe', 1200); | What is the total number of animals in the 'AnimalPopulation' table grouped by 'AnimalName'? | SELECT AnimalName, SUM(Population) FROM AnimalPopulation GROUP BY AnimalName; | gretelai_synthetic_text_to_sql |
CREATE TABLE endangered_species(id INT, species VARCHAR(255), ocean VARCHAR(255), status VARCHAR(255));INSERT INTO endangered_species(id, species, ocean, status) VALUES (1, 'Dolphin', 'Atlantic', 'Endangered'), (2, 'Shark', 'Atlantic', 'Vulnerable'), (3, 'Tuna', 'Atlantic', 'Endangered'); | How many marine species are endangered in the Atlantic Ocean? | SELECT COUNT(*) FROM endangered_species WHERE ocean = 'Atlantic' AND status = 'Endangered'; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (author VARCHAR(50), article_genre VARCHAR(50), article_text TEXT); INSERT INTO articles (author, article_genre, article_text) VALUES ('John Doe', 'News', 'Article 1 text...'); INSERT INTO articles (author, article_genre, article_text) VALUES ('Jane Smith', 'Entertainment', 'Article 2 text...'); | What is the average word count for articles by author, grouped by genre? | SELECT author, article_genre, AVG(LENGTH(article_text) - LENGTH(REPLACE(article_text, ' ', '')) + 1) as avg_word_count FROM articles GROUP BY author, article_genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT, sector VARCHAR(20), year INT, amount INT); INSERT INTO waste_generation (id, sector, year, amount) VALUES (1, 'residential', 2010, 4000), (2, 'residential', 2011, 4500), (3, 'residential', 2012, 4700), (4, 'commercial', 2010, 6000), (5, 'commercial', 2011, 6500), (6, 'commercial',... | What is the average waste generation in the industrial sector for the first 3 years of the 2010s? | SELECT AVG(amount) FROM waste_generation WHERE sector = 'industrial' AND year BETWEEN 2010 AND 2012; | gretelai_synthetic_text_to_sql |
CREATE TABLE equity_metrics (county VARCHAR(20), score INT, workers INT); INSERT INTO equity_metrics (county, score, workers) VALUES ('Los Angeles', 65, 500), ('Miami-Dade', 70, 400), ('Bronx', 60, 450); CREATE TABLE national_averages (avg_score INT); INSERT INTO national_averages (avg_score) VALUES (62); | How many community health workers are employed in each county with health equity metrics above the national average? | SELECT county, SUM(workers) FROM equity_metrics WHERE score > (SELECT avg_score FROM national_averages) GROUP BY county; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, name VARCHAR(100), type VARCHAR(50), country VARCHAR(50)); INSERT INTO Infrastructure (id, name, type, country) VALUES (15, 'Autobahn A1', 'Highway', 'Germany'), (16, 'Autobahn A2', 'Highway', 'Germany'); | Show the highways in Germany | SELECT name FROM Infrastructure WHERE type = 'Highway' AND country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_finance (institution_id INT, institution_name TEXT, country TEXT, shariah_compliant BOOLEAN); INSERT INTO shariah_compliant_finance (institution_id, institution_name, country, shariah_compliant) VALUES (1, 'Banco Islamico', 'Brazil', TRUE), (2, 'Financiera Shariah', 'Argentina', FALSE), (... | List all financial institutions in South America offering Shariah-compliant finance. | SELECT institution_name FROM shariah_compliant_finance WHERE country IN ('South America') AND shariah_compliant = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contractors (contractor_id INT, contractor_name VARCHAR(255), contract_value FLOAT, country VARCHAR(255)); INSERT INTO defense_contractors (contractor_id, contractor_name, contract_value, country) VALUES (1, 'Lockheed Martin', 6000000, 'USA'), (2, 'Boeing', 5000000, 'USA'), (3, 'Raytheon', 4000000,... | What is the total contract value for the top 3 defense contractors in the USA? | SELECT SUM(contract_value) FROM (SELECT contract_value FROM defense_contractors WHERE country = 'USA' AND contractor_name IN ('Lockheed Martin', 'Boeing', 'Raytheon') ORDER BY contract_value DESC LIMIT 3); | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (id INT, name VARCHAR(50), data_usage FLOAT, city VARCHAR(50)); | What is the average monthly data usage for postpaid mobile customers in the city of Seattle? | SELECT AVG(data_usage) FROM mobile_subscribers WHERE city = 'Seattle' AND type = 'postpaid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryEquipmentSales (sale_id INT, equipment_type VARCHAR(50), quantity INT, sale_date DATE, seller_country VARCHAR(50)); INSERT INTO MilitaryEquipmentSales (sale_id, equipment_type, quantity, sale_date, seller_country) VALUES (1, 'Tank', 5, '2020-01-05', 'USA'), (2, 'Fighter Jet', 10, '2020-01-10', 'Fra... | What is the total number of military equipment sold by country in Q1 2020? | SELECT seller_country, SUM(quantity) as total_sold FROM MilitaryEquipmentSales WHERE sale_date BETWEEN '2020-01-01' AND '2020-03-31' GROUP BY seller_country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, FirstName varchar(50), LastName varchar(50), JobRole varchar(50), HireDate date); INSERT INTO Employees (EmployeeID, FirstName, LastName, JobRole, HireDate) VALUES (1, 'John', 'Doe', 'Software Engineer', '2020-01-01'); INSERT INTO Employees (EmployeeID, FirstName, LastName, JobRo... | What is the distribution of employees by job role and hire date, in descending order by hire date? | SELECT JobRole, HireDate, COUNT(*) as Count FROM Employees GROUP BY JobRole, HireDate ORDER BY HireDate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicHealthPolicy (ID INT, PolicyName TEXT, PolicyContent TEXT, State TEXT, EffectiveDate DATE); | insert a new record into the PublicHealthPolicy table | INSERT INTO PublicHealthPolicy (ID, PolicyName, PolicyContent, State, EffectiveDate) VALUES (1, 'Vaccine Mandate', 'All residents must be vaccinated...', 'CA', '2022-01-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE concert_sales (id INT, revenue DECIMAL); | Delete all concert records with a revenue less than 5000. | DELETE FROM concert_sales WHERE revenue < 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID INT, StartDate DATE, IsSustainable BOOLEAN, Cost DECIMAL(10,2)); INSERT INTO Projects (ProjectID, StartDate, IsSustainable, Cost) VALUES (1, '2016-01-01', true, 500000.00), (2, '2017-05-15', false, 350000.00), (3, '2018-12-30', true, 700000.00); | What is the average cost of sustainable building materials used in projects that started after 2015? | SELECT AVG(Cost) FROM Projects WHERE StartDate > '2015-12-31' AND IsSustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_agencies (id INT, name TEXT); INSERT INTO news_agencies VALUES (1, 'Acme News Agency'); INSERT INTO news_agencies VALUES (2, 'Global News'); CREATE TABLE articles (id INT, agency_id INT, location TEXT); INSERT INTO articles VALUES (1, 1, 'Africa'); INSERT INTO articles VALUES (2, 1, 'Asia'); INSERT ... | How many articles were published by 'Acme News Agency' in 'Africa' and 'Asia'? | SELECT COUNT(articles.id) FROM articles INNER JOIN news_agencies ON articles.agency_id = news_agencies.id WHERE news_agencies.name = 'Acme News Agency' AND articles.location IN ('Africa', 'Asia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai (initiative_id INT, initiative_name VARCHAR(50), sector VARCHAR(50), launch_year INT); INSERT INTO ethical_ai (initiative_id, initiative_name, sector, launch_year) VALUES (1, 'EthicalAI1', 'Technology', 2018), (2, 'EthicalAI2', 'Finance', 2019), (3, 'EthicalAI3', 'Healthcare', 2017); | What is the total number of ethical AI initiatives in the technology sector? | SELECT sector, COUNT(*) as count FROM ethical_ai WHERE sector = 'Technology' GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE all_categories (id INT, category VARCHAR(255), total_value DECIMAL(5,2), is_organic BOOLEAN); INSERT INTO all_categories (id, category, total_value, is_organic) VALUES (1, 'Grains', 273.50, true), (2, 'Proteins', 228.99, false), (3, 'Dairy Alternatives', 115.60, true), (4, 'Starchy Vegetables', 47.40, fals... | Which menu category has the highest inventory value for all items? | SELECT category, total_value FROM all_categories ORDER BY total_value DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, department VARCHAR(20), enrollment_status VARCHAR(10)); INSERT INTO graduate_students (id, department, enrollment_status) VALUES (1, 'Physics', 'Enrolled'), (2, 'Mathematics', 'Enrolled'), (3, 'Chemistry', 'Enrolled'), (4, 'English', 'Not Enrolled'); | Find the number of graduate students enrolled in each department, excluding those enrolled in the 'Physics' and 'Mathematics' departments. | SELECT department, COUNT(*) as enrollment_count FROM graduate_students WHERE department NOT IN ('Physics', 'Mathematics') GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE song_streams (song_id INT, artist_id INT, platform VARCHAR(50), stream_count INT); INSERT INTO song_streams (song_id, artist_id, platform, stream_count) VALUES (1, 1, 'Spotify', 1000000), (2, 2, 'Apple Music', 1200000); | _Find the artist with the second highest number of total streams on Spotify and Apple Music, while excluding artists without a genre._ | SELECT artist_id, stream_count FROM (SELECT artist_id, SUM(stream_count) AS stream_count FROM song_streams WHERE platform IN ('Spotify', 'Apple Music') GROUP BY artist_id ORDER BY stream_count DESC LIMIT 2) subquery WHERE artist_id != (SELECT artist_id FROM artists WHERE genre IS NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, country VARCHAR(255), name VARCHAR(255), capacity FLOAT); INSERT INTO wind_farms (id, country, name, capacity) VALUES (1, 'Germany', 'Windfarm A', 120.5); INSERT INTO wind_farms (id, country, name, capacity) VALUES (2, 'Germany', 'Windfarm B', 150.2); INSERT INTO wind_farms (id, country... | What is the total capacity of wind farms in Germany and France? | SELECT SUM(capacity) FROM wind_farms WHERE country IN ('Germany', 'France'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_tourism (id INT, country VARCHAR(50), initiative_name VARCHAR(100), start_date DATE, end_date DATE); | Insert a new record for a sustainable tourism initiative in Kenya. | INSERT INTO sustainable_tourism (id, country, initiative_name, start_date, end_date) VALUES (4, 'Kenya', 'Wildlife Conservation', '2023-01-01', '2024-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccinations (id INT, vaccine TEXT, date TEXT, location TEXT); INSERT INTO vaccinations (id, vaccine, date, location) VALUES (1, 'measles', '2021-01-01', 'New York'); INSERT INTO vaccinations (id, vaccine, date, location) VALUES (2, 'measles', '2021-01-02', 'New York'); | How many people have been vaccinated against measles in New York? | SELECT COUNT(*) FROM vaccinations WHERE vaccine = 'measles' AND location = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, Name TEXT, City TEXT); INSERT INTO Volunteers (VolunteerID, Name, City) VALUES (1, 'Alice', 'New York'), (2, 'Bob', 'Toronto'), (3, 'Charlie', 'Los Angeles'); | How many volunteers are there in each city? | SELECT City, COUNT(VolunteerID) FROM Volunteers GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_initiatives(region VARCHAR(20), year INT, initiative VARCHAR(50)); INSERT INTO conservation_initiatives VALUES ('California', 2016, 'Water rationing'), ('California', 2017, 'Mandatory water restrictions'), ('Nevada', 2018, 'Smart irrigation systems'), ('Nevada', 2019, 'Water-saving appliances'... | List the water conservation initiatives implemented in regions affected by severe droughts between 2016 and 2020, ordered by year. | SELECT * FROM conservation_initiatives WHERE year BETWEEN 2016 AND 2020 AND region IN ('California', 'Nevada', 'Arizona') ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE nba_games (player VARCHAR(255), games_played INTEGER, games_won INTEGER); | List the number of games played and won by each player in the "nba_games" table | SELECT player, SUM(games_played) as total_games_played, SUM(games_won) as total_games_won FROM nba_games GROUP BY player; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (id INT, initiative_name VARCHAR(50), country VARCHAR(50), year INT, funded BOOLEAN); INSERT INTO climate_communication (id, initiative_name, country, year, funded) VALUES (1, 'Climate Awareness Campaign', 'Palau', 2019, FALSE); | Which climate communication initiatives in the Pacific were not funded in 2019? | SELECT initiative_name FROM climate_communication WHERE country = 'Pacific' AND year = 2019 AND funded = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (name VARCHAR(255), birth_year INT, death_year INT); | Create a table named 'artists' with columns 'name', 'birth_year', and 'death_year' | CREATE TABLE artists (name VARCHAR(255), birth_year INT, death_year INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, gender TEXT, diagnosis TEXT, state TEXT); INSERT INTO patients (patient_id, age, gender, diagnosis, state) VALUES (1, 45, 'Female', 'Bipolar Disorder', 'New York'); INSERT INTO patients (patient_id, age, gender, diagnosis, state) VALUES (2, 35, 'Male', 'Depression', 'Cali... | What is the average age of patients diagnosed with bipolar disorder in New York? | SELECT AVG(age) FROM patients WHERE diagnosis = 'Bipolar Disorder' AND state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GenderDiversityOfficers (OfficerID INT, OfficerName VARCHAR(50), CaseID INT); INSERT INTO GenderDiversityOfficers (OfficerID, OfficerName, CaseID) VALUES (1, 'Alex Garcia', 20), (2, 'Jamie Lee', 30), (3, 'Taylor Chen', 25), (4, 'Jordan Thompson', 15); | What is the number of cases handled by each gender diversity officer, ordered by the total number of cases, descending? | SELECT OfficerName, COUNT(*) AS TotalCases FROM GenderDiversityOfficers GROUP BY OfficerName ORDER BY TotalCases DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE BrazilianRuralHospitals (State VARCHAR(20), HospitalName VARCHAR(50), NumberOfBeds INT); INSERT INTO BrazilianRuralHospitals (State, HospitalName, NumberOfBeds) VALUES ('State A', 'Hospital A', 50), ('State A', 'Hospital B', 75), ('State B', 'Hospital C', 100), ('State B', 'Hospital D', 125); | What is the minimum number of hospital beds in a rural hospital in Brazil? | SELECT MIN(NumberOfBeds) FROM BrazilianRuralHospitals WHERE State IN ('State A', 'State B') AND HospitalName IN ('Hospital A', 'Hospital B', 'Hospital C', 'Hospital D'); | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (site VARCHAR(50), year INT, co2_emissions DECIMAL(10,2)); | Present the total CO2 emissions for each year in the 'environmental_impact' table. | SELECT year, SUM(co2_emissions) FROM environmental_impact GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, region VARCHAR(255)); INSERT INTO mobile_subscribers (subscriber_id, region) VALUES (1, 'North'), (2, 'North'), (3, 'South'), (4, 'East'), (5, 'East'), (6, 'West'); | List regions with the highest mobile subscriber concentration, showing top 2 regions only. | SELECT region, COUNT(*) as subscriber_count, ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) as rank FROM mobile_subscribers GROUP BY region HAVING rank <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE asia_countries (country VARCHAR(50)); INSERT INTO asia_countries (country) VALUES ('Japan'), ('China'), ('India'), ('Malaysia'), ('Thailand'); CREATE TABLE tourist_visits (country VARCHAR(50), region VARCHAR(50), visitors INT); INSERT INTO tourist_visits (country, region, visitors) VALUES ('Japan', 'South ... | What is the total number of tourists visiting Asia from South America? | SELECT SUM(visitors) FROM tourist_visits WHERE country IN (SELECT country FROM asia_countries) AND region = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ganges_river_basin (usage FLOAT, timestamp TIMESTAMP); INSERT INTO ganges_river_basin (usage, timestamp) VALUES (2000000, '2022-01-01 10:00:00'), (2500000, '2022-02-01 10:00:00'); | What is the total water usage for industrial purposes in the Ganges river basin in the last quarter? | SELECT SUM(usage) FROM ganges_river_basin WHERE timestamp BETWEEN DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 MONTH) AND CURRENT_TIMESTAMP; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA RuralHealth; USE RuralHealth; CREATE TABLE Counties (CountyID INT, CountyName VARCHAR(50), CountyPopulation INT, StateAbbreviation VARCHAR(10)); CREATE TABLE DiabetesPatients (PatientID INT, CountyID INT, Diagnosed BOOLEAN); INSERT INTO Counties (CountyID, CountyName, CountyPopulation, StateAbbreviation) ... | What is the number of patients with diabetes per 100,000 people for each county, ordered from highest to lowest? | SELECT CountyID, (SUM(CASE WHEN Diagnosed THEN 1 ELSE 0 END) * 100000.0 / CountyPopulation) as DiabetesRatePer100k FROM DiabetesPatients INNER JOIN Counties ON DiabetesPatients.CountyID = Counties.CountyID INNER JOIN StatesPopulation ON Counties.StateAbbreviation = StatesPopulation.StateAbbreviation GROUP BY CountyID O... | gretelai_synthetic_text_to_sql |
CREATE TABLE Venues (VenueID INT, VenueName VARCHAR(255), Capacity INT); INSERT INTO Venues (VenueID, VenueName, Capacity) VALUES (1, 'VenueX', 5000), (2, 'VenueY', 7000), (3, 'VenueZ', 6000); CREATE TABLE Concerts (ConcertID INT, VenueID INT, GenreID INT, TicketPrice DECIMAL(5,2), Sold INT); INSERT INTO Concerts (Conc... | Display the total revenue from concert ticket sales for each venue. | SELECT V.VenueName, SUM(C.TicketPrice * C.Sold) as TotalRevenue FROM Venues V JOIN Concerts C ON V.VenueID = C.VenueID GROUP BY V.VenueName; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INT, name VARCHAR(50), type VARCHAR(50)); INSERT INTO vessels (vessel_id, name, type) VALUES (1, 'MV Ocean Wave', 'Container Ship'), (2, 'MS Ocean Breeze', 'Tanker'), (3, 'MV Ocean Tide', 'Tanker'); | How many vessels of type 'Tanker' are present in the 'vessels' table? | SELECT COUNT(*) FROM vessels WHERE type = 'Tanker'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artist_genre_revenue (artist VARCHAR(255), genre VARCHAR(255), revenue FLOAT); INSERT INTO artist_genre_revenue (artist, genre, revenue) VALUES ('Miles Davis', 'Jazz', 1000000), ('John Coltrane', 'Jazz', 1200000), ('Ella Fitzgerald', 'Jazz', 1500000), ('Louis Armstrong', 'Jazz', 1800000); | Who are the top 3 artists by total revenue in the Jazz genre? | SELECT artist, SUM(revenue) FROM artist_genre_revenue WHERE genre = 'Jazz' GROUP BY artist ORDER BY SUM(revenue) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE InvestmentRounds (id INT, founder_id INT, funding_amount INT); INSERT INTO InvestmentRounds VALUES (1, 2, 5000000); CREATE TABLE Founders (id INT, name TEXT, ethnicity TEXT, industry TEXT); INSERT INTO Founders VALUES (2, 'Grace', 'AAPI', 'Artificial Intelligence'); | What is the total funding amount received by AAPI founders in the Artificial Intelligence sector? | SELECT SUM(InvestmentRounds.funding_amount) FROM InvestmentRounds JOIN Founders ON InvestmentRounds.founder_id = Founders.id WHERE Founders.ethnicity = 'AAPI' AND Founders.industry = 'Artificial Intelligence'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, sector TEXT, ESG_rating FLOAT); INSERT INTO companies (id, sector, ESG_rating) VALUES (1, 'technology', 7.5), (2, 'finance', 8.2), (3, 'technology', 6.8), (4, 'finance', 6.9); | Delete companies with ESG rating below 7.0 | DELETE FROM companies WHERE ESG_rating < 7.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_amount DECIMAL, donation_date DATE); INSERT INTO donations (id, donation_amount, donation_date) VALUES (1, 100.00, '2022-01-01'), (2, 200.00, '2022-01-05'); | What is the total donation amount by day for the last week? | SELECT DATE(donation_date) as donation_day, SUM(donation_amount) as total_donations FROM donations WHERE donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) GROUP BY donation_day ORDER BY donation_day; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue(location VARCHAR(255), revenue INT); INSERT INTO restaurant_revenue(location, revenue) VALUES ('Location1', 5000), ('Location2', 7000), ('Location3', 3000), ('Restaurant4', 6000), ('Restaurant5', 4000), ('Restaurant7', 8000), ('Restaurant8', 9000); | What is the average revenue for restaurants in New York and Los Angeles? | SELECT AVG(revenue) FROM restaurant_revenue WHERE location LIKE '%New York%' OR location LIKE '%Los Angeles%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Peacekeeping_Operations (Operation_ID INT, Operation_Name VARCHAR(50), Start_Date DATE, Region VARCHAR(50)); INSERT INTO Peacekeeping_Operations (Operation_ID, Operation_Name, Start_Date, Region) VALUES (1, 'Operation Pacific Partnership', '2006-01-01', 'Indo-Pacific'); CREATE TABLE Defense_Diplomacy (Even... | What is the total number of peacekeeping operations and defense diplomacy events in the Indo-Pacific region? | SELECT SUM(CASE WHEN Table_Name = 'Peacekeeping_Operations' THEN 1 ELSE 0 END) as Total_Peacekeeping_Operations, SUM(CASE WHEN Table_Name = 'Defense_Diplomacy' THEN 1 ELSE 0 END) as Total_Defense_Diplomacy FROM (SELECT 'Peacekeeping_Operations' as Table_Name FROM Peacekeeping_Operations UNION ALL SELECT 'Defense_Diplom... | gretelai_synthetic_text_to_sql |
CREATE TABLE Mediators (MediatorId INT, MediatorName TEXT, TotalCases INT, SuccessfulMediations INT); INSERT INTO Mediators (MediatorId, MediatorName, TotalCases, SuccessfulMediations) VALUES (1, 'Mediator A', 30, 25), (2, 'Mediator B', 40, 35), (3, 'Mediator C', 50, 45), (4, 'Mediator D', 60, 50), (5, 'Mediator E', 70... | Who are the top 3 mediators by total cases mediated and the total number of successful mediations? | SELECT MediatorName, SUM(TotalCases) AS TotalCases, SUM(SuccessfulMediations) AS SuccessfulMediations FROM Mediators GROUP BY MediatorName ORDER BY TotalCases DESC, SuccessfulMediations DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleSafetyRatings (VehicleID INT, SafetyRating INT); CREATE TABLE GenevaAutoShow (VehicleID INT, ShowName TEXT); | What is the maximum safety rating achieved by vehicles at the Geneva Auto Show? | SELECT MAX(SafetyRating) FROM VehicleSafetyRatings JOIN GenevaAutoShow ON VehicleSafetyRatings.VehicleID = GenevaAutoShow.VehicleID; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_providers (id INT, state VARCHAR(10), count INT); INSERT INTO healthcare_providers (id, state, count) VALUES (1, 'State 1', 120), (2, 'State 2', 80), (3, 'State 3', 150), (4, 'State 4', 70), (5, 'State 5', 110); | List the number of healthcare providers in each state, for states with more than 100 providers. | SELECT state, count FROM healthcare_providers WHERE count > 100 GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (sale_id INT, event_id INT, quantity INT); CREATE TABLE events (event_id INT, name VARCHAR(255), city VARCHAR(255)); INSERT INTO events (event_id, name, city) VALUES (1, 'Football Game', 'Texas'), (2, 'Soccer Game', 'Texas'); INSERT INTO ticket_sales (sale_id, event_id, quantity) VALUES (1, 1,... | How many ticket sales have been made for football games in Texas? | SELECT COUNT(*) FROM ticket_sales ts JOIN events e ON ts.event_id = e.event_id WHERE e.name LIKE '%Football%' AND e.city = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE illegal_fishing_incidents (id INT, year INT, incidents INT, region VARCHAR(255)); INSERT INTO illegal_fishing_incidents (id, year, incidents, region) VALUES (1, 2015, 120, 'Arctic'); | What is the maximum number of reported incidents of illegal fishing activities in the Arctic Ocean in a single year? | SELECT MAX(incidents) FROM illegal_fishing_incidents WHERE region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (author_id INT, name VARCHAR(50), affiliation VARCHAR(100)); INSERT INTO authors (author_id, name, affiliation) VALUES (1, 'Alice', 'University of Oxford'); INSERT INTO authors (author_id, name, affiliation) VALUES (2, 'Bob', 'Google Research'); CREATE TABLE papers (paper_id INT, title VARCHAR(100)... | Get the names and affiliations of authors who have published papers in the Algorithmic Fairness category. | SELECT authors.name, authors.affiliation FROM authors INNER JOIN papers ON authors.author_id = papers.author_id WHERE papers.category = 'Algorithmic Fairness'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_fabric_2 (sale_id INT, sale_date DATE, fabric VARCHAR(20), revenue FLOAT); INSERT INTO sales_fabric_2 (sale_id, sale_date, fabric, revenue) VALUES (1, '2022-01-05', 'Organic Cotton', 2000), (2, '2022-02-10', 'Synthetic', 3500), (3, '2022-03-20', 'Organic Cotton', 4500), (4, '2022-01-15', 'Natural', 1... | What was the total revenue from the 'Organic Cotton' fabric type for the first quarter of 2022? | SELECT SUM(revenue) FROM sales_fabric_2 WHERE fabric = 'Organic Cotton' AND sale_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmployeeExperience(EmployeeID INT, Department VARCHAR(255), YearsOfExperience INT, Salary DECIMAL(10,2)); | What is the maximum salary of employees in the HR department who have more than 5 years of experience? | SELECT Department, MAX(Salary) FROM EmployeeExperience WHERE Department = 'HR' AND YearsOfExperience > 5 GROUP BY Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibitions (exhibition_id INT, name VARCHAR(255)); INSERT INTO exhibitions (exhibition_id, name) VALUES (1, 'Classical Art'), (2, 'Renaissance Art'), (3, 'Contemporary Art'); CREATE TABLE visitors (visitor_id INT, exhibition_id INT, age INT); INSERT INTO visitors (visitor_id, exhibition_id, age) VALUES (1... | What is the average age of visitors who attended the Contemporary Art exhibition? | SELECT AVG(age) as avg_age FROM visitors WHERE exhibition_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Reporters (ReporterID int, Name varchar(50), Age int, Gender varchar(10), Country varchar(50)); INSERT INTO Reporters (ReporterID, Name, Age, Gender, Country) VALUES (1, 'Reporter 1', 40, 'Male', 'USA'); INSERT INTO Reporters (ReporterID, Name, Age, Gender, Country) VALUES (2, 'Reporter 2', 45, 'Female', '... | What is the minimum age of reporters in each country and what is the total number of reporters in each country? | SELECT Country, MIN(Age) as MinAge, COUNT(*) as TotalReporters FROM Reporters GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Department (id INT, name VARCHAR(255)); INSERT INTO Department (id, name) VALUES (1, 'Computer Science'), (2, 'Physics'), (3, 'English'); CREATE TABLE Student (id INT, department_id INT, research_grant_funding INT); INSERT INTO Student (id, department_id, research_grant_funding) VALUES (1, 1, 50000), (2, 2... | List the number of graduate students in each department and their average research grant funding | SELECT d.name as department, AVG(s.research_grant_funding) as avg_funding, COUNT(s.id) as student_count FROM Department d JOIN Student s ON d.id = s.department_id GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment.investors (investor_id INT, name VARCHAR(50), age INT, occupation VARCHAR(50)); | Identify investors who own stocks and bonds. | SELECT i.name FROM investment.investments inv JOIN investment.investors i ON inv.investor_id = i.investor_id WHERE inv.investment_type IN ('stocks', 'bonds') GROUP BY i.name HAVING COUNT(DISTINCT inv.investment_type) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_fleet (country VARCHAR(20), vehicle_type VARCHAR(20), count INT); INSERT INTO transportation_fleet (country, vehicle_type, count) VALUES ('USA', 'electric_cars', 25000), ('USA', 'electric_buses', 5000), ('Brazil', 'electric_cars', 10000), ('Brazil', 'electric_buses', 2000); | What is the total number of electric vehicles in the transportation fleet for each country? | SELECT country, SUM(count) FROM transportation_fleet WHERE vehicle_type LIKE 'electric_%' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, name VARCHAR(50), region VARCHAR(50), built_year INT, efficiency FLOAT); INSERT INTO wind_farms (id, name, region, built_year, efficiency) VALUES (1, 'WindFarm1', 'NorthAmerica', 2012, 0.40), (2, 'WindFarm2', 'NorthAmerica', 2013, 0.45), (3, 'WindFarm3', 'NorthAmerica', 2016, 0.50); | What is the average energy efficiency (in %) of wind farms in 'NorthAmerica' that were built between '2010' and '2015'? | SELECT AVG(efficiency) FROM wind_farms WHERE region = 'NorthAmerica' AND built_year BETWEEN 2010 AND 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, age INT, state TEXT);CREATE TABLE treatments (id INT, patient_id INT, therapy TEXT);INSERT INTO patients (id, name, age, state) VALUES (1, 'Jamie Lee', 35, 'California'), (2, 'Jordan Lee', 40, 'California');INSERT INTO treatments (id, patient_id, therapy) VALUES (1, 1, 'Exposur... | What is the average age of patients who have been treated with exposure therapy in California? | SELECT AVG(patients.age) FROM patients INNER JOIN treatments ON patients.id = treatments.patient_id WHERE patients.state = 'California' AND treatments.therapy = 'Exposure Therapy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, user_id INT, donation_date DATE, donation_amount DECIMAL, refunded BOOLEAN); | Delete records of donations that have been refunded in the last week from the donations table | DELETE FROM donations WHERE refunded = true AND donation_date > DATE_SUB(CURDATE(), INTERVAL 1 WEEK); | gretelai_synthetic_text_to_sql |
CREATE TABLE CompanyTemperatureReadings(company VARCHAR(255), temperature FLOAT); INSERT INTO CompanyTemperatureReadings(company, temperature) VALUES('A', 23.5), ('A', 24.6), ('B', 25.7), ('B', 26.8), ('B', 27.9); | What is the total number of IoT sensors produced by companies A and B, and the average temperature reading from those sensors? | SELECT SUM(company = 'A' OR company = 'B') AS total_sensors, AVG(temperature) AS avg_temperature FROM CompanyTemperatureReadings WHERE company IN ('A', 'B'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fieldD (soil_moisture FLOAT, reading_date DATE); INSERT INTO fieldD (soil_moisture, reading_date) VALUES (55.3, '2021-07-01'), (60.9, '2021-07-02'); | Find the number of times the soil moisture level exceeded 50% in fieldD in July 2021. | SELECT COUNT(*) FROM (SELECT soil_moisture FROM fieldD WHERE EXTRACT(MONTH FROM reading_date) = 7 AND soil_moisture > 50) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, donation_amount DECIMAL, donation_date DATE, donation_program VARCHAR); INSERT INTO donations (id, donor_id, donation_amount, donation_date, donation_program) VALUES (1, 101, '500', '2021-01-01', 'Education'), (2, 102, '300', '2021-02-01', 'Environment'), (3, 101, '800', '2... | How many unique donors have there been for each program? | SELECT p.name as program_name, COUNT(DISTINCT d.donor_id) as num_unique_donors FROM donations d JOIN programs p ON d.donation_program = p.name GROUP BY p.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT, project_name VARCHAR(50), location VARCHAR(50), energy_source VARCHAR(50), capacity FLOAT); INSERT INTO renewable_energy (id, project_name, location, energy_source, capacity) VALUES (3, 'Wind Farm', 'Australia', 'Wind', 52.7); | Which renewable energy projects in Australia have a capacity of at least 50? | SELECT re.project_name, re.capacity FROM renewable_energy re WHERE re.location = 'Australia' AND re.capacity >= 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment (eq_id INT, eq_name VARCHAR(50), eq_type VARCHAR(50)); CREATE TABLE equipment_sales (eq_id INT, eq_type VARCHAR(50), sale_amount INT); | Delete obsolete equipment types with no sales data | DELETE FROM equipment WHERE eq_type NOT IN (SELECT eq_type FROM equipment_sales); | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, location VARCHAR(10), mental_health_score INT); INSERT INTO student_mental_health (student_id, location, mental_health_score) VALUES (1, 'Urban', 70), (2, 'Rural', 75), (3, 'Urban', 72), (4, 'Suburban', 68), (5, 'Rural', 78); | What is the average mental health score for students in rural areas? | SELECT location, AVG(mental_health_score) FROM student_mental_health WHERE location = 'Rural' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiplomacyEvents(Country1 NVARCHAR(50), Country2 NVARCHAR(50), EventType VARCHAR(50), Year INT);INSERT INTO DiplomacyEvents(Country1, Country2, EventType, Year) VALUES ('India', 'Pakistan', 'Defense Talks', 2015), ('Pakistan', 'India', 'Military Exercise', 2016), ('India', 'Pakistan', 'Joint Military Traini... | How many defense diplomacy events took place between India and Pakistan from 2015 to 2019? | SELECT COUNT(*) AS Total_Events FROM DiplomacyEvents WHERE (Country1 = 'India' AND Country2 = 'Pakistan') OR (Country1 = 'Pakistan' AND Country2 = 'India') AND Year BETWEEN 2015 AND 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (dish VARCHAR(255), vegetarian BOOLEAN); INSERT INTO menu (dish, vegetarian) VALUES ('Pizza', TRUE), ('Pasta', FALSE), ('Burger', FALSE), ('Salad', TRUE); | What is the percentage of vegetarian dishes in the menu? | SELECT (COUNT(vegetarian) FILTER (WHERE vegetarian = TRUE)) * 100.0 / COUNT(vegetarian) AS percentage FROM menu; | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_areas (id INT, city VARCHAR(50), population INT, water_consumption FLOAT, year INT, month INT); INSERT INTO urban_areas (id, city, population, water_consumption, year, month) VALUES (1, 'CityA', 50000, 12000000, 2020, 1), (2, 'CityA', 51000, 12200000, 2020, 2); | What is the average monthly water consumption per capita in urban areas for the last two years? | SELECT AVG(water_consumption / population) FROM (SELECT water_consumption, population, EXTRACT(YEAR FROM DATE '2000-01-01' + INTERVAL (month - 1) MONTH) AS year, EXTRACT(MONTH FROM DATE '2000-01-01' + INTERVAL (month - 1) MONTH) AS month FROM urban_areas WHERE city IN ('CityA', 'CityB', 'CityC') AND year IN (2020, 202... | gretelai_synthetic_text_to_sql |
CREATE TABLE LandfillCapacity (year INT, capacity INT); INSERT INTO LandfillCapacity (year, capacity) VALUES (2018, 10000), (2019, 11000), (2020, 11500), (2021, NULL), (2022, 12500); | What was the landfill capacity in megatons for 2021? | SELECT capacity FROM LandfillCapacity WHERE year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, location VARCHAR(50)); CREATE TABLE interactions (user_id INT, post_id INT, interaction_type VARCHAR(50), timestamp DATETIME); | How many users have their location set to "New York" and have interacted with posts related to mental health in the past month? | SELECT COUNT(DISTINCT users.id) FROM users JOIN interactions ON users.id = interactions.user_id WHERE users.location = 'New York' AND interactions.timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW() AND interactions.post_id IN (SELECT id FROM posts WHERE posts.content LIKE '%mental health%'); | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileSourcing (id INT, location VARCHAR(50), fabric_type VARCHAR(50), quantity INT); INSERT INTO TextileSourcing (id, location, fabric_type, quantity) VALUES (1, 'France', 'Organic Cotton', 500), (2, 'Italy', 'Tencel', 300), (3, 'Germany', 'Recycled Polyester', 400), (4, 'Spain', 'Hemp', 600), (5, 'UK', ... | What is the average quantity of sustainable fabrics sourced from Europe? | SELECT AVG(quantity) FROM TextileSourcing WHERE location IN ('France', 'Italy', 'Germany', 'Spain', 'UK') AND fabric_type IN ('Organic Cotton', 'Tencel', 'Recycled Polyester', 'Hemp', 'Bamboo'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor TEXT, program TEXT, amount FLOAT); INSERT INTO donations (id, donor, program, amount) VALUES (1, 'Donor A', 'Education', 500.00), (2, 'Donor B', 'Health', 1000.00), (3, 'Donor C', 'Environment', 750.00), (4, 'Donor D', 'Education', 250.00), (5, 'Donor A', 'Health', 750.00); | List the number of unique donors who have donated to each program category, excluding any duplicate records. | SELECT category, COUNT(DISTINCT donor) as unique_donors FROM (SELECT program, donor, CASE WHEN program IN ('Education', 'Arts Education') THEN 'Education' WHEN program IN ('Health Services', 'Mental Health Services') THEN 'Health' ELSE 'Environment' END as category FROM donations) donors GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_justice_projects (id INT, name TEXT, location TEXT); INSERT INTO food_justice_projects (id, name, location) VALUES (1, 'Project A', 'California'), (2, 'Project B', 'New York'), (3, 'Project C', 'California'); | Delete all food justice projects in 'California' from the 'food_justice_projects' table. | DELETE FROM food_justice_projects WHERE location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects(id INT, project_name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO defense_projects(id, project_name, start_date, end_date) VALUES (1, 'Project A', '2018-01-01', '2019-12-31'); INSERT INTO defense_projects(id, project_name, start_date, end_date) VALUES (2, 'Project B', '2020-01... | Identify defense projects that started before 2020 and have not been completed yet. | SELECT project_name FROM defense_projects WHERE start_date < '2020-01-01' AND end_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_health_indicators (indicator_id INT PRIMARY KEY, indicator_name VARCHAR(255)); CREATE TABLE farm_locations (location_id INT PRIMARY KEY, location_name VARCHAR(255), country VARCHAR(255), ocean VARCHAR(255)); CREATE TABLE ocean_health_metrics (metric_id INT PRIMARY KEY, location_id INT, indicator_id I... | Insert a record for pH level metric in the Mediterranean Sea near Egypt in 2020 | INSERT INTO ocean_health_metrics (metric_id, location_id, indicator_id, year, value) VALUES (1, 2, 1, 2020, 8.2); | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier (id INT PRIMARY KEY, company_name VARCHAR(100), country VARCHAR(50), sustainability_score INT); INSERT INTO supplier (id, company_name, country, sustainability_score) VALUES (1, 'Green Textiles Inc.', 'USA', 85), (2, 'Sustainable Fabrics Pvt Ltd.', 'India', 82); | Which suppliers have a sustainability score greater than 80 and are located in 'India'? | SELECT company_name, sustainability_score FROM supplier WHERE country = 'India' AND sustainability_score > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, customer_name VARCHAR(50), ethical_supplier BOOLEAN); INSERT INTO customers (customer_id, customer_name, ethical_supplier) VALUES (1, 'Customer A', TRUE), (2, 'Customer B', FALSE), (3, 'Customer C', TRUE), (4, 'Customer D', FALSE), (5, 'Customer E', TRUE); CREATE TABLE purchases... | Identify the top 5 customers who have made the most purchases from ethical suppliers. | SELECT c.customer_name, COUNT(p.customer_id) AS total_purchases FROM purchases p JOIN customers c ON p.customer_id = c.customer_id WHERE c.ethical_supplier = TRUE GROUP BY c.customer_name ORDER BY total_purchases DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE retail_union (employee_id INT, department VARCHAR(20), salary DECIMAL(10,2)); INSERT INTO retail_union (employee_id, department, salary) VALUES (1, 'Retail', 25000.00), (2, 'Retail', 26000.00), (3, 'Retail', 27000.00); | What is the maximum salary in the 'retail_union' table? | SELECT MAX(salary) FROM retail_union; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name VARCHAR(50), country VARCHAR(50), stars INT, is_eco_friendly BOOLEAN); | Insert a new record into the hotels table for an eco-friendly hotel in Bali with a 4.5-star rating and a unique ID of 123. | INSERT INTO hotels (hotel_id, name, country, stars, is_eco_friendly) VALUES (123, 'Eco Bali Retreat', 'Bali', 4, TRUE); | gretelai_synthetic_text_to_sql |
CREATE TABLE mlb_history (player VARCHAR(100), team VARCHAR(100), home_runs INT); INSERT INTO mlb_history (player, team, home_runs) VALUES ('Hank Aaron', 'Atlanta Braves', 755), ('Barry Bonds', 'San Francisco Giants', 762); | Who has the highest number of home runs in MLB history? | SELECT player, MAX(home_runs) FROM mlb_history; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT, project_name TEXT, location TEXT, installed_capacity FLOAT); INSERT INTO renewable_energy (id, project_name, location, installed_capacity) VALUES (1, 'Wind Farm 1', 'USA', 50.5), (2, 'Wind Farm 2', 'Germany', 60.3), (3, 'Wind Farm 3', 'Denmark', 40.9); | What is the minimum installed capacity for a wind project in the 'renewable_energy' table? | SELECT MIN(installed_capacity) FROM renewable_energy WHERE project_name LIKE '%wind%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE YogaHeartRate (MemberID INT, YogaHeartRate INT); CREATE TABLE CyclingHeartRate (MemberID INT, CyclingHeartRate INT); INSERT INTO YogaHeartRate (MemberID, YogaHeartRate) VALUES (1, 60); INSERT INTO CyclingHeartRate (MemberID, CyclingHeartRate) VALUES (1, 55); | Find the number of members who have a higher heart rate during yoga than cycling. | SELECT COUNT(*) FROM YogaHeartRate y JOIN CyclingHeartRate c ON y.MemberID = c.MemberID WHERE y.YogaHeartRate > c.CyclingHeartRate; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT, project_name VARCHAR(50), sensors VARCHAR(50)); INSERT INTO genetic_research (id, project_name, sensors) VALUES (1, 'Genome Mapping', 'SensAbio Sensor A'); INSERT INTO genetic_research (id, project_name, sensors) VALUES (2, 'Protein Folding', 'SensAbio Sensor B'); | Which genetic research projects have sensors developed by SensAbio? | SELECT project_name FROM genetic_research WHERE sensors LIKE '%SensAbio%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_data (year INT, element VARCHAR(10), quantity INT); INSERT INTO production_data (year, element, quantity) VALUES (2018, 'Terbium', 7), (2019, 'Terbium', 8), (2020, 'Terbium', 9), (2021, 'Terbium', 10); | What is the minimum production of Terbium in a single year? | SELECT MIN(quantity) FROM production_data WHERE element = 'Terbium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT PRIMARY KEY, created_date DATE); | Find the number of new customers per quarter for the past two years | SELECT DATE_FORMAT(created_date, '%Y-%m') AS quarter, COUNT(DISTINCT customer_id) FROM customers WHERE created_date >= DATE_SUB(NOW(), INTERVAL 2 YEAR) GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); INSERT INTO employees (id, name, gender, department) VALUES (1, 'John Doe', 'Male', 'IT'), (2, 'Jane Smith', 'Female', 'IT'), (3, 'Alice Johnson', 'Female', 'Marketing'); | How many female employees are there in the IT department? | SELECT COUNT(*) FROM employees WHERE gender = 'Female' AND department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildings (id INT, name TEXT, owner TEXT, energy_consumption FLOAT); INSERT INTO GreenBuildings (id, name, owner, energy_consumption) VALUES (1, 'EcoTower', 'ACME Inc', 1500.0), (2, 'GreenSpire', 'GreenCorp', 1200.0), (3, 'GreenVista', 'EcoSolutions', 1300.0), (4, 'GreenPlaza', 'GreenTech', 1000.0); | What is the average energy consumption for buildings owned by 'EcoSolutions' and 'GreenTech'? | SELECT AVG(energy_consumption) FROM GreenBuildings WHERE owner IN ('EcoSolutions', 'GreenTech'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount DECIMAL(10,2), donation_date DATE, country TEXT); INSERT INTO donors (donor_id, donor_name, donation_amount, donation_date, country) VALUES (1, 'John Doe', 500, '2021-01-01', 'USA'), (2, 'Jane Smith', 300, '2021-02-03', 'Canada'); | What is the total amount donated by individuals in the US and Canada in 2021? | SELECT SUM(donation_amount) FROM donors WHERE donation_date BETWEEN '2021-01-01' AND '2021-12-31' AND country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE retail (id INT, employee_name TEXT, hours_worked INT, salary REAL); INSERT INTO retail (id, employee_name, hours_worked, salary) VALUES (1, 'David White', 40, 40000.00), (2, 'Eve Black', 40, 42000.00), (3, 'Frank Red', 40, 45000.00); | What is the maximum salary in the 'retail' industry? | SELECT MAX(salary) FROM retail WHERE industry = 'retail'; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, animal_species VARCHAR(50), population INT); INSERT INTO animal_population (id, animal_species, population) VALUES (1, 'Tiger', 2000), (2, 'Elephant', 5000), (3, 'Giraffe', 8000), (4, 'Tiger', 3000); | Determine the animal species with the highest population | SELECT animal_species, MAX(population) FROM animal_population GROUP BY animal_species; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_emergency_calls (date DATE, neighborhood VARCHAR(20), calls INT); INSERT INTO monthly_emergency_calls (date, neighborhood, calls) VALUES ('2022-01-01', 'northwest', 50), ('2022-02-01', 'northwest', 60), ('2022-01-02', 'northwest', 55), ('2022-02-02', 'northwest', 65); | What is the total number of emergency calls received in the "northwest" neighborhood in the months of January and February? | SELECT SUM(calls) FROM monthly_emergency_calls WHERE neighborhood = 'northwest' AND EXTRACT(MONTH FROM date) IN (1, 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE FashionTrends (id INT, trend VARCHAR(255), country VARCHAR(255), popularity INT); INSERT INTO FashionTrends (id, trend, country, popularity) VALUES (1, 'Sustainable Denim', 'USA', 10000), (2, 'Vintage Dresses', 'Canada', 8000), (3, 'Minimalist Shoes', 'France', 9000); CREATE TABLE CustomerSizes (id INT, si... | What is the customer size distribution for fashion trends in the US and Canada? | SELECT ft.trend, c.country, SUM(c.percentage) AS size_percentage FROM FashionTrends ft INNER JOIN CustomerSizes c ON ft.country = c.country WHERE ft.country IN ('USA', 'Canada') GROUP BY ft.trend, c.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnvironmentalImpact (ChemicalID INT, CO2Emissions INT, CH4Emissions INT, N2OEmissions INT); INSERT INTO EnvironmentalImpact (ChemicalID, CO2Emissions, CH4Emissions, N2OEmissions) VALUES (1, 100, 20, 30), (2, 150, 30, 40), (3, 50, 10, 20); CREATE TABLE ProductionBatches (BatchID INT, ChemicalID INT, Product... | What are the total greenhouse gas emissions for each chemical produced in the EU? | SELECT ChemicalID, CO2Emissions + CH4Emissions + N2OEmissions AS TotalEmissions FROM EnvironmentalImpact INNER JOIN ProductionBatches ON EnvironmentalImpact.ChemicalID = ProductionBatches.ChemicalID WHERE Country = 'EU'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Atlantic_Ocean (temperature FLOAT, month DATE); INSERT INTO Atlantic_Ocean (temperature, month) VALUES (10.5, '2022-03-01'); INSERT INTO Atlantic_Ocean (temperature, month) VALUES (11.2, '2022-03-15'); CREATE TABLE Salmon_Farms (id INT, ocean VARCHAR(10)); INSERT INTO Salmon_Farms (id, ocean) VALUES (1, 'A... | What is the average water temperature in the Atlantic Ocean for salmon farms in March? | SELECT AVG(temperature) FROM Atlantic_Ocean INNER JOIN Salmon_Farms ON Atlantic_Ocean.month = '2022-03-01' WHERE Salmon_Farms.ocean = 'Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameReleases (GameID INT, Name VARCHAR(20), ReleaseDate DATE, Platform VARCHAR(10)); INSERT INTO GameReleases (GameID, Name, ReleaseDate, Platform) VALUES (1, 'Game1', '2018-01-01', 'Console'), (2, 'Game2', '2016-03-01', 'PC'), (3, 'Game3', '2016-10-01', 'Console'), (4, 'Game4', '2015-11-20', 'PC'); | Which virtual reality headsets were released in the same year as any console game release? | SELECT VRHeadsets.Name FROM VRHeadsets, GameReleases WHERE EXTRACT(YEAR FROM VRHeadsets.ReleaseDate) = EXTRACT(YEAR FROM GameReleases.ReleaseDate) AND GameReleases.Platform = 'Console'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (id INT, brand_id INT, name VARCHAR(255), price DECIMAL(5,2), is_natural BOOLEAN); INSERT INTO Products (id, brand_id, name, price, is_natural) VALUES (1, 1, 'Soap', 12.99, true), (2, 1, 'Shower Gel', 25.99, true); | Which natural product has the highest price? | SELECT name as most_expensive_natural_product, price as price FROM Products WHERE is_natural = true AND price = (SELECT MAX(price) FROM Products WHERE is_natural = true); | gretelai_synthetic_text_to_sql |
CREATE TABLE supplies (id INT, name TEXT, quantity INT, category TEXT, expiration_date DATE); INSERT INTO supplies (id, name, quantity, category, expiration_date) VALUES (1, 'Water', 500, 'Essential', '2023-05-01'); INSERT INTO supplies (id, name, quantity, category, expiration_date) VALUES (2, 'Tents', 100, 'Shelter',... | How many supplies are there per category? | SELECT category, COUNT(*) as supply_count FROM supplies GROUP BY category; | gretelai_synthetic_text_to_sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.