context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE climate_adaptation (region VARCHAR(50), year INT, project_status VARCHAR(20)); INSERT INTO climate_adaptation (region, year, project_status) VALUES ('Latin America', 2015, 'completed'), ('Caribbean', 2015, 'completed'), ('Latin America', 2016, 'completed'), ('Caribbean', 2016, 'completed'), ('Latin America... | How many climate adaptation projects were completed in Latin America and the Caribbean between 2015 and 2019? | SELECT COUNT(*) FROM climate_adaptation WHERE region IN ('Latin America', 'Caribbean') AND year BETWEEN 2015 AND 2019 AND project_status = 'completed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), age INT); INSERT INTO players (id, name, age) VALUES (1, 'John Doe', 25); INSERT INTO players (id, name, age) VALUES (2, 'Jane Smith', 30); CREATE TABLE events (id INT, name VARCHAR(50), date DATE); INSERT INTO events (id, name, date) VALUES (1, 'GameCon', '2022-04-01'); ... | List the names of players who have played in esports events, in the last 3 months, in any country. | SELECT players.name FROM players INNER JOIN events ON players.id = events.id WHERE events.date >= DATEADD(month, -3, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, salesperson_id INT, amount DECIMAL(10, 2), status VARCHAR(50)); INSERT INTO transactions (transaction_id, salesperson_id, amount, status) VALUES (1, 1, 50.00, 'approved'), (2, 1, 100.00, 'declined'), (3, 2, 75.00, 'approved'); CREATE TABLE salespeople (salesperson_id INT, ... | What is the percentage of transactions that were declined for each salesperson? | SELECT s.name, (COUNT(t.transaction_id) * 100.0 / (SELECT COUNT(*) FROM transactions t2 WHERE t2.salesperson_id = s.salesperson_id)) AS percentage FROM salespeople s LEFT JOIN transactions t ON s.salesperson_id = t.salesperson_id AND t.status = 'declined' GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE TransactionDates (TransactionID INT, TransactionDate DATE); INSERT INTO TransactionDates (TransactionID, TransactionDate) VALUES (1, '2022-01-01'), (2, '2022-01-15'), (3, '2022-02-03'), (4, '2022-02-20'); | Which customers have not made any transactions in the last 30 days? | SELECT c.CustomerID FROM Customers c LEFT JOIN TransactionDates t ON c.CustomerID = t.CustomerID WHERE t.TransactionDate IS NULL AND t.TransactionDate > NOW() - INTERVAL '30 days'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_beds (id INT, county TEXT, beds_per_capita FLOAT); INSERT INTO hospital_beds (id, county, beds_per_capita) VALUES (1, 'Los Angeles County', 2.5), (2, 'Orange County', 3.0); | What is the minimum number of hospital beds per capita in each county? | SELECT county, MIN(beds_per_capita) FROM hospital_beds GROUP BY county; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells_drilled (country VARCHAR(50), well_id INT, drill_date DATE, offshore BOOLEAN); INSERT INTO wells_drilled (country, well_id, drill_date, offshore) VALUES ('Norway', 1, '2019-01-01', true); INSERT INTO wells_drilled (country, well_id, drill_date, offshore) VALUES ('USA', 2, '2018-12-31', true); INSERT ... | Identify the top 2 countries with the highest number of offshore wells drilled in 2019 | SELECT country, COUNT(*) as num_wells FROM wells_drilled WHERE YEAR(drill_date) = 2019 AND offshore = true GROUP BY country ORDER BY num_wells DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR(255), country VARCHAR(255));CREATE TABLE donations (id INT, donor_id INT, cause_id INT, amount DECIMAL(10, 2));CREATE TABLE causes (id INT, name VARCHAR(255)); | What's the average donation amount for each cause? | SELECT c.name, AVG(d.amount) FROM donations d INNER JOIN causes c ON d.cause_id = c.id GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE colombia_diplomacy (id INT, country VARCHAR(50), partner VARCHAR(50)); INSERT INTO colombia_diplomacy (id, country, partner) VALUES (1, 'Colombia', 'United States'), (2, 'Colombia', 'Brazil'), (3, 'Colombia', 'Ecuador'), (4, 'Colombia', 'Peru'); | Identify the defense diplomacy activities between Colombia and other countries. | SELECT DISTINCT partner FROM colombia_diplomacy WHERE country = 'Colombia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_name VARCHAR(255), solar_capacity FLOAT); INSERT INTO states (state_name, solar_capacity) VALUES ('California', 32722), ('Texas', 8807), ('Florida', 7256), ('North Carolina', 6321), ('Arizona', 5653); | What are the top 5 states with the highest installed solar capacity in the US? | SELECT state_name, SUM(solar_capacity) as total_capacity FROM states GROUP BY state_name ORDER BY total_capacity DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID INT, Song TEXT, Platform TEXT, Country TEXT, Revenue FLOAT); INSERT INTO Sales (SaleID, Song, Platform, Country, Revenue) VALUES (1, 'Despacito', 'iTunes', 'United States', 1.29), (2, 'Havana', 'iTunes', 'United States', 1.29); | What is the total revenue generated by Latin music on iTunes in the United States? | SELECT SUM(Revenue) FROM Sales WHERE Platform = 'iTunes' AND Country = 'United States' AND Genre = 'Latin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mission_launch_dates (mission_name VARCHAR(50), launch_date DATE); | How many missions were launched per month in 2020? | SELECT EXTRACT(MONTH FROM launch_date) as month, COUNT(*) as num_missions FROM mission_launch_dates WHERE EXTRACT(YEAR FROM launch_date) = 2020 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE offenders (id INT, age INT, gender VARCHAR(10), city VARCHAR(20)); INSERT INTO offenders (id, age, gender, city) VALUES (1, 34, 'Female', 'Oakland'), (2, 42, 'Male', 'San_Francisco'), (3, 25, 'Male', 'San_Francisco'), (4, 45, 'Female', 'San_Francisco'); CREATE TABLE crimes (id INT, type VARCHAR(20), city V... | What is the minimum age of male offenders who committed violent crimes in San Francisco? | SELECT MIN(age) FROM offenders JOIN crimes ON offenders.id = crimes.id WHERE gender = 'Male' AND type = 'Violent_Crime' AND city = 'San_Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (state VARCHAR(255), year INT, hospital_beds INT); INSERT INTO hospitals (state, year, hospital_beds) VALUES ('New York', 2022, 50000); | What is the total number of hospital beds available in the state of New York as of 2022? | SELECT SUM(hospital_beds) AS total_hospital_beds FROM hospitals WHERE state = 'New York' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT PRIMARY KEY, name VARCHAR(255), description TEXT, active BOOLEAN); INSERT INTO genetic_research (id, name, description, active) VALUES (1, 'CRISPR Cas9', 'A genome editing tool', true), (2, 'Genetic Sequencing', 'Determining the order of nucleotides in DNA', true); | Delete genetic research data for a specific project that is no longer active | DELETE FROM genetic_research WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (id INT, country VARCHAR(50), cost FLOAT); INSERT INTO military_equipment (id, country, cost) VALUES (1, 'USA', 1500000); INSERT INTO military_equipment (id, country, cost) VALUES (2, 'USA', 1800000); | What is the average cost of military equipment maintenance in the US? | SELECT AVG(cost) FROM military_equipment WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE software (software_type VARCHAR(255), total_vulnerabilities INT); INSERT INTO software (software_type, total_vulnerabilities) VALUES ('Application', 100), ('Operating System', 200), ('Database', 150); | What is the total number of vulnerabilities for each software type, ordered by the highest number of vulnerabilities? | SELECT software_type, total_vulnerabilities FROM software ORDER BY total_vulnerabilities DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (item_id INT, item_name VARCHAR(50), category VARCHAR(20), region VARCHAR(20), price DECIMAL(5,2), sales INT); INSERT INTO menu_items (item_id, item_name, category, region, price, sales) VALUES (1, 'Vegetable Spring Rolls', 'Appetizers', 'APAC', 4.99, 300), (2, 'Spicy Tofu', 'Entrees', 'APAC', 1... | Determine the revenue generated by each menu category in the APAC region. | SELECT category, SUM(price * sales) AS revenue FROM menu_items WHERE region = 'APAC' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (id INT, name VARCHAR(50), position VARCHAR(50), team VARCHAR(50), age INT); | Delete all records in the 'athletes' table where age is less than 20 | DELETE FROM athletes WHERE age < 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE trips (trip_id INT, trip_start_time DATETIME, trip_end_time DATETIME, system_name VARCHAR(20)); | What was the earliest and latest time a ride ended for each system in June 2023? | SELECT system_name, MIN(trip_end_time) AS min_end_time, MAX(trip_end_time) AS max_end_time FROM trips WHERE system_name IN ('Bus', 'Subway', 'Tram') AND trip_end_time BETWEEN '2023-06-01' AND '2023-06-30' GROUP BY system_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE VeteranEmployment (ApplicationID INT, Applicant VARCHAR(50), Country VARCHAR(50)); INSERT INTO VeteranEmployment (ApplicationID, Applicant, Country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'Canada'), (3, 'Michael Johnson', 'USA'); | Insert a new record for a veteran employment application from a new applicant in India? | INSERT INTO VeteranEmployment (ApplicationID, Applicant, Country) VALUES (4, 'Akshay Kumar', 'India'); | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, city VARCHAR(50), year INT, carbon_offsets FLOAT); | What is the average carbon offset of green buildings constructed in 2020 and 2021, grouped by city? | SELECT city, AVG(carbon_offsets) FROM green_buildings WHERE year IN (2020, 2021) GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings(id INT, building_name VARCHAR(50), building_type VARCHAR(50));CREATE TABLE energy_efficiency(building_id INT, rating INT); | What is the average energy efficiency rating for each building type in the buildings and energy_efficiency tables, excluding buildings in the "Industrial" category? | SELECT b.building_type, AVG(e.rating) AS avg_rating FROM buildings b INNER JOIN energy_efficiency e ON b.id = e.building_id WHERE b.building_type != 'Industrial' GROUP BY b.building_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hospital (Name TEXT, Region TEXT); INSERT INTO Hospital (Name, Region) VALUES ('Hospital A', 'Northeast'); INSERT INTO Hospital (Name, Region) VALUES ('Hospital B', 'South'); | How many hospitals are there in the Midwest region of the US? | SELECT COUNT(*) FROM Hospital WHERE Region = 'Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (product VARCHAR(50), units_produced INT, production_date DATE); | Update the production quantity for product "Gizmo Y" to 250 on 2022-06-15 in the "production" table | UPDATE production SET units_produced = 250 WHERE product = 'Gizmo Y' AND production_date = '2022-06-15'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_education (id INT, program_name VARCHAR(50), enrollment INT); INSERT INTO community_education (id, program_name, enrollment) VALUES (1, 'Wildlife Conservation', 1500), (2, 'Biodiversity Awareness', 1200), (3, 'Climate Change Education', 1800); | Which community education program has the highest enrollment? | SELECT program_name, MAX(enrollment) FROM community_education; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (id INT, name TEXT, coordinator TEXT); | List all support programs and their respective coordinators, ordered alphabetically by support program name. | SELECT * FROM support_programs ORDER BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_violations (id INT, policy VARCHAR(50), violations INT, year INT); | Which policies have had the most violations in the past year from the 'policy_violations' table? | SELECT policy, SUM(violations) FROM policy_violations WHERE year = YEAR(CURRENT_DATE) - 1 GROUP BY policy ORDER BY SUM(violations) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE mitigation_projects (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), description TEXT, start_date DATE, end_date DATE, budget FLOAT); INSERT INTO mitigation_projects (id, name, location, description, start_date, end_date, budget) VALUES (1, 'Solar Farm Installation', 'California', 'Installati... | What was the total budget for all climate projects in '2018' from the 'mitigation_projects' and 'adaptation_projects' tables? | SELECT SUM(budget) FROM mitigation_projects WHERE start_date <= '2018-12-31' AND end_date >= '2018-01-01' UNION ALL SELECT SUM(budget) FROM adaptation_projects WHERE start_date <= '2018-12-31' AND end_date >= '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students(student_id INT, name TEXT);CREATE TABLE Programs(program_id INT, program_name TEXT);CREATE TABLE Student_Programs(student_id INT, program_id INT); | Which support programs have more than 20 students participating? | SELECT p.program_name FROM Programs p INNER JOIN Student_Programs sp ON p.program_id = sp.program_id GROUP BY p.program_name HAVING COUNT(DISTINCT sp.student_id) > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, practice_area VARCHAR(20), billing_amount DECIMAL(10, 2), open_date DATE); INSERT INTO cases (case_id, practice_area, billing_amount, open_date) VALUES (1, 'Family Law', 2000, '2022-01-01'), (2, 'Criminal Law', 1500, '2022-03-15'), (3, 'Family Law', 3000, '2022-04-01'); | Find the total billing amount for cases in the 'Family Law' practice area that were opened in the first quarter of 2022? | SELECT SUM(billing_amount) FROM cases WHERE practice_area = 'Family Law' AND QUARTER(open_date) = 1 AND YEAR(open_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (region VARCHAR(255), source VARCHAR(255), date DATE, usage INT); INSERT INTO water_usage (region, source, date, usage) VALUES ('Eastern', 'River', '2020-01-01', 15000); | What is the average daily water usage for each water source in the eastern region in 2020?' | SELECT region, source, AVG(usage) FROM water_usage WHERE region = 'Eastern' AND YEAR(date) = 2020 GROUP BY region, source; | gretelai_synthetic_text_to_sql |
CREATE TABLE plants (id VARCHAR(10), name VARCHAR(50), location VARCHAR(50), type VARCHAR(50), emission_level VARCHAR(50)); INSERT INTO plants (id, name, location, type, emission_level) VALUES ('Plant_001', 'Coal Power Plant', 'Ohio', 'Power Plant', 'Medium'); INSERT INTO plants (id, name, location, type, emission_leve... | Update the 'emission_level' of the 'Coal Power Plant' record in the 'plants' table to 'High' | UPDATE plants SET emission_level = 'High' WHERE name = 'Coal Power Plant'; | gretelai_synthetic_text_to_sql |
create table incidents (id int, date date, sector varchar(255)); insert into incidents values (1, '2021-01-01', 'government'); insert into incidents values (2, '2021-01-05', 'government'); insert into incidents values (3, '2021-01-10', 'government'); insert into incidents values (4, '2021-01-20', 'healthcare'); | What is the maximum number of days between two consecutive security incidents for the government sector? | SELECT DATEDIFF(date, LAG(date) OVER (PARTITION BY sector ORDER BY date)) FROM incidents WHERE sector = 'government' ORDER BY date DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID int, Name varchar(50), Nationality varchar(50)); CREATE TABLE ArtPieces (ArtPieceID int, Title varchar(50), YearCreated int, ArtistID int, MovementID int); CREATE TABLE ArtMovements (MovementID int, Name varchar(50)); | Which artists from Asia have the most pieces in the modern art category? | SELECT Artists.Name, COUNT(ArtPieces.ArtPieceID) AS ArtPiecesCount FROM Artists INNER JOIN ArtPieces ON Artists.ArtistID = ArtPieces.ArtistID INNER JOIN ArtMovements ON ArtPieces.MovementID = ArtMovements.MovementID WHERE Artists.Nationality LIKE 'Asia%' AND ArtMovements.Name = 'Modern Art' GROUP BY Artists.Name ORDER ... | gretelai_synthetic_text_to_sql |
CREATE TABLE Workers (id INT, industry VARCHAR(20), employment_status VARCHAR(20)); INSERT INTO Workers (id, industry, employment_status) VALUES (1, 'Manufacturing', 'Part-time'), (2, 'Retail', 'Full-time'), (3, 'Manufacturing', 'Full-time'); | How many workers in the 'Manufacturing' industry have a 'Part-time' status? | SELECT COUNT(*) FROM Workers WHERE industry = 'Manufacturing' AND employment_status = 'Part-time'; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturer_ratings(name VARCHAR(50), location VARCHAR(50), sustainability_rating INT); INSERT INTO manufacturer_ratings (name, location, sustainability_rating) VALUES ('EcoClothes', 'Brazil', 93); INSERT INTO manufacturer_ratings (name, location, sustainability_rating) VALUES ('GreenSeams', 'Argentina', ... | Who is the garment manufacturer with the highest sustainability rating in 'South America'? | SELECT name, sustainability_rating FROM manufacturer_ratings WHERE location = 'South America' ORDER BY sustainability_rating DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_incidents (id INT, incident_month DATE, region VARCHAR(255)); INSERT INTO monthly_incidents (id, incident_month, region) VALUES (1, '2022-01-01', 'APAC'), (2, '2022-02-01', 'EMEA'), (3, '2022-03-01', 'AMER'); | What is the average number of security incidents per month for each region? | SELECT region, AVG(EXTRACT(MONTH FROM incident_month)) FROM monthly_incidents GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE DailyWaterUsage (ID INT, Date DATE, WaterAmount FLOAT); INSERT INTO DailyWaterUsage (ID, Date, WaterAmount) VALUES (1, '2022-07-01', 12000); INSERT INTO DailyWaterUsage (ID, Date, WaterAmount) VALUES (2, '2022-07-02', 15000); | What was the maximum daily water consumption in the 'DailyWaterUsage' table in July 2022? | SELECT Date, WaterAmount, ROW_NUMBER() OVER (PARTITION BY Date ORDER BY WaterAmount DESC) as Rank FROM DailyWaterUsage WHERE Rank = 1 AND Date BETWEEN '2022-07-01' AND '2022-07-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_clinics (clinic_location VARCHAR(255), healthcare_provider_specialty VARCHAR(255), healthcare_provider_salary INT); INSERT INTO rural_clinics (clinic_location, healthcare_provider_specialty, healthcare_provider_salary) VALUES ('Location1', 'SpecialtyA', 100000), ('Location1', 'SpecialtyA', 110000), (... | What is the average healthcare provider salary in the "rural_clinics" table, partitioned by clinic location and healthcare provider specialty? | SELECT clinic_location, healthcare_provider_specialty, AVG(healthcare_provider_salary) OVER (PARTITION BY clinic_location, healthcare_provider_specialty) FROM rural_clinics; | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftManufacturers (ID INT, Name VARCHAR(50), Country VARCHAR(50));INSERT INTO AircraftManufacturers (ID, Name, Country) VALUES (1, 'Boeing', 'USA'), (2, 'Airbus', 'Europe'); | What is the total number of aircraft manufactured by Boeing and Airbus? | SELECT COUNT(*) FROM AircraftManufacturers WHERE Name IN ('Boeing', 'Airbus'); | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), genre VARCHAR(255), studio_location VARCHAR(255)); INSERT INTO movies (id, title, genre, studio_location) VALUES (1, 'Movie1', 'Comedy', 'Canada'), (2, 'Movie2', 'Drama', 'Australia'); CREATE TABLE studios (id INT, name VARCHAR(255), location VARCHAR(255)); INSERT INTO s... | What is the total number of movies, by genre, produced by studios in Canada and Australia? | SELECT genre, COUNT(*) as total FROM movies JOIN studios ON movies.studio_location = studios.location WHERE studios.location IN ('Canada', 'Australia') GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA fitness; CREATE TABLE membership (member_id INT, member_start_date DATE, membership_fee INT); INSERT INTO membership (member_id, member_start_date, membership_fee) VALUES (1, '2022-01-01', 50), (2, '2022-02-01', 75), (3, '2022-03-01', 100); | What is the total revenue generated from memberships in Q1 2022, excluding the members who joined in March 2022 or later? | SELECT SUM(membership_fee) FROM membership WHERE membership_fee IS NOT NULL AND member_start_date < '2022-03-01' AND member_start_date >= '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_data (farm_id INT, farm_name VARCHAR(255), country VARCHAR(255), is_organic BOOLEAN); INSERT INTO farm_data (farm_id, farm_name, country, is_organic) VALUES (1, 'Farm1', 'CountryA', true), (2, 'Farm2', 'CountryB', false), (3, 'Farm3', 'CountryA', true), (4, 'Farm4', 'CountryC', true), (5, 'Farm5', 'Co... | Calculate the percentage of organic farms in each country in the 'farm_data' table. | SELECT country, (COUNT(*) FILTER (WHERE is_organic = true)) * 100.0 / COUNT(*) as organic_percentage FROM farm_data GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather (city VARCHAR(255), wind_speed FLOAT, date DATE); | Insert a new record for 'Mexico City' with a wind speed of 20 km/h on '2022-10-31'. | INSERT INTO weather (city, wind_speed, date) VALUES ('Mexico City', 20, '2022-10-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, country TEXT); INSERT INTO volunteers (id, country) VALUES (1, 'Australia'), (2, 'Mexico'), (3, 'Australia'); | What is the total number of volunteers from the country of Australia? | SELECT COUNT(*) FROM volunteers WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_efforts (id INT PRIMARY KEY, species VARCHAR(255), country VARCHAR(255), program VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO conservation_efforts (id, species, country, program, start_date, end_date) VALUES (1, 'turtle', 'New_Zealand', 'South_Pacific_conservation', '2018-01-01',... | Show conservation efforts in the South Pacific and their timeframes. | SELECT country, program, start_date, end_date FROM conservation_efforts WHERE country IN ('New_Zealand', 'Australia') AND program LIKE '%South_Pacific%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (hospital_name VARCHAR(50), state VARCHAR(50), num_beds INTEGER, offers_mental_health BOOLEAN); INSERT INTO hospitals (hospital_name, state, num_beds, offers_mental_health) VALUES ('Hospital A', 'California', 250, TRUE), ('Hospital B', 'California', 150, FALSE), ('Hospital C', 'Texas', 300, TRUE)... | Identify the number of hospitals in each state that offer mental health services, for hospitals with more than 200 beds. | SELECT state, COUNT(*) as num_hospitals FROM hospitals WHERE offers_mental_health = TRUE AND num_beds > 200 GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_data (user_id INT, workout_type VARCHAR(20), duration INT); INSERT INTO workout_data (user_id, workout_type, duration) VALUES (4, 'Swimming', 300), (5, 'Swimming', 420), (4, 'Swimming', 240), (5, 'Swimming', 540); | What is the total duration of 'Swimming' workouts for each user in the 'workout_data' table? | SELECT user_id, SUM(duration) as total_duration FROM workout_data WHERE workout_type = 'Swimming' GROUP BY user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_adoption (country_name VARCHAR(50), adoption_year INT); | List all countries that have adopted AI in hospitality | SELECT country_name FROM ai_adoption | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (region TEXT, capacity INT); INSERT INTO landfill_capacity (region, capacity) VALUES ('Asia', 500), ('Africa', 200), ('Europe', 300), ('North America', 400); | What is the maximum landfill capacity in gigatons in Europe? | SELECT MAX(capacity) FROM landfill_capacity WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics; USE genetics; CREATE TABLE if not exists projects (id INT PRIMARY KEY, name VARCHAR(255), completion_date DATE); INSERT INTO projects (id, name, completion_date) VALUES (1, 'ProjectX', '2017-12-31'), (2, 'ProjectY', '2018-06-15'), (3, 'ProjectZ', '2019-04-22'), (4, 'ProjectP', '202... | How many genetic research projects were completed each year? | SELECT YEAR(completion_date) AS year, COUNT(*) AS completed_projects FROM projects GROUP BY year ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE AnimalPopulation (AnimalID int, AnimalName varchar(50), Population int); INSERT INTO AnimalPopulation (AnimalID, AnimalName, Population) VALUES (1, 'Tiger', 2500), (2, 'Elephant', 550), (3, 'Giraffe', 1100); | What is the average 'Population' for animals in the 'AnimalPopulation' table grouped by 'AnimalName'? | SELECT AnimalName, AVG(Population) FROM AnimalPopulation GROUP BY AnimalName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fines (ID INT, Type VARCHAR(30), Fine INT); INSERT INTO Fines (ID, Type, Fine) VALUES (1, 'Traffic Violation', 50), (2, 'Misdemeanor', 200), (3, 'Felony', 1000); | What is the average fine for each type of violation? | SELECT Type, AVG(Fine) FROM Fines GROUP BY Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_inventory ( id INT PRIMARY KEY, chemical_name VARCHAR(255), quantity INT, supplier VARCHAR(255), last_updated TIMESTAMP);CREATE TABLE supplier_info ( id INT PRIMARY KEY, supplier_name VARCHAR(255), address VARCHAR(255), country VARCHAR(255));CREATE TABLE chemical_prices ( id INT PRIMARY KEY, chemi... | Identify the top 10% of suppliers with the highest average price of chemicals they supply, ordered by average price in descending order. | SELECT s.supplier_name, AVG(cp.price) AS avg_price FROM supplier_info s JOIN chemical_inventory ci ON s.supplier_name = ci.supplier JOIN chemical_prices cp ON ci.chemical_name = cp.chemical_name GROUP BY s.supplier_name ORDER BY avg_price DESC FETCH FIRST 10 PERCENT ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE fair_labor_practices (practice_id INT, brand_id INT, region TEXT, workers_benefitted INT); | Delete all records from 'fair_labor_practices' table where region is 'Asia'. | DELETE FROM fair_labor_practices WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sanctuary_data (sanctuary_id INT, sanctuary_name VARCHAR(255), region VARCHAR(255), animal_type VARCHAR(255), animal_count INT); INSERT INTO sanctuary_data (sanctuary_id, sanctuary_name, region, animal_type, animal_count) VALUES (1, 'Sanctuary A', 'North', 'Tiger', 25), (2, 'Sanctuary A', 'North', 'Elephan... | What is the total number of animals in each sanctuary, grouped by region? | SELECT region, animal_type, SUM(animal_count) AS total_animals FROM sanctuary_data GROUP BY region, animal_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorney_districts(attorney_id INT, district VARCHAR(20)); INSERT INTO attorney_districts(attorney_id, district) VALUES (1, 'North'), (2, 'South'), (3, 'East'), (4, 'West'), (5, 'North'), (6, 'South'); CREATE TABLE handled_cases(attorney_id INT, case_id INT); INSERT INTO handled_cases(attorney_id, case_id)... | What are the names of attorneys who have handled cases in both the 'North' and 'South' districts? | SELECT h.attorney_id FROM attorney_districts h INNER JOIN (SELECT attorney_id FROM attorney_districts WHERE district = 'North' INTERSECT SELECT attorney_id FROM attorney_districts WHERE district = 'South') i ON h.attorney_id = i.attorney_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE nba_games (team VARCHAR(255), games_played INTEGER); | Find the teams that have played more than 50 games in the "nba_games" table | SELECT team FROM nba_games WHERE games_played > 50 GROUP BY team; | gretelai_synthetic_text_to_sql |
CREATE TABLE ChemicalProduction (date DATE, chemical VARCHAR(10), mass FLOAT); INSERT INTO ChemicalProduction (date, chemical, mass) VALUES ('2021-01-01', 'A', 100), ('2021-01-01', 'B', 150), ('2021-01-02', 'A', 120), ('2021-01-02', 'B', 170); | How many chemical productions were made per day? | SELECT date, COUNT(*) as TotalProductions FROM ChemicalProduction GROUP BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(255)); INSERT INTO teams (team_id, team_name) VALUES (1, 'Knights'), (2, 'Lions'), (3, 'Titans'); CREATE TABLE events (event_id INT, team_id INT, num_tickets_sold INT, total_seats INT); INSERT INTO events (event_id, team_id, num_tickets_sold, total_seats) VALUES (1, 1,... | What is the difference in average ticket sales between the top performing team and the worst performing team? | SELECT AVG(e1.num_tickets_sold) - AVG(e2.num_tickets_sold) as difference_in_avg_tickets_sold FROM events e1, events e2 WHERE e1.team_id = (SELECT team_id FROM teams t JOIN events e ON t.team_id = e.team_id GROUP BY e.team_id ORDER BY AVG(e.num_tickets_sold) DESC LIMIT 1) AND e2.team_id = (SELECT team_id FROM teams t JO... | gretelai_synthetic_text_to_sql |
CREATE TABLE Assistive_Technology (student_id INT, accommodation VARCHAR(255)); INSERT INTO Assistive_Technology VALUES (1, 'Text-to-Speech'); | What is the total number of students who have utilized assistive technology? | SELECT COUNT(DISTINCT student_id) FROM Assistive_Technology | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, name TEXT, program TEXT, hours INT); INSERT INTO volunteers (id, name, program, hours) VALUES (1, 'John Doe', 'Food Distribution', 10), (2, 'Jane Smith', 'Food Distribution', 20); | What is the average number of hours volunteered by volunteers in the Food Distribution program? | SELECT AVG(hours) FROM volunteers WHERE program = 'Food Distribution'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (id INT, name TEXT, mental_health_score INT, community TEXT); INSERT INTO patient (id, name, mental_health_score, community) VALUES (1, 'John Doe', 60, 'Straight'), (2, 'Jane Smith', 70, 'LGBTQ+'), (3, 'Ana Garcia', 50, 'Latino'), (4, 'Sara Johnson', 80, 'African American'); | What is the minimum mental health score for patients who identify as African American or Latino? | SELECT MIN(mental_health_score) FROM patient WHERE community IN ('African American', 'Latino'); | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (region VARCHAR(50), year INT, capacity_m3 FLOAT); INSERT INTO landfill_capacity (region, year, capacity_m3) VALUES ('Africa', 2020, 5000000), ('Africa', 2021, 6000000); | What is the landfill capacity in m3 for 'Africa' in the year 2020? | SELECT capacity_m3 FROM landfill_capacity WHERE region = 'Africa' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sites (SiteID INT, SiteName TEXT); INSERT INTO Sites (SiteID, SiteName) VALUES (1, 'Site-A'), (2, 'Site-B'), (3, 'Site-C'); CREATE TABLE Artifacts (ArtifactID INT, ArtifactName TEXT, SiteID INT, ArtifactType TEXT); INSERT INTO Artifacts (ArtifactID, ArtifactName, SiteID, ArtifactType) VALUES (1, 'Pottery S... | Find the number of unique artifact types per excavation site? | SELECT Sites.SiteName, COUNT(DISTINCT Artifacts.ArtifactType) AS UniqueArtifactTypes FROM Sites INNER JOIN Artifacts ON Sites.SiteID = Artifacts.SiteID GROUP BY Sites.SiteName; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections (location VARCHAR(255), inspection_date DATE, violations INT); INSERT INTO food_safety_inspections (location, inspection_date, violations) VALUES ('Location A', '2022-01-01', 3), ('Location B', '2022-01-02', 5), ('Location A', '2022-01-03', 2), ('Location C', '2022-01-04', 4), ('Loc... | What is the average number of food safety violations per inspection for each location? | SELECT location, AVG(violations) as average_violations FROM food_safety_inspections GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (nation VARCHAR(50), year INT, spending FLOAT); INSERT INTO DefenseDiplomacy (nation, year, spending) VALUES ('France', 2018, 25000000), ('Germany', 2018, 30000000), ('United Kingdom', 2018, 35000000), ('Italy', 2018, 22000000), ('Spain', 2018, 28000000); | What was the total defense diplomacy spending for European nations in 2018? | SELECT SUM(spending) FROM DefenseDiplomacy WHERE nation IN ('France', 'Germany', 'United Kingdom', 'Italy', 'Spain') AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE dapps (id INT, name VARCHAR(50), region VARCHAR(10), daily_tx_volume INT); INSERT INTO dapps (id, name, region, daily_tx_volume) VALUES (1, 'App1', 'Asia', 1000), (2, 'App2', 'Asia', 2000), (3, 'App3', 'Asia', 3000); | Which decentralized applications in Asia have the highest daily transaction volumes? | SELECT name, daily_tx_volume, RANK() OVER (ORDER BY daily_tx_volume DESC) as rank FROM dapps WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists dim_exploration (exploration_id INT PRIMARY KEY, exploration_name VARCHAR(255), location VARCHAR(255)); | List all explorations in the Gulf of Mexico | SELECT exploration_name FROM dim_exploration WHERE location = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, name VARCHAR(100), type VARCHAR(50), state VARCHAR(50)); INSERT INTO Infrastructure (id, name, type, state) VALUES (1, 'Golden Gate Bridge', 'Bridge', 'California'); INSERT INTO Infrastructure (id, name, type, state) VALUES (2, 'Hoover Dam', 'Dam', 'Nevada'); INSERT INTO Infrastruct... | List all airports in the state of New York | SELECT * FROM Infrastructure WHERE state = 'New York' AND type = 'Airport'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RevenueData (RevenueID INT, ProductID INT, Revenue FLOAT, Sustainable BOOLEAN); INSERT INTO RevenueData (RevenueID, ProductID, Revenue, Sustainable) VALUES (1, 1001, 500, true), (2, 1002, 600, false), (3, 1003, 400, true); | What is the total revenue generated from sustainable garments in the last quarter? | SELECT SUM(Revenue) FROM RevenueData WHERE Sustainable = true AND RevenueDate >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (ID INT, Name VARCHAR(50), Cost FLOAT); INSERT INTO Spacecraft VALUES (1, 'Ares', 5000000), (2, 'Orion', 7000000), (3, 'Artemis', 8000000); | What was the most expensive spacecraft? | SELECT Name, MAX(Cost) FROM Spacecraft; | gretelai_synthetic_text_to_sql |
CREATE TABLE ShippingEmissions(year INT, CO2_emissions FLOAT); | What is the total CO2 emissions from Arctic shipping per year? | SELECT year, SUM(CO2_emissions) FROM ShippingEmissions GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (call_id INT, district TEXT, response_time FLOAT); INSERT INTO emergency_calls (call_id, district, response_time) VALUES (1, 'Downtown', 10.5), (2, 'Uptown', 12.0), (3, 'Harbor', 8.0); | What is the average response time for emergency calls in each district? | SELECT district, AVG(response_time) FROM emergency_calls GROUP BY district; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name VARCHAR(50), rating FLOAT); INSERT INTO hotels (hotel_id, name, rating) VALUES (1, 'Hotel X', 4.5), (2, 'Hotel Y', 4.2), (3, 'Hotel Z', 4.7); | Find the hotels in the hotels table that have a higher rating than the average rating of all hotels. | SELECT * FROM hotels WHERE rating > (SELECT AVG(rating) FROM hotels); | gretelai_synthetic_text_to_sql |
CREATE TABLE open_education_resources (resource_id INT PRIMARY KEY, title VARCHAR(100), description TEXT, license VARCHAR(50)); | Delete records with a 'license' of 'CC-BY-NC' from the 'open_education_resources' table | DELETE FROM open_education_resources WHERE license = 'CC-BY-NC'; | gretelai_synthetic_text_to_sql |
CREATE TABLE geothermal_projects (project_id INT, project_name TEXT, country TEXT, capacity_mw FLOAT); INSERT INTO geothermal_projects (project_id, project_name, country, capacity_mw) VALUES (1, 'Geothermal Project A', 'United States', 50), (2, 'Geothermal Project B', 'United States', 75); | What is the total installed capacity (in MW) of geothermal power projects in the United States? | SELECT SUM(capacity_mw) FROM geothermal_projects WHERE country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, country TEXT); CREATE TABLE donations (id INT, donor_id INT, donation_amount FLOAT, organization_id INT); CREATE TABLE organizations (id INT, name TEXT, cause_area TEXT, country TEXT); CREATE TABLE countries (id INT, name TEXT, continent TEXT); | What is the number of unique donors for each cause area, for donors from African countries, categorized by continent? | SELECT c.continent, o.cause_area, COUNT(DISTINCT d.id) as num_unique_donors FROM donors d INNER JOIN donations ON d.id = donations.donor_id INNER JOIN organizations o ON donations.organization_id = o.id INNER JOIN countries ON d.country = countries.name WHERE countries.continent = 'Africa' GROUP BY c.continent, o.cause... | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (threat_id INT, country VARCHAR(255), score INT, threat_date DATE); INSERT INTO threat_intelligence (threat_id, country, score, threat_date) VALUES (1, 'China', 75, '2022-06-01'), (2, 'Japan', 85, '2022-06-02'), (3, 'Australia', 65, '2022-06-03'); | What is the average threat intelligence score for countries in the Asia-Pacific region in the month of June? | SELECT AVG(score) FROM threat_intelligence WHERE EXTRACT(MONTH FROM threat_date) = 6 AND country IN ('China', 'Japan', 'Australia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Disability_Support_Programs (Program_ID INT, Program_Name VARCHAR(50), Budget DECIMAL(10,2), Region VARCHAR(50)); | What is the average budget spent on disability support programs per region? | SELECT AVG(Budget) as Avg_Budget, Region FROM Disability_Support_Programs GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, financial_capability_score INT, has_socially_responsible_loan BOOLEAN); | Display the number of customers who have both a socially responsible loan and a high financial capability score | SELECT COUNT(*) FROM customers WHERE financial_capability_score > 7 AND has_socially_responsible_loan = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, country VARCHAR(50), rating FLOAT); INSERT INTO eco_hotels (hotel_id, country, rating) VALUES (1, 'France', 4.3), (2, 'France', 4.6), (3, 'Germany', 4.5); CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, rating FLOAT); INSERT INTO virtual_tours (tour_id, hotel_id, rating) VA... | What is the average virtual tour rating for eco-friendly hotels in France? | SELECT AVG(vt.rating) FROM virtual_tours vt JOIN eco_hotels eh ON vt.hotel_id = eh.hotel_id WHERE eh.country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BudgetAllocations (Year INT, Service TEXT, Amount INT); INSERT INTO BudgetAllocations (Year, Service, Amount) VALUES (2021, 'Infrastructure', 12000000), (2022, 'Infrastructure', 14000000); | What is the percentage of the budget allocated to infrastructure in 2021 compared to 2022? | SELECT (SUM(CASE WHEN Year = 2022 THEN Amount ELSE 0 END) / SUM(Amount)) * 100.0 FROM BudgetAllocations WHERE Service = 'Infrastructure'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), Age INT, YearsWithCompany INT); INSERT INTO Employees (EmployeeID, Department, Age, YearsWithCompany) VALUES (1, 'Sales', 45, 6), (2, 'Marketing', 30, 2), (3, 'Sales', 50, 8); | What is the maximum age of employees in the Sales department who have been with the company for more than 5 years? | SELECT MAX(Age) FROM Employees WHERE Department = 'Sales' AND YearsWithCompany > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (org_name VARCHAR(255), year INT, operation_name VARCHAR(255)); INSERT INTO peacekeeping_operations (org_name, year, operation_name) VALUES ('NATO', 2016, 'Resolute Support Mission'), ('NATO', 2016, 'Kosovo Force'); | List all peacekeeping operations led by NATO in 2016. | SELECT operation_name FROM peacekeeping_operations WHERE org_name = 'NATO' AND year = 2016; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (id INT, name VARCHAR(255)); CREATE TABLE SpaceMissions (id INT, name VARCHAR(255), astronaut_id INT); INSERT INTO Astronauts (id, name) VALUES (1, 'J. Johnson'), (2, 'R. Riley'); INSERT INTO SpaceMissions (id, name, astronaut_id) VALUES (1, 'Mars Rover', 1), (2, 'ISS', 2); | Which missions did astronaut 'J. Johnson' participate in? | SELECT SpaceMissions.name FROM SpaceMissions JOIN Astronauts ON SpaceMissions.astronaut_id = Astronauts.id WHERE Astronauts.name = 'J. Johnson'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Household_Water_Usage (Household_ID INT, City VARCHAR(20), Year INT, Water_Consumption FLOAT); INSERT INTO Household_Water_Usage (Household_ID, City, Year, Water_Consumption) VALUES (1, 'New Orleans', 2018, 150.5), (2, 'New Orleans', 2019, 130.2); | What is the percentage of households in New Orleans that reduced their water consumption by more than 10% from 2018 to 2019? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Household_Water_Usage WHERE City = 'New Orleans' AND Year = 2018)) AS Percentage FROM Household_Water_Usage WHERE City = 'New Orleans' AND Year = 2019 AND Water_Consumption (SELECT Water_Consumption * 1.1 FROM Household_Water_Usage WHERE City = 'New Orleans' AND Year = 2... | gretelai_synthetic_text_to_sql |
CREATE TABLE BuildingPermits (id INT, state VARCHAR(50), permit_number INT, issued_date DATE); INSERT INTO BuildingPermits VALUES (1, 'New York', 1001, '2021-01-01'); INSERT INTO BuildingPermits VALUES (2, 'New York', 1002, '2021-02-15'); CREATE TABLE ProjectTimelines (id INT, permit_number INT, start_date DATE, end_da... | List the building permits issued in New York in Q1 2021 and their corresponding project timelines. | SELECT bp.permit_number, bp.issued_date, pt.start_date, pt.end_date FROM BuildingPermits bp JOIN ProjectTimelines pt ON bp.permit_number = pt.permit_number WHERE bp.state = 'New York' AND QUARTER(bp.issued_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, country_name VARCHAR(255));CREATE TABLE garments (garment_id INT, garment_name VARCHAR(255), country_id INT, price DECIMAL(10,2), is_sustainable BOOLEAN); | What are the top 3 countries by sales of sustainable fabric garments? | SELECT c.country_name, SUM(g.price) AS total_sales FROM garments g JOIN countries c ON g.country_id = c.country_id WHERE g.is_sustainable = TRUE GROUP BY c.country_name ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE risk_assessments (id INT, region VARCHAR, assessment_date DATE, risk_level INT); INSERT INTO risk_assessments (id, region, assessment_date, risk_level) VALUES (1, 'Middle East', '2019-07-22', 7); INSERT INTO risk_assessments (id, region, assessment_date, risk_level) VALUES (2, 'North Africa', '2019-09-10',... | List the geopolitical risk assessments for the Middle East and North Africa in Q3 2019. | SELECT region, risk_level FROM risk_assessments WHERE region IN ('Middle East', 'North Africa') AND assessment_date BETWEEN '2019-07-01' AND '2019-09-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers (id INT, name VARCHAR(20), department VARCHAR(20)); CREATE TABLE products (id INT, worker_id INT, name VARCHAR(20), material VARCHAR(20), quantity INT); INSERT INTO workers (id, name, department) VALUES (1, 'Alice', 'textiles'), (2, 'Bob', 'textiles'), (3, 'Charlie', 'metallurgy'), (4, 'Dave', 'met... | Get the names of workers and the number of products they have produced | SELECT w.name, COUNT(p.id) FROM workers w INNER JOIN products p ON w.id = p.worker_id GROUP BY w.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_temperature (id INT, ocean_name VARCHAR(20), avg_temp DECIMAL(5,2)); INSERT INTO ocean_temperature (id, ocean_name, avg_temp) VALUES (1, 'Indian', 28.2), (2, 'Atlantic', 26.7); | What is the average water temperature in the Indian Ocean? | SELECT AVG(avg_temp) FROM ocean_temperature WHERE ocean_name = 'Indian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (item_name VARCHAR(255), price DECIMAL(10,2)); INSERT INTO menu_items (item_name, price) VALUES ('Pizza', 12.99), ('Burrito', 9.99), ('Sushi', 13.99); | Update the price of the 'Sushi' menu item to $14.99 | UPDATE menu_items SET price = 14.99 WHERE item_name = 'Sushi'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (satellite_id INT, country VARCHAR(50)); INSERT INTO satellites (satellite_id, country) VALUES (1, 'USA'), (2, 'Russia'), (3, 'China'), (4, 'India'), (5, 'Japan'); CREATE TABLE space_debris (debris_id INT, country VARCHAR(50)); INSERT INTO space_debris (debris_id, country) VALUES (1, 'USA'), (2,... | What is the total number of satellites and space debris objects in orbit, for each country? | SELECT s.country, COUNT(s.satellite_id) + COUNT(d.debris_id) as total_objects FROM satellites s FULL OUTER JOIN space_debris d ON s.country = d.country GROUP BY s.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_assistance (id INT, name TEXT, age INT, country TEXT, year INT); INSERT INTO medical_assistance (id, name, age, country, year) VALUES (1, 'Ali', 30, 'Yemen', 2022), (2, 'Fatima', 40, 'Yemen', 2022), (3, 'Ahmed', 50, 'Yemen', 2022); | What is the name and age of the oldest person who received medical assistance in Yemen in 2022? | SELECT name, age FROM medical_assistance WHERE country = 'Yemen' AND year = 2022 ORDER BY age DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE coral_species (id INT, location VARCHAR(50), species_name VARCHAR(50), num_species INT); INSERT INTO coral_species (id, location, species_name, num_species) VALUES (1, 'Coral Triangle', 'Acropora', 150); INSERT INTO coral_species (id, location, species_name, num_species) VALUES (2, 'Coral Triangle', 'Porit... | What is the minimum number of coral species in the Coral Triangle? | SELECT MIN(num_species) FROM coral_species WHERE location = 'Coral Triangle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wildlife_habitats (id INT, country VARCHAR(255), region VARCHAR(255), habitat_type VARCHAR(255)); | How many wildlife habitats are in South America? | SELECT COUNT(DISTINCT habitat_type) FROM wildlife_habitats WHERE region = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Genres (genre_id INT, genre_name TEXT); CREATE TABLE Sales (sale_id INT, genre_id INT, revenue INT); | Which genres have the highest and lowest revenue? | SELECT genre_name, MAX(revenue) as max_revenue, MIN(revenue) as min_revenue FROM Genres JOIN Sales ON Genres.genre_id = Sales.genre_id GROUP BY genre_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_launches (launch_date DATE, product_type VARCHAR(20)); INSERT INTO product_launches (launch_date, product_type) VALUES ('2022-01-05', 'vegan skincare'), ('2022-01-10', 'conventional skincare'), ('2022-02-15', 'vegan skincare'), ('2022-03-20', 'vegan skincare'), ('2022-03-30', 'organic makeup'); | Determine the number of vegan skincare products launched in Q1 2022 | SELECT COUNT(*) FROM product_launches WHERE product_type = 'vegan skincare' AND launch_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_strategies (strategy TEXT, cost INTEGER); INSERT INTO cybersecurity_strategies (strategy, cost) VALUES ('Firewall Implementation', 5000), ('Intrusion Detection System', 7000), ('Penetration Testing', 3000); | List all cybersecurity strategies and their respective costs in descending order. | SELECT strategy, cost FROM cybersecurity_strategies ORDER BY cost DESC | 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.