context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE if not exists metro_lines (line_id serial primary key,name varchar(255));CREATE TABLE if not exists metro_stations (station_id serial primary key,name varchar(255),line_id int,wheelchair_accessible boolean); | How many wheelchair accessible vehicles are there in the Paris metro system? | SELECT COUNT(*) FROM metro_stations WHERE wheelchair_accessible = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Schools (State VARCHAR(255), Sector VARCHAR(255), Population INT, Density DECIMAL(18,2), Schools INT); INSERT INTO Schools (State, Sector, Population, Density, Schools) VALUES ('CA', 'Government', 40000000, 250, 10000), ('TX', 'Government', 30000000, 100, 12000), ('FL', 'Government', 22000000, 350, 9000); | Show the number of schools in the government sector for each state with a population density greater than 100 people per square mile. | SELECT State, SUM(Schools) FROM Schools WHERE Sector = 'Government' AND Density > 100 GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE Renewable_Energy_Projects (project_id INT, project_name VARCHAR(50), total_cost FLOAT, energy_type VARCHAR(50)); | Find the total cost of all hydroelectric power projects in the Renewable_Energy_Projects table | SELECT SUM(total_cost) FROM Renewable_Energy_Projects WHERE energy_type = 'Hydroelectric'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiversityInJustice (JusticeID INT, Ethnicity VARCHAR(30)); CREATE TABLE JusticeCases (CaseID INT, JusticeID INT, Date DATE, CaseDuration INT); INSERT INTO DiversityInJustice (JusticeID, Ethnicity) VALUES (1, 'African American'), (2, 'Hispanic'), (3, 'Asian'), (4, 'Caucasian'); INSERT INTO JusticeCases (Cas... | Find the average CaseDuration for each Ethnicity in the DiversityInJustice table. | SELECT Ethnicity, AVG(CaseDuration) as AverageCaseDuration FROM JusticeCases JOIN DiversityInJustice ON JusticeCases.JusticeID = DiversityInJustice.JusticeID GROUP BY Ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS cargo (id INT PRIMARY KEY, vessel_name VARCHAR(255), average_speed DECIMAL(5,2)); CREATE TABLE IF NOT EXISTS vessel_safety (id INT PRIMARY KEY, vessel_name VARCHAR(255), safety_inspection_date DATE); | Create a view named 'vessel_summary' that contains the vessel_name, average_speed and safety_inspection_date | CREATE VIEW vessel_summary AS SELECT cargo.vessel_name, cargo.average_speed, vessel_safety.safety_inspection_date FROM cargo INNER JOIN vessel_safety ON cargo.vessel_name = vessel_safety.vessel_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, founder_gender TEXT); INSERT INTO company (id, name, industry, founder_gender) VALUES (1, 'MedHealth', 'Healthcare', 'Female'); INSERT INTO company (id, name, industry, founder_gender) VALUES (2, 'TechBio', 'Biotechnology', 'Male'); | What is the average funding amount received by startups founded by women in the healthcare industry? | SELECT AVG(funding_amount) FROM funding INNER JOIN company ON funding.company_id = company.id WHERE company.founder_gender = 'Female' AND company.industry = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Art (ArtID INT, Type VARCHAR(255), Region VARCHAR(255), Quantity INT); INSERT INTO Art (ArtID, Type, Region, Quantity) VALUES (1, 'Painting', 'Asia', 25), (2, 'Sculpture', 'Africa', 18), (3, 'Textile', 'South America', 30), (4, 'Pottery', 'Europe', 20), (5, 'Jewelry', 'North America', 12); | What is the average quantity of traditional art pieces by region? | SELECT Region, AVG(Quantity) as Average_Quantity FROM Art GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name TEXT, birth_year INT, death_year INT, country TEXT); INSERT INTO artists (id, name, birth_year, death_year, country) VALUES (1, 'Artist 1', 1890, 1970, 'Spain'); CREATE TABLE artworks (id INT, title TEXT, year_created INT, artist_id INT); INSERT INTO artworks (id, title, year_created,... | Which artworks were created in the 1920s by artists from Spain? | SELECT a.title FROM artworks a INNER JOIN artists ar ON a.artist_id = ar.id WHERE ar.country = 'Spain' AND a.year_created BETWEEN 1920 AND 1929; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing_plants (id INT, name VARCHAR(50));CREATE TABLE waste_generation (plant_id INT, date DATE, amount INT); INSERT INTO manufacturing_plants (id, name) VALUES (1, 'Plant A'), (2, 'Plant B'); INSERT INTO waste_generation (plant_id, date, amount) VALUES (1, '2022-01-01', 100), (1, '2022-01-15', 150)... | What is the total amount of waste generated by each manufacturing plant in the month of January 2022? | SELECT m.name, SUM(w.amount) FROM manufacturing_plants m INNER JOIN waste_generation w ON m.id = w.plant_id WHERE w.date >= '2022-01-01' AND w.date <= '2022-01-31' GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (id INT, investment FLOAT, year INT, technology VARCHAR(10), region VARCHAR(15)); INSERT INTO network_investments (id, investment, year, technology, region) VALUES (1, 750000, 2019, '5G', 'North America'); INSERT INTO network_investments (id, investment, year, technology, region) VALUES... | What is the total number of 5G network infrastructure investments for the 'North America' region in the last 3 years? | SELECT SUM(investment) FROM network_investments WHERE technology = '5G' AND region = 'North America' AND year BETWEEN 2019 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Operations (OperationID INT, Phase VARCHAR(50), StartDate DATE, EndDate DATE); INSERT INTO Operations (OperationID, Phase, StartDate, EndDate) VALUES (1, 'Exploration', '2020-01-01', '2020-12-31'); INSERT INTO Operations (OperationID, Phase, StartDate, EndDate) VALUES (2, 'Extraction', '2019-01-01', '2019-... | How many environmental incidents have been reported in the 'Exploration' phase of operations in the year 2020? | SELECT COUNT(*) FROM Incidents INNER JOIN Operations ON Incidents.OperationID = Operations.OperationID WHERE Operations.Phase = 'Exploration' AND YEAR(Incidents.IncidentDate) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (country_code CHAR(2), country_name VARCHAR(100)); INSERT INTO country (country_code, country_name) VALUES ('CA', 'Canada'); CREATE TABLE clinical_trial (drug_code CHAR(5), trial_outcome VARCHAR(100), country_code CHAR(2)); INSERT INTO clinical_trial (drug_code, trial_outcome, country_code) VALUES ... | How many clinical trials were successful in Canada? | SELECT COUNT(*) FROM clinical_trial WHERE trial_outcome = 'Success' AND country_code = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (id INT, name VARCHAR(50)); INSERT INTO Countries (id, name) VALUES (1, 'Brazil'); CREATE TABLE Hotels (id INT, country VARCHAR(50), hotel_type VARCHAR(50), rating INT); INSERT INTO Hotels (id, country, hotel_type, rating) VALUES (1, 'Brazil', 'Eco-Friendly', 4), (2, 'Brazil', 'Eco-Friendly', 5),... | What is the average rating of eco-friendly hotels in Brazil? | SELECT AVG(h.rating) as avg_rating FROM Hotels h WHERE h.country = 'Brazil' AND h.hotel_type = 'Eco-Friendly'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name VARCHAR(50), total_cargo INT); INSERT INTO ports VALUES (1, 'Port of Shanghai', 43032442); INSERT INTO ports VALUES (2, 'Port of Singapore', 37439402); INSERT INTO ports VALUES (3, 'Port of Shenzhen', 27162000); | Who is the top-performing port in terms of cargo handling? | SELECT port_name, ROW_NUMBER() OVER (ORDER BY total_cargo DESC) as rank FROM ports WHERE row_number() = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Airports (Name VARCHAR(255), Daily_passengers INT, State VARCHAR(255)); INSERT INTO Airports (Name, Daily_passengers, State) VALUES ('Orlando International Airport', 12000, 'Florida'); | List the airports in Florida with over 10,000 passengers per day. | SELECT Name FROM Airports WHERE Daily_passengers > 10000 AND State = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fashion_trend (id INT, product_id INT, trend VARCHAR(255), popularity INT); INSERT INTO fashion_trend (id, product_id, trend, popularity) VALUES (1, 101, 'Vintage', 1000), (2, 102, 'Minimalist', 800), (3, 103, 'Bohemian', 1200), (4, 101, 'Vintage', 1100), (5, 102, 'Minimalist', 900); | What is the trend rank for each product based on its popularity? | SELECT product_id, trend, RANK() OVER (PARTITION BY trend ORDER BY popularity DESC) as trend_rank FROM fashion_trend; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, game_name TEXT, release_year INT); INSERT INTO games (game_id, game_name, release_year) VALUES (1, 'Game A', 2018), (2, 'Game B', 2019), (3, 'Game C', 2018), (4, 'Game D', 2019), (5, 'Game E', 2020), (6, 'Game F', 2017); | What is the release year with the highest number of games released? | SELECT release_year, COUNT(*) as num_games FROM games GROUP BY release_year ORDER BY num_games DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (did INT, name VARCHAR(255)); CREATE TABLE police_officers (oid INT, did INT, rank VARCHAR(255)); CREATE TABLE firefighters (fid INT, did INT, rank VARCHAR(255)); INSERT INTO districts VALUES (1, 'Downtown'), (2, 'Uptown'); INSERT INTO police_officers VALUES (1, 1, 'Captain'), (2, 2, 'Lieutenant'... | What is the total number of police officers and firefighters in each city district? | SELECT d.name, COUNT(po.oid) + COUNT(f.fid) as total_employees FROM districts d LEFT JOIN police_officers po ON d.did = po.did LEFT JOIN firefighters f ON d.did = f.did GROUP BY d.did; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_innovations (id INT, project_name TEXT, region TEXT, funding_amount FLOAT); INSERT INTO rural_innovations (id, project_name, region, funding_amount) VALUES (1, 'Precision Agri', 'Midwest', 50000.00), (2, 'Solar Irrigation', 'Southwest', 75000.00), (3, 'Vertical Farming', 'Northeast', 60000.00), (4, '... | What are the names and locations of the top 3 agricultural innovation projects in the 'rural_innovations' table, based on funding_amount? | SELECT project_name, region FROM (SELECT project_name, region, funding_amount, ROW_NUMBER() OVER (ORDER BY funding_amount DESC) as rn FROM rural_innovations) t WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE strain_revenue (id INT, strain_name VARCHAR(255), dispensary_name VARCHAR(255), state VARCHAR(255), revenue DECIMAL(10, 2), sale_date DATE); | List the total revenue for each strain sold in California in Q3 of 2022? | SELECT strain_name, SUM(revenue) FROM strain_revenue WHERE state = 'California' AND sale_date BETWEEN '2022-07-01' AND '2022-09-30' GROUP BY strain_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE psychodynamic_therapy (psychodynamic_therapy_id INT, patient_id INT, country VARCHAR(50), duration_weeks INT); INSERT INTO psychodynamic_therapy (psychodynamic_therapy_id, patient_id, country, duration_weeks) VALUES (1, 45, 'Brazil', 12), (2, 46, 'Brazil', 10), (3, 47, 'Brazil', 14); | What is the average duration (in weeks) of psychodynamic therapy for patients in Brazil? | SELECT AVG(duration_weeks) FROM psychodynamic_therapy WHERE country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (year INT, region VARCHAR(255), purpose VARCHAR(255), amount FLOAT); INSERT INTO climate_finance (year, region, purpose, amount) VALUES (2021, 'South Asia', 'climate mitigation', 12000000); INSERT INTO climate_finance (year, region, purpose, amount) VALUES (2021, 'South Asia', 'climate adap... | What is the total amount of climate finance provided for climate mitigation and climate adaptation in South Asia in the year 2021? | SELECT SUM(amount) FROM climate_finance WHERE year = 2021 AND (region = 'South Asia' AND purpose IN ('climate mitigation', 'climate adaptation')); | gretelai_synthetic_text_to_sql |
CREATE TABLE projects_cost_by_quarter (id INT, project_name VARCHAR(255), completion_quarter INT, completion_year INT, total_cost FLOAT); INSERT INTO projects_cost_by_quarter (id, project_name, completion_quarter, completion_year, total_cost) VALUES (1, 'Highway Expansion', 3, 2021, 300000.00), (2, 'Water Treatment Pla... | What is the total cost of public works projects completed in each quarter of the last 2 years? | SELECT completion_quarter, completion_year, SUM(total_cost) as total_cost FROM projects_cost_by_quarter WHERE completion_year >= YEAR(DATEADD(year, -2, GETDATE())) GROUP BY completion_quarter, completion_year; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA membership; CREATE TABLE membership_types (user_id INT, country VARCHAR(50), membership_type VARCHAR(50)); INSERT INTO membership_types VALUES (1, 'USA', 'Premium'), (2, 'Canada', 'Basic'), (3, 'USA', 'Premium'); | How many users from the USA have 'Premium' memberships?' | SELECT COUNT(DISTINCT user_id) FROM membership.membership_types WHERE country = 'USA' AND membership_type = 'Premium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (PatientID INT, Age INT, Gender VARCHAR(10), Diagnosis VARCHAR(20)); INSERT INTO Patients (PatientID, Age, Gender, Diagnosis) VALUES (1, 34, 'Male', 'Influenza'); INSERT INTO Patients (PatientID, Age, Gender, Diagnosis) VALUES (2, 42, 'Female', 'Pneumonia'); | What is the average age of patients who have been diagnosed with influenza in the past year? | SELECT AVG(Age) FROM Patients WHERE Diagnosis = 'Influenza' AND YEAR(STR_TO_DATE(Date, '%m/%d/%Y')) = YEAR(CURDATE()) - 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (id INT, title TEXT, release_year INT, genre TEXT); INSERT INTO songs (id, title, release_year, genre) VALUES (1, 'Song1', 2020, 'Pop'); INSERT INTO songs (id, title, release_year, genre) VALUES (2, 'Song2', 2021, 'Rock'); INSERT INTO songs (id, title, release_year, genre) VALUES (3, 'Song3', 2019, '... | Find the number of unique genres for songs released in 2020. | SELECT COUNT(DISTINCT genre) AS unique_genres FROM songs WHERE release_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (id INT, name VARCHAR(255)); INSERT INTO menu_items (id, name) VALUES (1, 'Burger'), (2, 'Pizza'), (3, 'Pasta'), (4, 'Salad'), (5, 'Tofu Scramble'); CREATE TABLE restaurant_menu (menu_item_id INT, restaurant_id INT); INSERT INTO restaurant_menu (menu_item_id, restaurant_id) VALUES (1, 1), (1, 2)... | List menu items that are not available in any restaurant | SELECT mi.name FROM menu_items mi LEFT JOIN restaurant_menu rm ON mi.id = rm.menu_item_id WHERE rm.restaurant_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGames (PlayerID INT, GameID INT); INSERT INTO PlayerGames (PlayerID, GameID) VALUES (1, 1), (2, 1), (3, 2), (4, 2), (5, 3), (6, 4), (7, 5); CREATE TABLE GameDesign (GameID INT, Name VARCHAR(50), Genre VARCHAR(20), NumLevels INT); INSERT INTO GameDesign (GameID, Name, Genre, NumLevels) VALUES (1, 'VR ... | List the names and genres of games that have been played by at least two distinct console players. | SELECT Name, Genre FROM GameDesign WHERE GameID IN (SELECT GameID FROM PlayerGames GROUP BY GameID HAVING COUNT(DISTINCT PlayerID) >= 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE public_buses (bus_id INT, passengers INT, trip_duration INT); INSERT INTO public_buses (bus_id, passengers, trip_duration) VALUES (1, 10, 30), (2, 15, 45), (3, 20, 60), (4, 25, 75); | What is the minimum number of passengers per trip for public buses in Sydney? | SELECT MIN(passengers) as min_passengers FROM public_buses; | gretelai_synthetic_text_to_sql |
CREATE TABLE fairness_issues (issue_id INT, model_name TEXT, country TEXT, reported_date DATE); INSERT INTO fairness_issues (issue_id, model_name, country, reported_date) VALUES (1, 'ModelA', 'India', '2021-01-01'), (2, 'ModelB', 'Canada', '2021-02-01'), (3, 'ModelC', 'US', '2021-03-01'), (4, 'ModelD', 'India', '2021-0... | How many fairness issues were reported in India? | SELECT COUNT(*) FROM fairness_issues WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousResearch (Id INT PRIMARY KEY, Study VARCHAR(100), Country VARCHAR(50), Budget DECIMAL(10, 2), Year INT); INSERT INTO AutonomousResearch (Id, Study, Country, Budget, Year) VALUES (1, 'Autonomous Driving in City Traffic', 'Germany', 5000000, 2018), (2, 'AI-based Navigation System', 'Germany', 60000... | List the autonomous driving research studies with a budget greater than $5 million conducted in Germany since 2017? | SELECT Study, Country, Budget FROM AutonomousResearch WHERE Country = 'Germany' AND Year >= 2017 AND Budget > 5000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donor_id INT, donation_amount DECIMAL(10,2), donation_date DATE); | What is the average donation amount per donor for 2022? | SELECT AVG(donation_amount) FROM (SELECT donation_amount, donor_id FROM donations WHERE YEAR(donation_date) = 2022 GROUP BY donor_id) AS donation_summary; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (program_id INT, program_name VARCHAR(255), location VARCHAR(255), emissions_reduction FLOAT); INSERT INTO carbon_offset_programs (program_id, program_name, location, emissions_reduction) VALUES (1, 'Tree Planting Program 1', 'Asia', 12000.0), (2, 'Energy Efficiency Program 1', 'Nort... | What is the total carbon emissions reduction achieved by carbon offset programs implemented in 'Europe'? | SELECT SUM(emissions_reduction) FROM carbon_offset_programs WHERE location = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_operations (operation_id INT PRIMARY KEY, operation_name VARCHAR(100), operation_type VARCHAR(50), country_targeted VARCHAR(50)); INSERT INTO intelligence_operations (operation_id, operation_name, operation_type, country_targeted) VALUES (1, 'Operation Black Swan', 'Cyberwarfare', 'Russia'), (... | Delete the 'intelligence_operation' with 'operation_id' 1 from the 'intelligence_operations' table | DELETE FROM intelligence_operations WHERE operation_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE streams (song VARCHAR(255), location VARCHAR(255), streams INT); INSERT INTO streams (song, location, streams) VALUES ('Take Me Home, Country Roads', 'Texas', 1200), ('Hotel California', 'Texas', 1500); | How many streams did song 'Take Me Home, Country Roads' get in Texas? | SELECT streams FROM streams WHERE song = 'Take Me Home, Country Roads' AND location = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists transportation (transport_id INT, transport VARCHAR(20), region VARCHAR(50), co2_emission INT); INSERT INTO transportation (transport_id, transport, region, co2_emission) VALUES (1, 'Airplane', 'Europe', 445), (2, 'Train', 'Asia', 14), (3, 'Car', 'Americas', 185), (4, 'Bus', 'Africa', 80), (5... | What is the average CO2 emission for transportation methods by region? | SELECT region, AVG(co2_emission) as avg_emission FROM transportation GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetic_research; CREATE TABLE if not exists genetic_research.patents (id INT, country VARCHAR(50), patent_type VARCHAR(50), status VARCHAR(50)); INSERT INTO genetic_research.patents (id, country, patent_type, status) VALUES (1, 'Brazil', 'Utility', 'Pending'), (2, 'Argentina', 'Design', 'Ap... | How many genetic research patents have been filed in Brazil and Argentina? | SELECT COUNT(*) FROM genetic_research.patents WHERE country IN ('Brazil', 'Argentina') AND patent_type IN ('Utility', 'Design'); | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT, name VARCHAR(50), state VARCHAR(20)); CREATE TABLE sales (id INT, dispensary_id INT, revenue DECIMAL(10,2), date DATE); INSERT INTO dispensaries (id, name, state) VALUES (1, 'Sunshine Herbs', 'California'), (2, 'Happy Times', 'California'), (3, 'Green Leaf', 'California'); INSERT INTO... | Find the top 3 dispensaries with the highest total revenue in California in Q3 2022. | SELECT dispensary_id, SUM(revenue) as total_revenue FROM sales WHERE date BETWEEN '2022-07-01' AND '2022-09-30' GROUP BY dispensary_id ORDER BY total_revenue DESC FETCH NEXT 3 ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, industry TEXT, founder_gender TEXT); INSERT INTO startup (id, name, industry, founder_gender) VALUES (1, 'GreenInnovations', 'Sustainability', 'Non-binary'); CREATE TABLE investment_rounds (id INT, startup_id INT, funding_round TEXT, funding_amount INT); INSERT INTO investment_r... | How many startups in the sustainability sector have a non-binary founder and have not received any funding? | SELECT COUNT(*) FROM startup LEFT JOIN investment_rounds ON startup.id = investment_rounds.startup_id WHERE startup.industry = 'Sustainability' AND startup.founder_gender = 'Non-binary' AND investment_rounds.funding_amount IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Name VARCHAR(100), Gender VARCHAR(10), Country VARCHAR(50), TotalHoursPlayed INT, Platform VARCHAR(50)); INSERT INTO Players VALUES (1, 'Sophia Lee', 'Female', 'China', 60, 'PC'); INSERT INTO Players VALUES (2, 'William White', 'Male', 'USA', 45, 'Console'); CREATE TABLE GameDesign (... | List the total number of female players who have participated in esports events, using cross-platform games. | SELECT COUNT(DISTINCT P.PlayerID) as FemalePlayers FROM Players P JOIN GameDesign GD ON P.PlayerID = GD.GameID JOIN EsportsEvents E ON P.PlayerID = E.PlayerID WHERE P.Gender = 'Female' AND GD.CrossPlatform = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation_projects (project_id INT, project_name TEXT, location TEXT, project_type TEXT, start_date DATE, end_date DATE); | What is the total number of climate mitigation projects in Asia that were completed before 2015? | SELECT COUNT(project_id) FROM climate_mitigation_projects WHERE location LIKE '%Asia%' AND end_date < '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_catch (id INT, species TEXT, region TEXT, weight FLOAT); INSERT INTO fish_catch (id, species, region, weight) VALUES (1, 'Tuna', 'South Pacific'), (2, 'Sardines', 'South Pacific'), (3, 'Mackerel', 'North Pacific'); | What is the total weight of fish caught in the 'South Pacific' region? | SELECT SUM(fish_catch.weight) FROM fish_catch WHERE fish_catch.region = 'South Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Player (PlayerID INT, Name VARCHAR(50), Country VARCHAR(50), Score INT); | What is the average score of players residing outside of North America? | SELECT AVG(Score) FROM Player WHERE Country NOT IN ('United States', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE economic_diversification (id INT, initiative_name VARCHAR(50), state VARCHAR(50)); INSERT INTO economic_diversification (id, initiative_name, state) VALUES (1, 'Renewable Energy', 'California'); INSERT INTO economic_diversification (id, initiative_name, state) VALUES (2, 'Tourism', 'Texas'); | How many economic diversification efforts in 'economic_diversification' table are located in 'California' and 'Texas'? | SELECT state, COUNT(*) FROM economic_diversification WHERE state IN ('California', 'Texas') GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, Name VARCHAR(50), Manufacturer VARCHAR(50), Destination VARCHAR(50)); INSERT INTO Spacecraft (SpacecraftID, Name, Manufacturer, Destination) VALUES (1, 'Galileo Orbiter', 'NASA', 'Jupiter'), (2, 'Juno', 'NASA', 'Jupiter'), (3, 'Voyager 1', 'NASA', 'Jupiter'); | What is the total number of spacecraft that have visited Jupiter? | SELECT COUNT(s.SpacecraftID) FROM Spacecraft s WHERE s.Destination = 'Jupiter'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SkincareSales (sale_id INT, product_id INT, sale_price DECIMAL(5,2), sale_date DATE, is_organic BOOLEAN, country TEXT); INSERT INTO SkincareSales (sale_id, product_id, sale_price, sale_date, is_organic, country) VALUES (1, 601, 25.99, '2021-03-14', true, 'France'); | What are the total sales for organic skincare products in France in 2021? | SELECT SUM(sale_price) FROM SkincareSales WHERE is_organic = true AND country = 'France' AND sale_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE intel_ops (id INT, op_name VARCHAR(255), region VARCHAR(255), start_date DATE, end_date DATE); | What are the details of the intelligence operations that were conducted in a specific year, say 2019, from the 'intel_ops' table? | SELECT * FROM intel_ops WHERE YEAR(start_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_farms (id INT, name TEXT, country TEXT, avg_temp FLOAT); INSERT INTO urban_farms (id, name, country, avg_temp) VALUES (1, 'Farm 1', 'Canada', 12.5), (2, 'Farm 2', 'USA', 15.0); | What is the average temperature in April for all urban farms in Canada and the USA? | SELECT AVG(avg_temp) as avg_temp FROM urban_farms WHERE country IN ('Canada', 'USA') AND MONTH(datetime) = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (vulnerability_id INT, vulnerability_severity VARCHAR(255), patch_deployment_time INT); | What are the average and maximum patch deployment times for high vulnerabilities in the last month? | SELECT AVG(patch_deployment_time) as average_patch_deployment_time, MAX(patch_deployment_time) as max_patch_deployment_time FROM vulnerabilities WHERE vulnerability_severity = 'high' AND patch_deployment_time IS NOT NULL AND DATE(created_at) >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_dev (id INT, name TEXT, location TEXT, initiative_type TEXT); INSERT INTO community_dev (id, name, location, initiative_type) VALUES (1, 'Youth Center', 'Bolivia', 'Education'), (2, 'Community Hall', 'Chile', 'Culture'), (3, 'Sports Field', 'Bolivia', 'Recreation'); | List the names and locations of community development initiatives in Bolivia and Chile, excluding education initiatives. | SELECT name, location FROM community_dev WHERE location IN ('Bolivia', 'Chile') AND initiative_type != 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, country VARCHAR(50), therapy_received BOOLEAN); INSERT INTO patients (patient_id, age, country, therapy_received) VALUES (1, 35, 'USA', TRUE), (2, 42, 'Canada', FALSE), (3, 30, 'USA', TRUE); | What is the average age of patients who received therapy in the US? | SELECT AVG(age) FROM patients WHERE country = 'USA' AND therapy_received = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE OrangeCorpProjects(id INT, contractor VARCHAR(255), project VARCHAR(255), start_date DATE, end_date DATE);INSERT INTO OrangeCorpProjects(id, contractor, project, start_date, end_date) VALUES (1, 'Orange Corp.', 'Cybersecurity System Upgrade', '2021-01-01', '2023-12-31'); | List the defense projects with timelines ending in or after 2023 for 'Orange Corp.'. | SELECT project FROM OrangeCorpProjects WHERE YEAR(end_date) >= 2023 AND contractor = 'Orange Corp.'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, price DECIMAL, B_Corp_certified BOOLEAN); INSERT INTO products (product_id, product_name, price, B_Corp_certified) VALUES (1, 'ProductX', 19.99, true), (2, 'ProductY', 14.49, false), (3, 'ProductZ', 12.99, true); | What is the minimum price of B Corp certified products? | SELECT MIN(price) FROM products WHERE B_Corp_certified = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE IndianOceanFish (id INT, species VARCHAR(20), location VARCHAR(30), population INT); INSERT INTO IndianOceanFish (id, species, location, population) VALUES (1, 'Clownfish', 'Indian Ocean', 2500); INSERT INTO IndianOceanFish (id, species, location, population) VALUES (2, 'Parrotfish', 'Indian Ocean', 1500); | What is the average population of each fish species in the Indian Ocean? | SELECT species, AVG(population) as avg_population FROM IndianOceanFish WHERE location = 'Indian Ocean' GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (well_id INT, well_type VARCHAR(20), production_date DATE, production_rate INT); INSERT INTO production (well_id, well_type, production_date, production_rate) VALUES (1, 'Exploration', '2020-01-01', 500), (2, 'Production', '2020-01-02', 1000), (3, 'Exploration', '2020-01-03', 600); | Show the total production by well type for the first quarter of 2020 | SELECT well_type, SUM(production_rate) FROM production WHERE production_date BETWEEN '2020-01-01' AND '2020-03-31' GROUP BY well_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (ticket_id INT, game_id INT, home_team VARCHAR(20), away_team VARCHAR(20), price DECIMAL(5,2), quantity INT, city VARCHAR(20)); | What is the total number of tickets sold in the ticket_sales table for the away_team in each city? | SELECT city, away_team, SUM(quantity) as total_tickets_sold FROM ticket_sales GROUP BY city, away_team; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_productivity (id INT, mine_id INT, year INT, productivity INT);CREATE TABLE mine (id INT, name VARCHAR(255), location VARCHAR(255)); INSERT INTO mine (id, name, location) VALUES (1, 'Russian Gold', 'Russia'); INSERT INTO labor_productivity (id, mine_id, year, productivity) VALUES (1, 1, 2020, 100); | Provide labor productivity metrics for the past 3 years for mines in Russia. | SELECT year, productivity FROM labor_productivity JOIN mine ON labor_productivity.mine_id = mine.id WHERE mine.location = 'Russia' AND year >= (SELECT MAX(year) - 3 FROM labor_productivity); | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_sequestration (id INT, species VARCHAR(255), year INT, sequestration FLOAT); INSERT INTO carbon_sequestration (id, species, year, sequestration) VALUES (1, 'Pine', 2018, 1000.2), (2, 'Oak', 2019, 1100.1), (3, 'Spruce', 2018, 1300.0), (4, 'Spruce', 2019, 1500.0); | What is the total carbon sequestration for each species in 2018 and 2019? | SELECT species, SUM(sequestration) as total_sequestration FROM carbon_sequestration WHERE year IN (2018, 2019) GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (id INT, model VARCHAR(255), manufacturer VARCHAR(255)); INSERT INTO aircraft (id, model, manufacturer) VALUES (1, '737', 'Boeing'), (2, '747', 'Boeing'), (3, 'A320', 'Airbus'), (4, 'A330', 'Airbus'); | What is the total number of aircraft manufactured by each manufacturer? | SELECT manufacturer, COUNT(*) FROM aircraft GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE NewMiningSites(SiteID INT, Country VARCHAR(50), EnvironmentalImpactScore FLOAT); INSERT INTO NewMiningSites VALUES (5, 'Canada', 69.8), (6, 'USA', 74.2); | Insert new mining sites with provided environmental impact scores, preserving the original records. | INSERT INTO MiningSites (SELECT * FROM NewMiningSites); | gretelai_synthetic_text_to_sql |
CREATE TABLE mars_rovers (id INT, rover_weight FLOAT); | What is the average weight of all Mars rovers? | SELECT AVG(rover_weight) FROM mars_rovers; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArticleShares (ShareID INT, ArticleID INT, Shares INT); CREATE TABLE Articles (ArticleID INT, Title VARCHAR(100), AuthorID INT, Category VARCHAR(50), WordCount INT, PublishedDate DATE); CREATE TABLE Authors (AuthorID INT, Name VARCHAR(50), Age INT, Gender VARCHAR(10), LastBookPublished DATE); | What is the total number of shares for articles published in the last month, by each author? | SELECT AuthorID, SUM(Shares) FROM ArticleShares INNER JOIN Articles ON ArticleShares.ArticleID = Articles.ArticleID INNER JOIN Authors ON Articles.AuthorID = Authors.AuthorID WHERE PublishedDate >= DATEADD(month, -1, GETDATE()) GROUP BY AuthorID; | gretelai_synthetic_text_to_sql |
CREATE TABLE FoodSafetyCertifications (certification_id INTEGER, supplier_id INTEGER, certification_date DATETIME); INSERT INTO FoodSafetyCertifications (certification_id, supplier_id, certification_date) VALUES (1, 1, '2021-12-01 10:00:00'); CREATE TABLE Suppliers (supplier_id INTEGER, supplier_name TEXT, country TEXT... | Count the number of food safety certifications for suppliers in Africa. | SELECT COUNT(*) FROM FoodSafetyCertifications JOIN Suppliers ON FoodSafetyCertifications.supplier_id = Suppliers.supplier_id WHERE Suppliers.country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, initiative VARCHAR(50), description TEXT, lead_organization VARCHAR(50)); INSERT INTO community_development (id, initiative, description, lead_organization) VALUES (1, 'Youth Center', 'A place for local youth to gather and learn', 'Local NGO'); INSERT INTO community_developme... | Display community development initiatives and their respective lead organizations from the 'rural_development' database | SELECT initiative, lead_organization FROM community_development; | gretelai_synthetic_text_to_sql |
CREATE TABLE mars_missions (id INT, mission VARCHAR(255), launch_date DATE, landing_date DATE); INSERT INTO mars_missions (id, mission, launch_date, landing_date) VALUES (1, 'Mariner 4', '1964-11-28', '1965-07-14'), (2, 'Viking 1', '1975-08-20', '1976-06-19'), (3, 'ExoMars Trace Gas Orbiter', '2016-03-14', '2016-10-19'... | List all space missions to Mars and their respective launch and landing dates. | SELECT mission, launch_date, landing_date FROM mars_missions WHERE landing_date IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, industry VARCHAR(255), founding_date DATE); CREATE TABLE founders (id INT, name VARCHAR(255), gender VARCHAR(255)); CREATE TABLE funding (company_id INT, amount INT); INSERT INTO companies SELECT 1, 'IT', '2010-01-01'; INSERT INTO founders SELECT 1, 'Alice', 'female'; INSERT INTO funding... | Find the average funding amount for companies founded by women in the IT industry | SELECT AVG(funding.amount) FROM funding JOIN companies ON funding.company_id = companies.id JOIN founders ON companies.id = founders.id WHERE companies.industry = 'IT' AND founders.gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts (id INT, name TEXT, type TEXT, region TEXT); INSERT INTO traditional_arts (id, name, type, region) VALUES (1, 'Catalan Castells', 'Construction', 'Europe'); | How many traditional arts are practiced in Europe? | SELECT COUNT(*) FROM traditional_arts WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_projects (id INT, province VARCHAR(50), cost FLOAT, project_type VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO agricultural_projects (id, province, cost, project_type, start_date, end_date) VALUES (1, 'Alberta', 50000.00, 'Precision Agriculture', '2016-01-01', '2016-12-31'); | How many agricultural innovation projects were completed in the province of Alberta between 2016 and 2018? | SELECT COUNT(*) FROM agricultural_projects WHERE province = 'Alberta' AND start_date <= '2018-12-31' AND end_date >= '2016-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo (id INT, vessel_id INT, weight INT, date DATE); INSERT INTO cargo (id, vessel_id, weight, date) VALUES (1, 1, 15000, '2022-05-05'); INSERT INTO cargo (id, vessel_id, weight, date) VALUES (2, 1, 16000, '2022-05-10'); INSERT INTO cargo (id, vessel_id, weight, date) VALUES (3, 2, 20000, '2022-05-07'); I... | What is the total cargo weight transported by each vessel in the last month? | SELECT vessel_id, SUM(weight) as total_weight FROM cargo WHERE date >= '2022-05-01' AND date < '2022-06-01' GROUP BY vessel_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings_wa (id INT, building_name VARCHAR(50), state VARCHAR(50), building_type VARCHAR(50)); INSERT INTO green_buildings_wa (id, building_name, state, building_type) VALUES (1, 'Washington Green Tower', 'Washington', 'Commercial'); | How many green buildings are there in the state of Washington, by type? | SELECT building_type, COUNT(*) FROM green_buildings_wa WHERE state = 'Washington' GROUP BY building_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE BudgetAllocations (Year INT, Service TEXT, Amount INT); INSERT INTO BudgetAllocations (Year, Service, Amount) VALUES (2021, 'EmergencyServices', 12000000), (2022, 'EmergencyServices', 13000000); | What was the total budget allocated for emergency services in 2021 and 2022, and which year had a higher allocation? | SELECT Year, SUM(Amount) FROM BudgetAllocations WHERE Service = 'EmergencyServices' GROUP BY Year HAVING Year IN (2021, 2022) ORDER BY SUM(Amount) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE post_stats (post_id INT, category VARCHAR(50), likes INT, comments INT); INSERT INTO post_stats (post_id, category, likes, comments) VALUES (1, 'fashion', 100, 25), (2, 'fashion', 200, 50), (3, 'beauty', 150, 75); | What is the engagement rate (likes + comments) for posts in the fashion category? | SELECT post_id, (likes + comments) AS engagement_rate FROM post_stats WHERE category = 'fashion'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodations (ID INT PRIMARY KEY, Country VARCHAR(50), AccommodationType VARCHAR(50), Quantity INT); INSERT INTO Accommodations (ID, Country, AccommodationType, Quantity) VALUES (1, 'USA', 'Sign Language Interpretation', 300), (2, 'Canada', 'Wheelchair Ramp', 250), (3, 'Mexico', 'Assistive Listening Devi... | What is the total number of accommodations provided by type, per country? | SELECT Country, AccommodationType, SUM(Quantity) as Total FROM Accommodations GROUP BY Country, AccommodationType; | gretelai_synthetic_text_to_sql |
CREATE TABLE sports_team_c_ticket_sales (sale_id INT, sale_date DATE, quantity INT, price DECIMAL(5,2)); INSERT INTO sports_team_c_ticket_sales (sale_id, sale_date, quantity, price) VALUES (1, '2022-01-01', 100, 50.00), (2, '2022-01-02', 120, 55.00), (3, '2022-01-03', 150, 60.00); CREATE TABLE sports_team_d_ticket_sale... | Display the INTERSECT of 'sports_team_c_ticket_sales' and 'sports_team_d_ticket_sales' tables | SELECT * FROM sports_team_c_ticket_sales INTERSECT SELECT * FROM sports_team_d_ticket_sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_vehicles (id INT, make VARCHAR(50), model VARCHAR(50), type VARCHAR(50), horsepower INT); | What is the average horsepower for electric vehicles in the "green_vehicles" table? | SELECT AVG(horsepower) FROM green_vehicles WHERE type = 'Electric'; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_investments (id INT, year INT, country VARCHAR(255), investment_type VARCHAR(255), amount DECIMAL(10,2)); INSERT INTO socially_responsible_investments (id, year, country, investment_type, amount) VALUES (1, 2020, 'Malaysia', 'Green Bond', 1500000.00), (2, 2021, 'Malaysia', 'Sustainabl... | What is the total value of socially responsible investments in Malaysia for the last 3 years? | SELECT SUM(amount) FROM socially_responsible_investments WHERE country = 'Malaysia' AND year BETWEEN 2020 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_strategies (strategy_id INT, ESG_score FLOAT, risk_level INT); INSERT INTO investment_strategies (strategy_id, ESG_score, risk_level) VALUES (101, 86.2, 3), (102, 78.9, 5), (103, 88.7, 2), (104, 65.1, 1); | Determine the total risk level for all investment strategies. | SELECT SUM(risk_level) FROM investment_strategies; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_name VARCHAR(50), event_date DATE); CREATE TABLE funding_sources (funding_id INT, event_id INT, source_name VARCHAR(50), funding_date DATE); INSERT INTO events (event_id, event_name, event_date) VALUES (1, 'Art in the Park', '2022-06-01'), (2, 'Music Under the Stars', '2022-07-0... | How many events received funding from the "National Endowment for the Arts" in the last 5 years? | SELECT COUNT(DISTINCT e.event_id) AS event_count FROM events e INNER JOIN funding_sources fs ON e.event_id = fs.event_id WHERE fs.source_name = 'National Endowment for the Arts' AND e.event_date >= DATEADD(year, -5, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (id INT, shipped_date DATE, destination VARCHAR(20), weight INT); INSERT INTO shipments (id, shipped_date, destination, weight) VALUES (1, '2022-03-05', 'South America', 150), (2, '2022-03-07', 'North America', 200), (3, '2022-03-03', 'South America', 100); | What is the total weight of shipments sent to 'South America' in the last week? | SELECT SUM(weight) FROM shipments WHERE shipped_date >= DATEADD(day, -7, GETDATE()) AND destination = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, union_name VARCHAR(30), sector VARCHAR(20), num_campaigns INT); INSERT INTO campaigns (id, union_name, sector, num_campaigns) VALUES (1, 'Union X', 'finance', 3), (2, 'Union Y', 'education', 1), (3, 'Union Z', 'finance', 2); | List the union names and the number of labor rights advocacy campaigns they led in the 'finance' sector. | SELECT union_name, num_campaigns FROM campaigns WHERE sector = 'finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agri_projects (project_id INT, district_id INT, budget FLOAT, project_category VARCHAR(50)); INSERT INTO agri_projects (project_id, district_id, budget, project_category) VALUES (1, 1, 120000, 'Crop Research'), (2, 1, 80000, 'Livestock Research'), (3, 2, 180000, 'Farm Machinery'), (4, 3, 90000, 'Fertilizer... | List the total budget for agricultural innovation projects per district in descending order. | SELECT district_id, SUM(budget) FROM agri_projects GROUP BY district_id ORDER BY SUM(budget) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Peacekeeping_Lead (mission VARCHAR(255), lead_country VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO Peacekeeping_Lead (mission, lead_country, start_date, end_date) VALUES ('MINUSTAH', 'Brazil', '2004-04-01', '2017-10-15'); | What is the number of peacekeeping missions led by each of the top 3 countries in the last 10 years? | SELECT lead_country, COUNT(mission) FROM Peacekeeping_Lead WHERE start_date >= DATE(NOW()) - INTERVAL 10 YEAR GROUP BY lead_country ORDER BY COUNT(mission) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE RegulatoryFrameworks (id INT, name VARCHAR(50), jurisdiction VARCHAR(50), date DATE); | Which regulatory frameworks have been implemented in the 'RegulatoryFrameworks' table after '2021-01-01'? | SELECT name, date FROM RegulatoryFrameworks WHERE date > '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArcticPollution (ID INT, Pollutant VARCHAR(50), Level INT, TimeStamp DATETIME); INSERT INTO ArcticPollution (ID, Pollutant, Level, TimeStamp) VALUES (1, 'NitrogenOxides', 5, '2022-01-01 10:00:00'), (2, 'Phosphates', 10, '2022-01-02 10:00:00'), (3, 'Microplastics', 15, '2022-01-03 10:00:00'); | What are the most common types of marine pollution in the Arctic? | SELECT Pollutant, Level, RANK() OVER (PARTITION BY Pollutant ORDER BY Level DESC) as Rank FROM ArcticPollution WHERE TimeStamp BETWEEN '2022-01-01 10:00:00' AND '2022-01-04 10:00:00'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_ethics (id INT PRIMARY KEY, region VARCHAR(50), initiative VARCHAR(100)); INSERT INTO ai_ethics (id, region, initiative) VALUES (1, 'Asia', 'Ethical AI education program'), (2, 'Africa', 'Ethical AI training program for governments'); | Delete the 'ai_ethics' table | DROP TABLE ai_ethics; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExplorationData (WellID int, ExplorationDate date, DrillingCosts decimal(10, 2)); INSERT INTO ExplorationData (WellID, ExplorationDate, DrillingCosts) VALUES (301, '2021-11-01', 450000), (301, '2021-11-02', 475000), (302, '2021-11-03', 500000); | Calculate the average drilling costs for all wells in the ExplorationData table. | SELECT AVG(DrillingCosts) FROM ExplorationData; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name VARCHAR(50), country VARCHAR(50), revenue FLOAT); INSERT INTO hotels (hotel_id, hotel_name, country, revenue) VALUES (1, 'Eco Inn', 'USA', 40000), (2, 'Green Lodge', 'Canada', 45000), (3, 'Eco Resort', 'USA', 50000), (4, 'Sustainable Hotel', 'Canada', 55000); | What is the average revenue of eco-friendly hotels in the United States and Canada? | SELECT AVG(revenue) FROM hotels WHERE country IN ('USA', 'Canada') AND hotel_name LIKE '%eco%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, age INT, device VARCHAR(20)); INSERT INTO players (id, age, device) VALUES (1, 25, 'mobile'), (2, 30, 'console'), (3, 22, 'mobile'), (4, 18, 'pc'), (5, 28, 'console'); | What is the average age of players who play games on mobile devices? | SELECT AVG(age) FROM players WHERE device = 'mobile'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolicyDisabilityTypes (PolicyID INT, DisabilityTypeID INT); INSERT INTO PolicyDisabilityTypes (PolicyID, DisabilityTypeID) VALUES (1, 1); INSERT INTO PolicyDisabilityTypes (PolicyID, DisabilityTypeID) VALUES (2, 2); | List all policies with their corresponding disability types. | SELECT p.PolicyName, dt.DisabilityType FROM Policies p INNER JOIN PolicyDisabilityTypes pdt ON p.PolicyID = pdt.PolicyID INNER JOIN DisabilityTypes dt ON pdt.DisabilityTypeID = dt.DisabilityTypeID; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_aid_servings (serving_id INT, serviced_state VARCHAR(20), servicing_year INT); INSERT INTO legal_aid_servings (serving_id, serviced_state, servicing_year) VALUES (1, 'Florida', 2018), (2, 'Florida', 2019), (3, 'California', 2018), (4, 'Florida', 2020); | Find the average number of legal aid servings per year in Florida. | SELECT AVG(servicing_year) FROM legal_aid_servings WHERE serviced_state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_technology_projects (project_id INT, project_name VARCHAR(255), project_status VARCHAR(255)); | Insert new biosensor technology project data | INSERT INTO biosensor_technology_projects (project_id, project_name, project_status) VALUES (1, 'Glucose Monitoring Sensor', 'In Development'), (2, 'Neurotransmitter Biosensor', 'Completed'), (3, 'Pathogen Detection Array', 'Planning'); | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT, crop_name VARCHAR(50), yield_mt_ha INT, area_ha INT); INSERT INTO crops (id, crop_name, yield_mt_ha, area_ha) VALUES (1, 'Rice', 4.5, 600), (2, 'Potatoes', 15, 200), (3, 'Wheat', 3, 420); | What is the average yield, in metric tons per hectare, of 'Rice' and 'Potatoes' crops, and the total production, in metric tons, for those crops? | SELECT crop_name, AVG(yield_mt_ha) as avg_yield_mt_ha, SUM(yield_mt_ha * area_ha * 0.01) as total_production_mt FROM crops WHERE crop_name IN ('Rice', 'Potatoes') GROUP BY crop_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists istanbul_metro_trips (id INT, trip_id INT, fare DECIMAL(5,2), route_id INT, vehicle_id INT, timestamp TIMESTAMP); | How many metro trips were taken in Istanbul during morning rush hour on April 25th, 2021? | SELECT COUNT(*) FROM istanbul_metro_trips WHERE EXTRACT(HOUR FROM timestamp) BETWEEN 6 AND 8 AND EXTRACT(DAY FROM timestamp) = 25 AND EXTRACT(MONTH FROM timestamp) = 4 AND EXTRACT(YEAR FROM timestamp) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE luxury_properties (property_id INT, market_value INT); INSERT INTO luxury_properties VALUES (1, 1000000), (2, 1500000), (3, 800000) | Display property_ids, and their 'market_value' from the luxury_properties table. | SELECT property_id, market_value FROM luxury_properties; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft (id INT, name VARCHAR(50), launch_date DATE); INSERT INTO spacecraft (id, name, launch_date) VALUES (1, 'Voyager 1', '1977-09-05'), (2, 'Spirit', '2004-06-10'), (3, 'Opportunity', '2004-07-07'); | What is the average age of the spacecraft that have been launched by NASA? | SELECT AVG(DATEDIFF(CURDATE(), launch_date)) as average_age FROM spacecraft WHERE name IN ('Voyager 1', 'Spirit', 'Opportunity') AND name LIKE 'NASA%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_events(id INT, region VARCHAR(30), type VARCHAR(30), attendees INT); INSERT INTO cultural_events VALUES (1, 'Asia', 'Festival', 2000); INSERT INTO cultural_events VALUES (2, 'Asia', 'Concert', 500); | What is the total number of cultural events and their average attendance in Asia? | SELECT SUM(attendees), AVG(attendees) FROM cultural_events WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE User_Assets (user_id INTEGER, asset_name TEXT); INSERT INTO User_Assets (user_id, asset_name) VALUES (1, 'Asset A'), (1, 'Asset B'), (1, 'Asset C'), (2, 'Asset A'), (2, 'Asset D'), (3, 'Asset E'), (3, 'Asset F'), (3, 'Asset G'); | What is the maximum number of digital assets owned by a single user? | SELECT MAX(user_assets) FROM (SELECT COUNT(*) AS user_assets FROM User_Assets GROUP BY user_id) AS user_assets_count; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (supplier_id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO Suppliers (supplier_id, name, country) VALUES (1, 'EcoSupplier', 'USA'), (2, 'GreenSupplies', 'India'), (3, 'SustainableSource', 'Brazil'); CREATE TABLE Materials (material_id INT, name VARCHAR(255), type VARCHAR(255)); INSER... | List all suppliers providing recycled polyester and their respective certifications. | SELECT Suppliers.name, Supplies.certification FROM Suppliers INNER JOIN Supplies ON Suppliers.supplier_id = Supplies.supplier_id INNER JOIN Materials ON Supplies.material_id = Materials.material_id WHERE Materials.name = 'Recycled Polyester'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (name TEXT, id INTEGER, region TEXT); INSERT INTO factories (name, id, region) VALUES ('Factory D', 4, 'Asia-Pacific'), ('Factory E', 5, 'Asia-Pacific'), ('Factory A', 1, 'North America'); CREATE TABLE recycling_rates (factory_id INTEGER, rate FLOAT); INSERT INTO recycling_rates (factory_id, rate... | What are the recycling rates for factories located in the Asia-Pacific region? | SELECT f.name, r.rate FROM factories f JOIN recycling_rates r ON f.id = r.factory_id WHERE f.region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (location VARCHAR(255), usage INT); | Show the total water usage for each location | SELECT location, SUM(usage) as total_usage FROM water_usage GROUP BY location; | 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.