context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE FertilizerSales (id INT PRIMARY KEY, year INT, region VARCHAR(20), cost FLOAT);
What's the total cost of fertilizers sold in 2022 in the Southern region?
SELECT SUM(cost) FROM FertilizerSales WHERE year = 2022 AND region = 'Southern';
gretelai_synthetic_text_to_sql
CREATE TABLE trend_forecasts (id INT PRIMARY KEY, trend VARCHAR(100), popularity_score INT);
Create a table named 'trend_forecasts' for storing fashion trend forecasts
CREATE TABLE trend_forecasts (id INT PRIMARY KEY, trend VARCHAR(100), popularity_score INT);
gretelai_synthetic_text_to_sql
CREATE TABLE texas_energy (id INT, source TEXT, generation FLOAT); INSERT INTO texas_energy (id, source, generation) VALUES (1, 'wind', 23456.7), (2, 'solar', 34567.7);
What is the average energy generation from renewable sources in Texas?
SELECT AVG(generation) FROM texas_energy WHERE source IN ('wind', 'solar');
gretelai_synthetic_text_to_sql
CREATE TABLE model_performance (model_name VARCHAR(20), prediction VARCHAR(20), fairness_score FLOAT); INSERT INTO model_performance (model_name, prediction, fairness_score) VALUES ('Fairlearn', 'fairness', 0.85), ('Fairlearn', 'bias', 0.91), ('AIF360', 'fairness', 0.78), ('AIF360', 'explainability', 0.95);
What is the distribution of fairness scores for AI models 'Fairlearn' and 'AIF360' in the 'model_performance' table, grouped by prediction?
SELECT model_name, prediction, COUNT(*) as count, AVG(fairness_score) as avg_score FROM model_performance WHERE model_name IN ('Fairlearn', 'AIF360') GROUP BY model_name, prediction;
gretelai_synthetic_text_to_sql
CREATE TABLE articles (article_id INT, author_id INT, title VARCHAR(100), pub_date DATE); CREATE TABLE authors (author_id INT, author_name VARCHAR(50), country VARCHAR(50));
Identify the total number of articles published in 'articles' table, grouped by the author in 'authors' table.
SELECT authors.author_name, COUNT(articles.article_id) FROM articles INNER JOIN authors ON articles.author_id = authors.author_id GROUP BY authors.author_name;
gretelai_synthetic_text_to_sql
CREATE TABLE Missions (ID INT, Manufacturer VARCHAR(255), Year INT); INSERT INTO Missions (ID, Manufacturer, Year) VALUES (1, 'SpaceCorp', 2025), (2, 'SpaceCorp', 2025), (3, 'SpaceCorp', 2026);
How many missions were conducted by SpaceCorp in 2025?
SELECT COUNT(*) FROM Missions WHERE Manufacturer = 'SpaceCorp' AND Year = 2025;
gretelai_synthetic_text_to_sql
CREATE TABLE veteran_employment (employment_id INT, employment_date DATE, company TEXT, job_category TEXT, is_veteran BOOLEAN); INSERT INTO veteran_employment (employment_id, employment_date, company, job_category, is_veteran) VALUES (1, '2022-04-01', 'ACME Inc', 'Engineering', true), (2, '2022-05-15', 'Beta Corp', 'Ma...
What is the percentage of veteran employment in the defense industry, by job category, for the past three months?
SELECT job_category, ROUND(100.0 * SUM(CASE WHEN is_veteran THEN 1 ELSE 0 END) / COUNT(*), 2) as pct_veteran_employment FROM veteran_employment WHERE employment_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) AND CURRENT_DATE GROUP BY job_category;
gretelai_synthetic_text_to_sql
CREATE TABLE project_data (project_number INT, city VARCHAR(20), is_sustainable BOOLEAN); INSERT INTO project_data (project_number, city, is_sustainable) VALUES (1, 'New York', TRUE); INSERT INTO project_data (project_number, city, is_sustainable) VALUES (2, 'New York', FALSE);
How many sustainable construction projects were completed in New York?
SELECT COUNT(*) FROM project_data WHERE city = 'New York' AND is_sustainable = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE Traditional_Arts_Centers (Center_Name VARCHAR(50), Country VARCHAR(50), Type VARCHAR(50)); INSERT INTO Traditional_Arts_Centers (Center_Name, Country, Type) VALUES ('Tanjungpura Palace', 'Indonesia', 'Dance'), ('Sawang Boran', 'Thailand', 'Shadow Puppetry'), ('The Australian Ballet', 'Australia', 'Ballet')...
How many traditional arts centers exist in the Asia-Pacific region, broken down by country?
SELECT Country, COUNT(*) FROM Traditional_Arts_Centers WHERE Country IN ('Indonesia', 'Thailand', 'Australia') GROUP BY Country;
gretelai_synthetic_text_to_sql
CREATE TABLE OperaPerformances2 (TheatreName TEXT, PerformanceDate DATE); INSERT INTO OperaPerformances2 (TheatreName, PerformanceDate) VALUES ('Berlin Opera', '2022-01-01'), ('Berlin Opera', '2022-02-15'), ('Berlin Opera', '2022-04-20');
How many performances were there at the "Berlin Opera" in 2022?
SELECT COUNT(*) FROM OperaPerformances2 WHERE TheatreName = 'Berlin Opera' AND YEAR(PerformanceDate) = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE social_loans (lender VARCHAR(50), region VARCHAR(50), loan_count INT); INSERT INTO social_loans (lender, region, loan_count) VALUES ('ABC Bank', 'Latin America', 500), ('DEF Bank', 'Asia', 700), ('GHI Bank', 'Latin America', 300);
How many socially responsible loans were issued in the Latin American region?
SELECT SUM(loan_count) FROM social_loans WHERE region = 'Latin America';
gretelai_synthetic_text_to_sql
CREATE TABLE department (id INT, name VARCHAR(255), manager_id INT, location VARCHAR(255)); INSERT INTO department (id, name, manager_id, location) VALUES (1, 'textiles', 101, 'New York'); INSERT INTO department (id, name, manager_id, location) VALUES (2, 'metallurgy', 102, 'Chicago'); CREATE TABLE employee (id INT, na...
How many employees work in each department in New York?
SELECT department_id, COUNT(*) as employee_count FROM employee INNER JOIN department_location ON employee.department_id = department_location.department_id WHERE location = 'New York' GROUP BY department_id;
gretelai_synthetic_text_to_sql
CREATE TABLE labor_practices3 (product_id INT, brand VARCHAR(255), quantity_sold INT);
Insert a new record into the 'labor_practices3' table for a brand with the name 'BrandU', a product_id of 6, and a quantity_sold of 750.
INSERT INTO labor_practices3 (product_id, brand, quantity_sold) VALUES (6, 'BrandU', 750);
gretelai_synthetic_text_to_sql
CREATE TABLE products (product_id INT, supplier_id INT, sourcing_country VARCHAR(50)); CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(50), ethical_rating INT); INSERT INTO products (product_id, supplier_id, sourcing_country) VALUES (1, 101, 'USA'), (2, 102, 'Brazil'), (3, 103, 'Canada'); INSERT INTO sup...
Update the supplier information for products sourced from a high-risk country
UPDATE products p JOIN suppliers s ON p.supplier_id = s.supplier_id SET p.supplier_id = 999 WHERE p.sourcing_country = 'Brazil';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance(project_name TEXT, country TEXT, source TYPE, budget FLOAT); INSERT INTO climate_finance(project_name, country, source, budget) VALUES ('Project A', 'Kenya', 'Public', 300000.00), ('Project B', 'Nigeria', 'Private', 400000.00), ('Project C', 'Egypt', 'Public', 500000.00), ('Project D', 'Sou...
Which African countries have received climate finance from both public and private sources?
SELECT country FROM climate_finance WHERE source IN ('Public', 'Private') GROUP BY country HAVING COUNT(DISTINCT source) = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE disaster_response (id INT, organization VARCHAR(50), location VARCHAR(50), assistance_type VARCHAR(50), quantity INT); INSERT INTO disaster_response (id, organization, location, assistance_type, quantity) VALUES (1, 'WFP', 'Syria', 'Food', 5000), (2, 'UNWRA', 'Gaza', 'Food', 3000), (3, 'IFRC', 'Syria', 'Sh...
Which organizations provided the most assistance in 'disaster_response' table, and what types of assistance did they provide?
SELECT organization, assistance_type, SUM(quantity) as total_quantity FROM disaster_response GROUP BY organization, assistance_type ORDER BY total_quantity DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE field_precipitation (field_id INT, date DATE, precipitation FLOAT); INSERT INTO field_precipitation (field_id, date, precipitation) VALUES (5, '2021-06-15', 12.5), (5, '2021-06-20', 8.3), (5, '2021-07-01', 15.2), (5, '2021-07-05', 5.4);
How many times did field 5 have precipitation over 5mm in the last 14 days?
SELECT field_id, COUNT(*) as precipitation_days FROM field_precipitation WHERE field_id = 5 AND precipitation > 5 GROUP BY field_id HAVING precipitation_days > 0;
gretelai_synthetic_text_to_sql
CREATE TABLE electric_vehicles (id INT, city_id INT, make VARCHAR(50), model VARCHAR(50), year INT, sales INT); INSERT INTO electric_vehicles (id, city_id, make, model, year, sales) VALUES (1, 1, 'Tesla', 'Model S', 2020, 5000); INSERT INTO electric_vehicles (id, city_id, make, model, year, sales) VALUES (2, 1, 'Tesla'...
What is the total number of electric vehicles sold by make and model?
SELECT electric_vehicles.make, electric_vehicles.model, SUM(electric_vehicles.sales) as total_sales FROM electric_vehicles GROUP BY electric_vehicles.make, electric_vehicles.model;
gretelai_synthetic_text_to_sql
CREATE TABLE drought_impact (region VARCHAR(255), drought_category VARCHAR(255), month DATE, usage INT); INSERT INTO drought_impact (region, drought_category, month, usage) VALUES ('Western', 'Severe', '2019-01-01', 12000);
What is the total water usage for each drought category in the western region in 2019?'
SELECT region, drought_category, SUM(usage) FROM drought_impact WHERE region = 'Western' AND YEAR(month) = 2019 GROUP BY region, drought_category;
gretelai_synthetic_text_to_sql
CREATE TABLE military_sales(id INT, country VARCHAR(50), sale_value FLOAT, sale_date DATE); INSERT INTO military_sales(id, country, sale_value, sale_date) VALUES (1, 'UK', 5000000, '2019-01-01'); INSERT INTO military_sales(id, country, sale_value, sale_date) VALUES (2, 'UK', 3000000, '2019-02-01');
Find military equipment sales to country 'UK' with sale dates in 2019, grouped by month.
SELECT sale_date, SUM(sale_value) FROM military_sales WHERE country = 'UK' AND YEAR(sale_date) = 2019 GROUP BY MONTH(sale_date);
gretelai_synthetic_text_to_sql
CREATE TABLE NewStudents (StudentID INT, State VARCHAR(10), Counseling VARCHAR(10)); INSERT INTO NewStudents (StudentID, State, Counseling) VALUES (1, 'OR', 'Completed'), (2, 'WA', 'Completed');
Insert new student records for 'Oregon' and 'Washington' who have completed their mental health counseling
INSERT INTO NewStudents (StudentID, State, Counseling) VALUES (3, 'Oregon', 'Completed'), (4, 'Washington', 'Completed');
gretelai_synthetic_text_to_sql
CREATE TABLE drug_approvals (country TEXT, approval_date DATE); CREATE TABLE drugs (drug_id INTEGER, approval_country TEXT); CREATE TABLE drug_approval_dates (drug_id INTEGER, approval_date DATE);
List all countries and their average drug approval time since 2000.
SELECT country, AVG(DATEDIFF('day', approval_date, lead(approval_date) OVER (PARTITION BY country ORDER BY approval_date))) AS avg_approval_time FROM drug_approvals JOIN drugs ON drug_approvals.country = drugs.approval_country JOIN drug_approval_dates ON drugs.drug_id = drug_approval_dates.drug_id WHERE approval_date >...
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists safety_researchers (researcher_id INT PRIMARY KEY, name TEXT, paper_id INT); INSERT INTO safety_researchers (researcher_id, name, paper_id) VALUES (101, 'Alice', NULL), (102, 'Bob', 201), (103, 'Charlie', NULL), (104, 'Dave', 202);
What are the names and countries of AI safety researchers who have not published any papers?
SELECT name, country FROM safety_researchers WHERE paper_id IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists countries (id INT, name VARCHAR(20)); INSERT INTO countries (id, name) VALUES (1, 'Canada'), (2, 'Mexico'), (3, 'United States'); CREATE TABLE if not exists visitors (id INT, country_id INT, year INT, visitors INT, carbon_footprint INT);
What is the average carbon footprint per international visitor in North America?
SELECT c.name, AVG(v.carbon_footprint/v.visitors) FROM visitors v JOIN countries c ON v.country_id = c.id WHERE c.name IN ('Canada', 'Mexico', 'United States') GROUP BY c.name;
gretelai_synthetic_text_to_sql
CREATE TABLE Autonomous_Vehicles_Speed (id INT, name TEXT, max_speed FLOAT); INSERT INTO Autonomous_Vehicles_Speed (id, name, max_speed) VALUES (1, 'AutoX', 110.5); INSERT INTO Autonomous_Vehicles_Speed (id, name, max_speed) VALUES (2, 'AutoY', 120.0);
What is the average speed of all autonomous vehicles?
SELECT AVG(max_speed) FROM Autonomous_Vehicles_Speed;
gretelai_synthetic_text_to_sql
CREATE TABLE CompanyRevenue (CompanyID INT, Region VARCHAR(10), Revenue INT); INSERT INTO CompanyRevenue (CompanyID, Region, Revenue) VALUES (1, 'North America', 500000), (2, 'Europe', 700000), (3, 'North America', 600000), (4, 'Asia', 800000);
What is the total revenue generated from each region?
SELECT Region, SUM(Revenue) FROM CompanyRevenue GROUP BY Region;
gretelai_synthetic_text_to_sql
CREATE TABLE AircraftManufacturing (aircraft_id INT, manufacturer VARCHAR(50), country VARCHAR(50));
List all aircraft manufactured in the US.
SELECT aircraft_id, manufacturer FROM AircraftManufacturing WHERE country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE workouts (workout_id INT, member_id INT, distance FLOAT, region VARCHAR(20)); INSERT INTO workouts (workout_id, member_id, distance, region) VALUES (1, 1, 2.5, 'North'), (2, 2, 3.2, 'South'), (3, 3, 1.8, 'East');
What is the average distance walked by members in each region, in ascending order?
SELECT AVG(distance) as avg_distance, region FROM workouts GROUP BY region ORDER BY avg_distance ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE non_profit (id INT, name TEXT); INSERT INTO non_profit (id, name) VALUES (1, 'Habitat for Humanity'), (2, 'American Red Cross'), (3, 'Doctors Without Borders'); CREATE TABLE donations (id INT, non_profit_id INT, donation_amount INT, donation_date DATE); INSERT INTO donations (id, non_profit_id, donation_am...
Update the donation amounts for the 'Doctors Without Borders' non-profit that were made in the last month, increasing them by 10%.
UPDATE donations d SET donation_amount = d.donation_amount * 1.10 WHERE d.non_profit_id = 3 AND d.donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE revenue (year INT, continent TEXT, revenue INT); INSERT INTO revenue (year, continent, revenue) VALUES (2017, 'North America', 50000000), (2018, 'North America', 55000000), (2019, 'North America', 60000000), (2020, 'North America', 30000000), (2017, 'South America', 30000000), (2018, 'South America', 33000...
Calculate the total revenue generated by a specific continent's tourism industry in the last 5 years.
SELECT continent, SUM(revenue) as total_revenue FROM revenue WHERE year >= (SELECT MAX(year) - 5 FROM revenue) GROUP BY continent;
gretelai_synthetic_text_to_sql
CREATE TABLE digital_assets (asset_id varchar(10), asset_name varchar(10)); INSERT INTO digital_assets (asset_id, asset_name) VALUES ('ETH', 'Ethereum'), ('BTC', 'Bitcoin'); CREATE TABLE transactions (transaction_id serial, asset_id varchar(10), transaction_amount numeric); INSERT INTO transactions (asset_id, transacti...
Find the total number of transactions for all digital assets.
SELECT COUNT(*) FROM transactions;
gretelai_synthetic_text_to_sql
CREATE TABLE companies (id INT, sector VARCHAR(20))
List all companies in the 'renewable_energy' sector
SELECT * FROM companies WHERE sector = 'renewable_energy'
gretelai_synthetic_text_to_sql
CREATE TABLE residential_water_usage (state VARCHAR(20), year INT, usage FLOAT); INSERT INTO residential_water_usage (state, year, usage) VALUES ('Texas', 2021, 12345.6); CREATE TABLE industrial_water_usage (state VARCHAR(20), year INT, sector VARCHAR(30), usage FLOAT); INSERT INTO industrial_water_usage (state, year, ...
What is the difference in water usage between the residential and industrial sectors in Texas in 2021?
SELECT SUM(residential_water_usage.usage) - SUM(industrial_water_usage.usage) FROM residential_water_usage, industrial_water_usage WHERE residential_water_usage.state = 'Texas' AND residential_water_usage.year = 2021 AND industrial_water_usage.state = 'Texas' AND industrial_water_usage.year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE chemical_compounds(id INT, compound_name TEXT, environmental_impact_score INT); CREATE TABLE production_sites(id INT, site_name TEXT, location TEXT); INSERT INTO chemical_compounds (id, compound_name, environmental_impact_score) VALUES (1, 'Compound X', 60), (2, 'Compound Y', 70); INSERT INTO production_si...
List all chemical compounds and their corresponding environmental impact scores for production sites in Brazil.
SELECT chemical_compounds.compound_name, chemical_compounds.environmental_impact_score FROM chemical_compounds INNER JOIN production_sites ON chemical_compounds.id = production_sites.id WHERE production_sites.location = 'Brazil';
gretelai_synthetic_text_to_sql
CREATE TABLE indigenous_communities (id INT PRIMARY KEY, community VARCHAR(50), population INT, region VARCHAR(50)); INSERT INTO indigenous_communities (id, community, population, region) VALUES (1, 'Yamal Nenets', 5000, 'Siberia'); INSERT INTO indigenous_communities (id, community, population, region) VALUES (2, 'Even...
Delete all records from indigenous_communities table where region is 'Siberia'
WITH cte AS (DELETE FROM indigenous_communities WHERE region = 'Siberia') SELECT * FROM indigenous_communities;
gretelai_synthetic_text_to_sql
CREATE TABLE researchers (id INT PRIMARY KEY, name VARCHAR(50), affiliation VARCHAR(50));
Delete the researcher 'John Doe' from the researchers table.
DELETE FROM researchers WHERE name = 'John Doe';
gretelai_synthetic_text_to_sql
CREATE TABLE production (country VARCHAR(255), year INT, element VARCHAR(10), quantity INT); INSERT INTO production (country, year, element, quantity) VALUES ('Russia', 2018, 'Eu', 1500);
Update Europium production records in Russia for 2018 by 10%.
UPDATE production SET quantity = ROUND(quantity * 1.10) WHERE country = 'Russia' AND year = 2018 AND element = 'Eu';
gretelai_synthetic_text_to_sql
CREATE TABLE emergency_responses (id INT, incident_id INT, response_time INT, city VARCHAR(255), state VARCHAR(255)); INSERT INTO emergency_responses (id, incident_id, response_time, city, state) VALUES (1, 1, 8, 'Austin', 'Texas'); INSERT INTO emergency_responses (id, incident_id, response_time, city, state) VALUES (2...
What is the average response time for medical emergencies in each city in Texas?
SELECT city, AVG(response_time) FROM emergency_responses WHERE state = 'Texas' AND incident_type = 'Medical Emergency' GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE Green_Buildings (Project_ID INT, Project_Name VARCHAR(255), State VARCHAR(255), Labor_Cost DECIMAL(10,2)); INSERT INTO Green_Buildings (Project_ID, Project_Name, State, Labor_Cost) VALUES (1, 'Solar Farm', 'California', 150000.00), (2, 'Wind Turbine Park', 'California', 200000.00);
What are the labor costs for green building projects in California, grouped by project name?
SELECT Project_Name, SUM(Labor_Cost) FROM Green_Buildings WHERE State = 'California' GROUP BY Project_Name;
gretelai_synthetic_text_to_sql
CREATE TABLE electric_ferries (id INT PRIMARY KEY, ferry_name VARCHAR(255), departure_city VARCHAR(255), destination_city VARCHAR(255), num_ferries INT, capacity INT);
Update the total number of electric ferries for the new Vancouver-Victoria service
UPDATE electric_ferries SET num_ferries = 15 WHERE ferry_name = 'Sea Spirit';
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours(tour_id INT, name TEXT, country TEXT, num_reviews INT); INSERT INTO virtual_tours (tour_id, name, country, num_reviews) VALUES (1, 'Museum Tour', 'Spain', 1200), (2, 'Historic City Tour', 'Italy', 800);
List the virtual tours in Spain with more than 1000 reviews.
SELECT name FROM virtual_tours WHERE country = 'Spain' AND num_reviews > 1000;
gretelai_synthetic_text_to_sql
CREATE TABLE environmental_impact (chemical_name VARCHAR(255), impact_description TEXT);
List all chemicals with environmental impact data
SELECT chemical_name FROM environmental_impact;
gretelai_synthetic_text_to_sql
CREATE TABLE Styles (id INT PRIMARY KEY, style VARCHAR(20), season VARCHAR(20)); INSERT INTO Styles (id, style, season) VALUES (1, 'New_Style_1', 'Fall'), (2, 'New_Style_2', 'Fall'), (3, 'Existing_Style_1', 'Fall');
Count the number of new styles launched in the Fall season.
SELECT COUNT(*) FROM Styles WHERE season = 'Fall';
gretelai_synthetic_text_to_sql
CREATE TABLE broadband_speeds (speed_id INT, country VARCHAR(255), speed DECIMAL(10,2)); INSERT INTO broadband_speeds (speed_id, country, speed) VALUES (1, 'USA', 100.00), (2, 'Canada', 150.00), (3, 'Mexico', 75.00);
What is the average broadband speed in each country?
SELECT country, AVG(speed) AS avg_speed FROM broadband_speeds GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE reverse_logistics (id INT, country VARCHAR(255), shipment_date DATE);INSERT INTO reverse_logistics (id, country, shipment_date) VALUES (1, 'USA', '2021-01-05'), (2, 'Canada', '2021-01-10'), (3, 'Mexico', '2021-02-01');
How many reverse logistics shipments were made to each country in the month of January 2021?
SELECT country, COUNT(id) as shipment_count FROM reverse_logistics WHERE shipment_date BETWEEN '2021-01-01' AND '2021-01-31' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE military_innovation (id INT, weapon_system VARCHAR(255), country VARCHAR(255), year INT);
Show the total spending on military innovation by each country for the year 2020
SELECT country, SUM(year) FROM military_innovation WHERE year = 2020 GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_practices (employee_id INT, first_name VARCHAR(50), last_name VARCHAR(50), gender VARCHAR(10), position VARCHAR(50), hours_worked INT); INSERT INTO sustainable_practices (employee_id, first_name, last_name, gender, position, hours_worked) VALUES (3, 'Alice', 'Johnson', 'Female', 'Analyst', 30);...
How many employees work in the 'technician' position in the 'sustainable_practices' table?
SELECT COUNT(*) FROM sustainable_practices WHERE position = 'Technician';
gretelai_synthetic_text_to_sql
CREATE TABLE volunteers (volunteer_id INT, org_id INT);CREATE TABLE programs (program_id INT, program_category_id INT);CREATE TABLE donations (donation_id INT, donor_id INT, program_id INT, donation_amount DECIMAL(10,2)); INSERT INTO volunteers (volunteer_id, org_id) VALUES (1, 1), (2, 1), (3, 2), (4, 2), (5, 3), (6, 3...
What is the average donation amount per volunteer by program category?
SELECT pc.program_category_name, AVG(d.donation_amount) as avg_donation_amount_per_volunteer FROM programs p JOIN donations d ON p.program_id = d.program_id JOIN volunteers v ON p.org_id = v.org_id JOIN program_categories pc ON p.program_category_id = pc.program_category_id GROUP BY pc.program_category_name;
gretelai_synthetic_text_to_sql
CREATE TABLE incident_resolution (id INT, asset_type VARCHAR(50), resolution_time INT); INSERT INTO incident_resolution (id, asset_type, resolution_time) VALUES (1, 'network', 120), (2, 'server', 150), (3, 'workstation', 180);
What is the average time to resolve security incidents for each asset type?
SELECT asset_type, AVG(resolution_time) as avg_resolution_time FROM incident_resolution GROUP BY asset_type;
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE, day VARCHAR(10)); INSERT INTO Exhibitions (exhibition_id, name, start_date, end_date, day) VALUES (1, 'Impressionist', '2020-05-01', '2021-01-01', 'Saturday'), (2, 'Cubism', '2019-08-15', '2020-03-30', 'Saturday'), (3, 'Surre...
What is the average age of visitors who attended the Cubism exhibition on Saturday?
SELECT AVG(age) FROM Visitors INNER JOIN Exhibitions ON Visitors.exhibition_id = Exhibitions.exhibition_id WHERE Exhibitions.name = 'Cubism' AND day = 'Saturday';
gretelai_synthetic_text_to_sql
CREATE TABLE electric_buses (bus_id INT, registration_date TIMESTAMP, bus_type VARCHAR(50), city VARCHAR(50));
How many electric buses are operating in Beijing?
SELECT COUNT(*) as num_buses FROM electric_buses WHERE city = 'Beijing';
gretelai_synthetic_text_to_sql
CREATE TABLE offenses (offense_id INT, offense_type VARCHAR(255), state VARCHAR(2)); INSERT INTO offenses (offense_id, offense_type, state) VALUES (1, 'Theft', 'TX'); INSERT INTO offenses (offense_id, offense_type, state) VALUES (2, 'DWI', 'CA'); INSERT INTO offenses (offense_id, offense_type, state) VALUES (3, 'Theft'...
What is the most common offense type in Texas?
SELECT offense_type, COUNT(*) AS count FROM offenses WHERE state = 'TX' GROUP BY offense_type ORDER BY count DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Rock_Classification (Mine_Name VARCHAR(50), Rock_Type VARCHAR(50), Year INT); INSERT INTO Rock_Classification (Mine_Name, Rock_Type, Year) VALUES ('Emerald Peaks', 'Granite', 2019), ('Ruby Ridge', 'Basalt', 2019), ('Sapphire Summit', 'Gneiss', 2019);
Update the rock type to 'schist' for the mine named 'Emerald Peaks' in the latest year.
UPDATE Rock_Classification SET Rock_Type = 'Schist' WHERE Mine_Name = 'Emerald Peaks' AND Year = (SELECT MAX(Year) FROM Rock_Classification);
gretelai_synthetic_text_to_sql
CREATE TABLE Players (PlayerID INT, Age INT, Platform VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Platform) VALUES (1, 25, 'PC'), (2, 30, 'Console'), (3, 22, 'Console'); CREATE TABLE EsportsEvents (EventID INT, PlayerID INT); INSERT INTO EsportsEvents (EventID, PlayerID) VALUES (1, 1), (2, 2), (3, 3), (4, 2), (5,...
Find the number of distinct esports events that each console player has participated in.
SELECT p1.PlayerID, COUNT(DISTINCT e.EventID) as NumEvents FROM Players p1 JOIN EsportsEvents e ON p1.PlayerID = e.PlayerID WHERE p1.Platform = 'Console' GROUP BY p1.PlayerID;
gretelai_synthetic_text_to_sql
CREATE TABLE canada_provinces (id INT, name VARCHAR(255)); CREATE TABLE covid_cases (id INT, province_id INT, cases INT); INSERT INTO canada_provinces (id, name) VALUES (1, 'Ontario'), (2, 'Quebec'), (3, 'British Columbia'), (4, 'Alberta'), (5, 'Manitoba');
How many COVID-19 cases have been reported in each province of Canada?
SELECT p.name, SUM(c.cases) FROM covid_cases c JOIN canada_provinces p ON c.province_id = p.id GROUP BY p.name;
gretelai_synthetic_text_to_sql
CREATE TABLE YttriumProduction (country VARCHAR(50), year INT, production INT); INSERT INTO YttriumProduction (country, year, production) VALUES ('China', 2020, 1200), ('China', 2021, 1100), ('USA', 2020, 1000), ('USA', 2021, 1100), ('Australia', 2020, 800), ('Australia', 2021, 700);
Which country had the largest decrease in Yttrium production from 2020 to 2021?
SELECT country, MIN(production_change) FROM (SELECT country, (production - LAG(production) OVER (PARTITION BY country ORDER BY year)) AS production_change FROM YttriumProduction) AS subquery WHERE production_change IS NOT NULL GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE employees (id INT, industry VARCHAR(20), union_member BOOLEAN); INSERT INTO employees (id, industry, union_member) VALUES (1, 'technology', TRUE), (2, 'finance', FALSE), (3, 'technology', FALSE);
Find the number of employees who are members of unions in the 'technology' industry
SELECT COUNT(*) FROM employees WHERE industry = 'technology' AND union_member = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE cause (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE donation (id INT PRIMARY KEY, cause_id INT, amount DECIMAL(10,2));
What's the average donation for each cause?
SELECT c.name, AVG(d.amount) AS avg_donations FROM cause c JOIN donation d ON c.id = d.cause_id GROUP BY c.id;
gretelai_synthetic_text_to_sql
CREATE TABLE eco_hotels (hotel_id INT, hotel_name TEXT, country TEXT, local_impact INT); INSERT INTO eco_hotels (hotel_id, hotel_name, country, local_impact) VALUES (1, 'Eco-Friendly Hotel A', 'Brazil', 500000), (2, 'Eco-Friendly Hotel B', 'Brazil', 600000);
What is the maximum local economic impact of eco-friendly hotels in Brazil?
SELECT MAX(local_impact) FROM eco_hotels WHERE country = 'Brazil';
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists gas_wells (id INT PRIMARY KEY, well_name TEXT, location TEXT); INSERT INTO gas_wells (id, well_name, location) VALUES (1, 'Well D', 'Gulf of Mexico'), (2, 'Well E', 'South Atlantic'), (3, 'Well F', 'Gulf of Mexico');
What are the names of all gas wells in the 'Gulf of Mexico'?
SELECT well_name FROM gas_wells WHERE location = 'Gulf of Mexico';
gretelai_synthetic_text_to_sql
CREATE TABLE artists (artist_id INT, genre VARCHAR(10), platform VARCHAR(10)); CREATE TABLE sales (sale_id INT, genre VARCHAR(10), platform VARCHAR(10), sales FLOAT);
Find the number of unique artists per platform, for R&B and hip-hop genres.
SELECT platform, COUNT(DISTINCT artist_id) FROM artists WHERE genre IN ('R&B', 'hip-hop') GROUP BY platform;
gretelai_synthetic_text_to_sql
CREATE TABLE drug_approval (drug_name TEXT, approval_date DATE);
When was the first approval date for 'DrugC'?
SELECT MIN(approval_date) FROM drug_approval WHERE drug_name = 'DrugC';
gretelai_synthetic_text_to_sql
CREATE TABLE endangered_animal_profiles (id INT, animal_name VARCHAR(50), age INT, species_id INT); INSERT INTO endangered_animal_profiles (id, animal_name, age, species_id) VALUES (1, 'Amur Leopard', 8, 1001), (2, 'Black Rhino', 10, 1002), (3, 'Sumatran Elephant', 12, 1003);
What is the average age of all animals in the 'endangered_animal_profiles' table?
SELECT AVG(age) FROM endangered_animal_profiles;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (id INT, name VARCHAR(100), company VARCHAR(100), cost FLOAT); INSERT INTO Satellites (id, name, company, cost) VALUES (1, 'Starlink 1', 'SpaceX', 1000000); INSERT INTO Satellites (id, name, company, cost) VALUES (2, 'Starlink 2', 'SpaceX', 1000000);
What is the average cost of satellites launched by SpaceX?
SELECT AVG(cost) FROM Satellites WHERE company = 'SpaceX';
gretelai_synthetic_text_to_sql
CREATE TABLE language_preservation_events (id INT PRIMARY KEY, name VARCHAR(255), language_id INT, participants INT, date DATE, description TEXT);
Add a new record for a language preservation event.
INSERT INTO language_preservation_events (id, name, language_id, participants, date, description) VALUES (1, 'Gàidhlig Language Revitalization Workshop', 2, 30, '2024-04-01', 'A workshop aimed at revitalizing the Gàidhlig language with 30 participants on April 1st, 2024.');
gretelai_synthetic_text_to_sql
CREATE TABLE port (port_id INT, port_name VARCHAR(50)); CREATE TABLE vessel (vessel_id INT, vessel_name VARCHAR(50)); CREATE TABLE transport (transport_id INT, cargo_id INT, vessel_id INT, port_id INT); INSERT INTO port (port_id, port_name) VALUES (1, 'Port of New York'), (2, 'Port of Miami'), (3, 'Port of Boston'); IN...
What are the names of the ports where 'Vessel F' has transported cargo?
SELECT port_name FROM port WHERE port_id IN (SELECT port_id FROM transport WHERE vessel_id = (SELECT vessel_id FROM vessel WHERE vessel_name = 'Vessel F'))
gretelai_synthetic_text_to_sql
CREATE TABLE Artworks (id INT, artist VARCHAR(50), title VARCHAR(100), year INT, medium VARCHAR(50), width FLOAT, height FLOAT); INSERT INTO Artworks (id, artist, title, year, medium, width, height) VALUES (1, 'Vincent van Gogh', 'Starry Night', 1889, 'Oil on canvas', 73.7, 59.8);
Find the total number of artworks by each artist in the 'Artworks' table.
SELECT artist, COUNT(*) as total_artworks FROM Artworks GROUP BY artist;
gretelai_synthetic_text_to_sql
CREATE TABLE company (id INT, name TEXT, industry TEXT, founding_date DATE, founder_ethnicity TEXT); INSERT INTO company (id, name, industry, founding_date, founder_ethnicity) VALUES (1, 'FintechLatam', 'Fintech', '2018-04-01', 'Latinx');
What is the average funding amount for companies founded by Latinx individuals in the fintech sector?
SELECT AVG(investment_rounds.funding_amount) FROM company JOIN investment_rounds ON company.id = investment_rounds.company_id WHERE company.founder_ethnicity = 'Latinx' AND company.industry = 'Fintech';
gretelai_synthetic_text_to_sql
CREATE TABLE graduate_students (id INT, name TEXT, department TEXT); INSERT INTO graduate_students (id, name, department) VALUES (1, 'Alice', 'CS'), (2, 'Bob', NULL), (3, 'Charlie', 'Math');
Delete records from the graduate_students table where the student is not part of any department
DELETE FROM graduate_students WHERE department IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE artworks (artwork_id INT, artwork_name TEXT, artist_name TEXT, country TEXT);
What is the total number of artworks in the artworks table, excluding those from the United States?
SELECT COUNT(artwork_id) FROM artworks WHERE country != 'United States';
gretelai_synthetic_text_to_sql
CREATE TABLE usage (id INT, subscriber_id INT, plan_id INT, usage_time DECIMAL(10,2)); CREATE TABLE mobile_plans (id INT, name VARCHAR(255), type VARCHAR(255), price DECIMAL(10,2)); CREATE TABLE subscribers (id INT, name VARCHAR(255), plan_id INT, country VARCHAR(255)); CREATE TABLE countries (id INT, name VARCHAR(255)...
What is the average usage time for mobile plans in each country?
SELECT countries.name AS country, AVG(usage_time) FROM usage JOIN mobile_plans ON usage.plan_id = mobile_plans.id JOIN subscribers ON usage.subscriber_id = subscribers.id JOIN countries ON subscribers.country = countries.id GROUP BY countries.name;
gretelai_synthetic_text_to_sql
CREATE TABLE exit_strategy (id INT, company_id INT, strategy TEXT); INSERT INTO exit_strategy (id, company_id, strategy) VALUES (1, 1, 'Merger'); CREATE TABLE company (id INT, name TEXT, industry TEXT, founder_race TEXT); INSERT INTO company (id, name, industry, founder_race) VALUES (1, 'SecureSphere', 'Cybersecurity',...
List all unique exit strategies for startups in the cybersecurity sector founded by AAPI entrepreneurs.
SELECT DISTINCT strategy FROM exit_strategy INNER JOIN company ON exit_strategy.company_id = company.id WHERE industry = 'Cybersecurity' AND founder_race = 'AAPI';
gretelai_synthetic_text_to_sql
CREATE TABLE safety_ratings (plant varchar(10), half int, year int, rating int); INSERT INTO safety_ratings (plant, half, year, rating) VALUES ('North Plant', 1, 2022, 85), ('North Plant', 2, 2022, 88), ('South Plant', 1, 2022, 80), ('South Plant', 2, 2022, 83);
What is the average safety rating for the 'North' plant in H1 of 2022?
SELECT AVG(rating) FROM safety_ratings WHERE plant = 'North Plant' AND half = 1 AND year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE sf_bus_stops (stop_id INT, stop_name VARCHAR(100), wheelchair_accessible BOOLEAN, neighborhood VARCHAR(50));
How many wheelchair-accessible bus stops are there in San Francisco, grouped by neighborhood?
SELECT neighborhood, COUNT(*) FROM sf_bus_stops WHERE wheelchair_accessible = TRUE GROUP BY neighborhood;
gretelai_synthetic_text_to_sql
CREATE TABLE Subscribers (subscriber_id INT, service VARCHAR(20), region VARCHAR(20), revenue FLOAT, payment_date DATE, due_date DATE); INSERT INTO Subscribers (subscriber_id, service, region, revenue, payment_date, due_date) VALUES (1, 'Broadband', 'Metro', 50.00, '2022-04-15', '2022-04-10'), (2, 'Mobile', 'Urban', 35...
Delete subscribers who have made payments after the due date for the 'Broadband' service in Q2 of 2022.
DELETE FROM Subscribers WHERE service = 'Broadband' AND QUARTER(payment_date) = 2 AND YEAR(payment_date) = 2022 AND payment_date > due_date;
gretelai_synthetic_text_to_sql
CREATE TABLE IF NOT EXISTS athletes (id INT, name VARCHAR(50), team VARCHAR(50), league VARCHAR(50)); CREATE TABLE IF NOT EXISTS sessions (id INT, athlete_id INT, type VARCHAR(50), duration INT, date DATE);
What is the total number of hours of strength and conditioning sessions for all athletes in the NFL in the last month?
SELECT SUM(duration) FROM sessions JOIN athletes ON sessions.athlete_id = athletes.id WHERE athletes.league = 'NFL' AND sessions.type IN ('Strength', 'Conditioning') AND sessions.date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE Fields (FieldID varchar(5), FieldName varchar(10), AvgTemperature float, AvgHumidity float); INSERT INTO Fields (FieldID, FieldName, AvgTemperature, AvgHumidity) VALUES ('A', 'Field A', 25.6, 60.1), ('B', 'Field B', 26.3, 61.5);
What are the average temperatures and humidity levels for the crops in field A and B in July?
SELECT AvgTemperature, AvgHumidity FROM Fields WHERE FieldName IN ('Field A', 'Field B') AND EXTRACT(MONTH FROM DATE '2022-07-01') = 7;
gretelai_synthetic_text_to_sql
CREATE TABLE courses (course_id INT, course_name TEXT, added_date DATE); INSERT INTO courses (course_id, course_name, added_date) VALUES (1, 'Intro to Psychology', '2022-01-05'), (2, 'English Composition', '2022-03-10');
What courses have been added in the last 6 months?
SELECT * FROM courses WHERE added_date >= DATEADD(month, -6, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID int, HireDate date, Salary decimal(10,2)); INSERT INTO Employees (EmployeeID, HireDate, Salary) VALUES (1, '2021-01-01', 80000.00), (2, '2021-02-15', 85000.00), (3, '2020-12-31', 75000.00);
What is the average salary for employees hired in 2021?
SELECT AVG(Salary) FROM Employees WHERE YEAR(HireDate) = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (Id INT, Name VARCHAR(50), Role VARCHAR(50), Department VARCHAR(50)); INSERT INTO Employees (Id, Name, Role, Department) VALUES (1, 'Jane Smith', 'Safety Officer', 'Production'), (2, 'Robert Johnson', 'Engineer', 'Research'), (3, 'Alice Davis', 'Research Engineer', 'Research');
Show research engineers and their details.
SELECT * FROM Employees WHERE Role = 'Engineer' AND Department = 'Research';
gretelai_synthetic_text_to_sql
CREATE TABLE nonprofits (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), sector VARCHAR(255)); CREATE TABLE investments (id INT PRIMARY KEY, investor_id INT, nonprofit_id INT, amount DECIMAL(10,2), investment_date DATE); INSERT INTO nonprofits (id, name, location, sector) VALUES (1, 'Habitat for Humanity'...
What is the total investment amount for each sector?
SELECT n.sector, SUM(i.amount) FROM nonprofits n JOIN investments i ON n.id = nonprofit_id GROUP BY n.sector;
gretelai_synthetic_text_to_sql
CREATE TABLE revenue (product_id INT, category VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO revenue (product_id, category, revenue) VALUES (1, 'CategoryA', 1200.00), (2, 'CategoryB', 2500.00), (3, 'CategoryA', 750.00);
What is the total revenue for each product category?
SELECT category, SUM(revenue) AS total_revenue FROM revenue GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE satellite_status (satellite_name VARCHAR(255), orbit_type VARCHAR(255), status VARCHAR(255)); INSERT INTO satellite_status (satellite_name, orbit_type, status) VALUES ('Sat-1', 'LEO', 'active'); INSERT INTO satellite_status (satellite_name, orbit_type, status) VALUES ('Sat-2', 'GEO', 'active');
Find the number of active satellites in each orbit type
SELECT orbit_type, COUNT(*) FROM satellite_status WHERE status = 'active' GROUP BY orbit_type;
gretelai_synthetic_text_to_sql
CREATE TABLE categories (product VARCHAR(20), revenue DECIMAL(10,2), state VARCHAR(20), year INT); INSERT INTO categories (product, revenue, state, year) VALUES ('Flower', 80000, 'Oregon', 2021), ('Concentrate', 70000, 'Oregon', 2021), ('Edibles', 90000, 'Oregon', 2021);
Which product category had the highest total revenue in Oregon in 2021?
SELECT product, MAX(revenue) as max_revenue FROM categories WHERE state = 'Oregon' AND year = 2021 GROUP BY product;
gretelai_synthetic_text_to_sql
CREATE TABLE training_data3 (id INT, algorithm VARCHAR(20), bias INT, fairness INT); INSERT INTO training_data3 (id, algorithm, bias, fairness) VALUES (1, 'Decision Tree', 3, 7), (2, 'Random Forest', 5, 6), (3, 'Decision Tree', 4, 8);
Delete records with 'algorithm' = 'Decision Tree' in the 'training_data3' table
DELETE FROM training_data3 WHERE algorithm = 'Decision Tree';
gretelai_synthetic_text_to_sql
CREATE TABLE patents (id INT, company_id INT, title VARCHAR(100), issued_date DATE); INSERT INTO patents (id, company_id, title, issued_date) VALUES (1, 1, 'Quantum computing', '2015-01-01'); INSERT INTO patents (id, company_id, title, issued_date) VALUES (2, 2, 'AI-based medical diagnostics', '2008-01-01'); CREATE TAB...
Identify companies with more than one patent and located in the Asia Pacific region.
SELECT p.company_id FROM patents p JOIN company_info ci ON p.company_id = ci.company_id WHERE ci.region = 'Asia Pacific' GROUP BY p.company_id HAVING COUNT(*) > 1;
gretelai_synthetic_text_to_sql
CREATE TABLE FoiaRequests ( RequestId INT, RequestDate DATE, RequestCity VARCHAR(255) ); INSERT INTO FoiaRequests (RequestId, RequestDate, RequestCity) VALUES (1, '2021-01-01', 'Washington DC'), (2, '2021-02-01', 'New York'), (3, '2021-03-01', 'Los Angeles');
What is the number of FOIA requests submitted per month in the United States?
SELECT EXTRACT(MONTH FROM RequestDate) as Month, COUNT(*) as NumRequests FROM FoiaRequests GROUP BY EXTRACT(MONTH FROM RequestDate);
gretelai_synthetic_text_to_sql
CREATE TABLE water_conservation_initiatives (id INT, country VARCHAR(50), year INT, initiative_type VARCHAR(50));
How many water conservation initiatives were implemented in India in the year 2018?
SELECT COUNT(*) FROM water_conservation_initiatives WHERE country = 'India' AND year = 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE military_sales (id INT PRIMARY KEY, region VARCHAR(20), year INT, equipment_name VARCHAR(30), quantity INT, value FLOAT);
Insert a new record of 'Armored Vehicle' sale to 'North America' in the year '2023' with the quantity of 27 and value of 30000000
INSERT INTO military_sales (id, region, year, equipment_name, quantity, value) VALUES (5, 'North America', 2023, 'Armored Vehicle', 27, 30000000);
gretelai_synthetic_text_to_sql
CREATE TABLE mobile_customers (customer_id INT, data_usage FLOAT, city VARCHAR(20)); INSERT INTO mobile_customers (customer_id, data_usage, city) VALUES (1, 3.5, 'Tokyo'), (2, 4.2, 'NYC'), (3, 3.1, 'Tokyo');
How many mobile customers have a data usage greater than 3 GB in the city of Tokyo?
SELECT COUNT(*) FROM mobile_customers WHERE data_usage > 3 AND city = 'Tokyo';
gretelai_synthetic_text_to_sql
CREATE TABLE organic_farms (id INT, country VARCHAR(50), region VARCHAR(50), farm_type VARCHAR(50), area_ha FLOAT); INSERT INTO organic_farms (id, country, region, farm_type, area_ha) VALUES (1, 'Australia', 'Oceania', 'Smallholder', 345.6); INSERT INTO organic_farms (id, country, region, farm_type, area_ha) VALUES (2,...
What is the total area of organic farming in 'Oceania' by smallholder farms?
SELECT SUM(area_ha) FROM organic_farms WHERE region = 'Oceania' AND farm_type = 'Smallholder';
gretelai_synthetic_text_to_sql
CREATE TABLE startups(id INT, name TEXT, industry TEXT, founder_ethnicity TEXT, funding FLOAT); INSERT INTO startups (id, name, industry, founder_ethnicity, funding) VALUES (1, 'MediaNative', 'Media', 'Indigenous', 3000000);
What is the average funding received by startups founded by indigenous people in the media sector?
SELECT AVG(funding) FROM startups WHERE industry = 'Media' AND founder_ethnicity = 'Indigenous';
gretelai_synthetic_text_to_sql
CREATE TABLE football_matches (id INT, home_team VARCHAR(50), away_team VARCHAR(50), yellow_cards_home INT, yellow_cards_away INT);
What is the total number of yellow cards given in football matches?
SELECT SUM(yellow_cards_home + yellow_cards_away) FROM football_matches;
gretelai_synthetic_text_to_sql
CREATE TABLE military_innovation (country VARCHAR(50), year INT, event VARCHAR(50)); INSERT INTO military_innovation (country, year, event) VALUES ('USA', 2016, 'DARPA Robotics Challenge'); INSERT INTO military_innovation (country, year, event) VALUES ('USA', 2017, 'Hypersonic Weapon Test'); INSERT INTO military_innova...
What is the number of military innovation events by the USA, Russia, and China from 2016 to 2018?
SELECT country, COUNT(event) as total_events FROM military_innovation WHERE (country = 'USA' OR country = 'Russia' OR country = 'China') AND (year BETWEEN 2016 AND 2018) GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Country TEXT); INSERT INTO Volunteers (VolunteerID, VolunteerName, Country) VALUES (1, 'Ali', 'Pakistan'), (2, 'Sophia', 'China'), (3, 'James', 'USA');
Which countries have the most volunteers?
SELECT Country, COUNT(*) AS VolunteerCount FROM Volunteers GROUP BY Country ORDER BY VolunteerCount DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Streaming (id INT, user_id INT, artist_name VARCHAR(255), song_name VARCHAR(255), streams INT); INSERT INTO Streaming (id, user_id, artist_name, song_name, streams) VALUES (1, 123, 'Ariana Grande', 'Thank U, Next', 500), (2, 456, 'Billie Eilish', 'Bad Guy', 700), (3, 789, 'Taylor Swift', 'Love Story', 600)...
What is the total number of streams for each artist and song in the Streaming table?
SELECT artist_name, song_name, SUM(streams) as total_streams FROM Streaming GROUP BY artist_name, song_name;
gretelai_synthetic_text_to_sql
CREATE TABLE BasketballPlayers (PlayerID INT, Name VARCHAR(50)); CREATE TABLE BasketballPlayerStats (PlayerID INT, GameID INT, Points INT, ThreePointShots INT);
What is the average number of three-point shots made per game by players in the BasketballPlayers and BasketballPlayerStats tables, for players with more than 500 total points scored?
SELECT AVG(ThreePointShots) FROM BasketballPlayerStats INNER JOIN BasketballPlayers ON BasketballPlayerStats.PlayerID = BasketballPlayers.PlayerID GROUP BY PlayerID HAVING SUM(Points) > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE mediators (mediator_id INT, name TEXT); INSERT INTO mediators (mediator_id, name) VALUES (1, 'John'), (2, 'Jane'), (3, 'Mike'); CREATE TABLE cases (case_id INT, mediator_id INT, date TEXT); INSERT INTO cases (case_id, mediator_id, date) VALUES (1, 1, '2022-01-01'), (2, 1, '2022-02-01'), (3, 2, '2022-03-01'...
What is the number of cases per month for each mediator?
SELECT mediators.name, EXTRACT(MONTH FROM cases.date) as month, COUNT(cases.case_id) as cases_per_month FROM mediators INNER JOIN cases ON mediators.mediator_id = cases.mediator_id GROUP BY mediators.name, month;
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, VolunteerHours DECIMAL(5,2), VolunteerDate DATE); INSERT INTO Volunteers (VolunteerID, VolunteerName, VolunteerHours, VolunteerDate) VALUES (1, 'Alice', 5.50, '2022-01-05'); INSERT INTO Volunteers (VolunteerID, VolunteerName, VolunteerHours, VolunteerDate) V...
Who were the top 3 volunteers in terms of total volunteer hours in 2022?
SELECT VolunteerName, SUM(VolunteerHours) as TotalVolunteerHours FROM Volunteers GROUP BY VolunteerName ORDER BY TotalVolunteerHours DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE incidents (incident_id INT, incident_type VARCHAR(50), date_time DATETIME);
What is the earliest incident date and time in the 'incidents' table
SELECT MIN(date_time) FROM incidents;
gretelai_synthetic_text_to_sql