context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE conservation(state TEXT, savings INTEGER); INSERT INTO conservation(state, savings) VALUES ('Florida', 50), ('Georgia', 0), ('Florida', 0), ('Georgia', 100);
Delete records with zero water conservation in Florida and Georgia.
DELETE FROM conservation WHERE state IN ('Florida', 'Georgia') AND savings = 0;
gretelai_synthetic_text_to_sql
CREATE TABLE Menu (id INT PRIMARY KEY, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2));
Calculate the average price of all menu items
SELECT AVG(price) FROM Menu;
gretelai_synthetic_text_to_sql
CREATE TABLE co_owners (id INT, name VARCHAR(30), property_id INT); CREATE TABLE properties (id INT, address VARCHAR(50), city VARCHAR(20)); INSERT INTO co_owners (id, name, property_id) VALUES (1, 'Alex', 101), (2, 'Bella', 101), (3, 'Charlie', 102); INSERT INTO properties (id, address, city) VALUES (101, '1234 SE Sta...
List the co-owners and their shared property addresses in Seattle, WA.
SELECT co_owners.name, properties.address FROM co_owners INNER JOIN properties ON co_owners.property_id = properties.id WHERE properties.city = 'Seattle';
gretelai_synthetic_text_to_sql
CREATE TABLE countries (id INTEGER, name TEXT, region TEXT, num_satellites INTEGER); INSERT INTO countries (id, name, region, num_satellites) VALUES (1, 'Algeria', 'Africa', 2), (2, 'Egypt', 'Africa', 5), (3, 'Nigeria', 'Africa', 10), (4, 'South Africa', 'Africa', 12), (5, 'Kenya', 'Africa', 3), (6, 'Ghana', 'Africa', ...
What is the total number of satellites owned by African countries?
SELECT SUM(num_satellites) FROM countries WHERE region = 'Africa' AND country IN (SELECT country FROM space_programs);
gretelai_synthetic_text_to_sql
CREATE TABLE tour_packages (package_id INT, package_type VARCHAR(20), price DECIMAL(5,2), is_eco_friendly BOOLEAN); INSERT INTO tour_packages (package_id, package_type, price, is_eco_friendly) VALUES (1, 'City Tour', 50, FALSE), (2, 'Nature Hike', 75, TRUE), (3, 'Historical Tour', 60, FALSE), (4, 'Eco-friendly City Tou...
What is the average price of eco-friendly tour packages?
SELECT AVG(price) FROM tour_packages WHERE is_eco_friendly = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE patient_treatments (patient_id INT, treatment VARCHAR(10)); INSERT INTO patient_treatments (patient_id, treatment) VALUES (1, 'CBT'), (2, 'DBT'), (3, 'CBT'), (4, NULL);
What are the names of patients who have not received any treatment?
SELECT patients.name FROM patients LEFT JOIN patient_treatments ON patients.patient_id = patient_treatments.patient_id WHERE patient_treatments.treatment IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE customer_analytics (client_id INT, income DECIMAL(10, 2), education VARCHAR(50), marital_status VARCHAR(20)); INSERT INTO customer_analytics (client_id, income, education, marital_status) VALUES (3, 80000, 'PhD', 'Married'); INSERT INTO customer_analytics (client_id, income, education, marital_status) VALU...
What is the average income for each client, and what is the overall average income?
SELECT client_id, income, AVG(income) OVER () as overall_average_income FROM customer_analytics;
gretelai_synthetic_text_to_sql
CREATE TABLE fulltime_workers (id INT, industry VARCHAR(20), salary FLOAT, union_member BOOLEAN); INSERT INTO fulltime_workers (id, industry, salary, union_member) VALUES (1, 'manufacturing', 50000.0, true), (2, 'technology', 70000.0, true), (3, 'finance', 80000.0, true), (4, 'finance', 85000.0, true), (5, 'finance', 9...
What is the average salary of full-time workers who are union members in the 'finance' industry?
SELECT AVG(salary) FROM fulltime_workers WHERE industry = 'finance' AND union_member = true;
gretelai_synthetic_text_to_sql
CREATE TABLE dept_budgets (dept_name TEXT, fiscal_year INT, budget INT); CREATE TABLE evidence_based_policy_making (initiative_id INT, dept_name TEXT, initiative_budget INT);
What are the total budgets for evidence-based policy making initiatives for each department in the current fiscal year?
SELECT dept_budgets.dept_name, SUM(evidence_based_policy_making.initiative_budget) AS total_budget FROM dept_budgets INNER JOIN evidence_based_policy_making ON dept_budgets.dept_name = evidence_based_policy_making.dept_name WHERE dept_budgets.fiscal_year = EXTRACT(YEAR FROM CURRENT_DATE) GROUP BY dept_budgets.dept_name...
gretelai_synthetic_text_to_sql
CREATE TABLE Donors (donor_id INT, donor_name VARCHAR(255)); CREATE TABLE Donations (donation_id INT, donor_id INT, donation_amount INT, donation_date DATE, service_area VARCHAR(255)); INSERT INTO Donors (donor_id, donor_name) VALUES (1, 'Jane Doe'); INSERT INTO Donations (donation_id, donor_id, donation_amount, donati...
List the top 3 donors by the amount donated to 'Health Services' in '2021'
SELECT Donors.donor_name, SUM(Donations.donation_amount) as total_donation FROM Donors INNER JOIN Donations ON Donors.donor_id = Donations.donor_id WHERE Donations.service_area = 'Health Services' AND YEAR(Donations.donation_date) = 2021 GROUP BY Donors.donor_name ORDER BY total_donation DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE Parks_And_Rec (ID INT, Service VARCHAR(255), Budget FLOAT); INSERT INTO Parks_And_Rec (ID, Service, Budget) VALUES (1, 'Parks Maintenance', 400000), (2, 'Sports Programs', 500000), (3, 'Community Events', 600000);
What is the average budget allocated per service category in the Parks and Recreation department?
SELECT AVG(Budget) FROM Parks_And_Rec GROUP BY Service;
gretelai_synthetic_text_to_sql
CREATE TABLE MusicSales (SaleID INT, ArtistName VARCHAR(20), Genre VARCHAR(10), SalesAmount DECIMAL(10,2)); INSERT INTO MusicSales (SaleID, ArtistName, Genre, SalesAmount) VALUES (1, 'Ella Fitzgerald', 'Jazz', 12.99), (2, 'The Beatles', 'Rock', 15.00), (3, 'Ariana Grande', 'Pop', 19.45), (4, 'Billie Eilish', 'Pop', 11....
What is the total revenue generated from digital music sales by each artist?
SELECT ArtistName, SUM(SalesAmount) as TotalRevenue FROM MusicSales GROUP BY ArtistName;
gretelai_synthetic_text_to_sql
CREATE TABLE veteran_employment (employment_id INT, hire_date DATE, company_name TEXT, veteran_status TEXT, num_hired INT); INSERT INTO veteran_employment (employment_id, hire_date, company_name, veteran_status, num_hired) VALUES (1, '2022-01-05', 'XYZ Manufacturing', 'Veteran', 15); INSERT INTO veteran_employment (emp...
What is the maximum number of veterans hired per month by each company?
SELECT company_name, MAX(num_hired) as max_veterans_hired_per_month FROM veteran_employment WHERE hire_date >= DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0) GROUP BY company_name;
gretelai_synthetic_text_to_sql
CREATE TABLE RecycledGarments (id INT, garment VARCHAR(50), price DECIMAL(5,2)); INSERT INTO RecycledGarments (id, garment, price) VALUES (1, 'Recycled Polyester Shirt', 25.99), (2, 'Reclaimed Wood Tote', 39.99), (3, 'Regenerated Leather Jacket', 75.00);
What is the average price of garments made with recycled materials?
SELECT AVG(price) FROM RecycledGarments;
gretelai_synthetic_text_to_sql
CREATE TABLE cybersecurity_incidents(id INT, industry VARCHAR(30), country VARCHAR(30), incident_date DATE);
List the number of cybersecurity incidents reported by the defense industry in each country for the last 12 months.
SELECT country, COUNT(*) AS incidents FROM cybersecurity_incidents WHERE industry = 'defense' AND incident_date >= DATE(NOW()) - INTERVAL 12 MONTH GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE cyber_budgets (id INT, country VARCHAR(255), year INT, budget DECIMAL(10, 2)); INSERT INTO cyber_budgets (id, country, year, budget) VALUES (1, 'United States', 2019, 5000000), (2, 'China', 2019, 4000000), (3, 'Russia', 2019, 3000000), (4, 'United States', 2020, 6000000), (5, 'China', 2020, 5000000), (6, '...
What are the total cybersecurity budgets by country for the last 3 years?
SELECT country, SUM(budget) as total_budget FROM cyber_budgets WHERE year IN (2019, 2020, 2021) GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE VolunteerHours (Volunteer VARCHAR(50), Program VARCHAR(50), Hours INT, VolunteerDate DATE); INSERT INTO VolunteerHours (Volunteer, Program, Hours, VolunteerDate) VALUES ('Sophia Chen', 'Healthcare Outreach', 8, '2021-07-02'), ('Daniel Kim', 'Medical Research', 12, '2021-11-05');
How many hours did each volunteer contribute to the healthcare programs in H2 2021?
SELECT Volunteer, SUM(Hours) as TotalHours FROM VolunteerHours WHERE VolunteerDate BETWEEN '2021-07-01' AND '2021-12-31' AND Program LIKE '%Healthcare%' GROUP BY Volunteer;
gretelai_synthetic_text_to_sql
CREATE TABLE SalesData (id INT, item VARCHAR(30), sales INT); INSERT INTO SalesData (id, item, sales) VALUES (1, 'Vegetable Curry', 70), (2, 'Vegetable Stir Fry', 50);
Which vegetarian menu items have the highest and lowest sales?
SELECT item, sales FROM SalesData WHERE item LIKE '%Vegetarian%' ORDER BY sales DESC, sales ASC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Movies (id INT, title VARCHAR(255), country VARCHAR(50), release_year INT, rating DECIMAL(3,2)); INSERT INTO Movies (id, title, country, release_year, rating) VALUES (1, 'Movie1', 'USA', 2010, 7.5), (2, 'Movie2', 'USA', 2015, 8.2), (3, 'Movie3', 'Canada', 2018, 6.8);
What is the average rating of movies produced in the US and released between 2010 and 2020?
SELECT AVG(rating) FROM Movies WHERE country = 'USA' AND release_year BETWEEN 2010 AND 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Manufacturing (manufacturer_id INT, manufacturer_name TEXT, certification TEXT); INSERT INTO Manufacturing (manufacturer_id, manufacturer_name, certification) VALUES (101, 'Textile Co', 'SA8000'); INSERT INTO Manufacturing (manufacturer_id, manufacturer_name, certification) VALUES (102, 'Gadgets Inc', 'Fai...
Which ethical labor certifications are present in the Manufacturing table?
SELECT DISTINCT certification FROM Manufacturing;
gretelai_synthetic_text_to_sql
CREATE TABLE trending_fashions (style VARCHAR(255) PRIMARY KEY, region VARCHAR(255), popularity INT); INSERT INTO trending_fashions (style, region, popularity) VALUES ('Tunic', 'MiddleEast', 60), ('Pants', 'Asia', 90);
Insert a new record in the trending_fashions table for style 'T-shirt', region 'Africa' and popularity 70
INSERT INTO trending_fashions (style, region, popularity) VALUES ('T-shirt', 'Africa', 70);
gretelai_synthetic_text_to_sql
CREATE TABLE subscriptions (id INT, customer_id INT, mobile_service BOOLEAN, broadband_service BOOLEAN); INSERT INTO subscriptions (id, customer_id, mobile_service, broadband_service) VALUES (1, 1, true, true), (2, 2, false, true), (3, 3, true, false);
How many customers have a subscription that includes both mobile and broadband services?
SELECT COUNT(*) FROM subscriptions WHERE mobile_service = true AND broadband_service = true;
gretelai_synthetic_text_to_sql
CREATE TABLE nba_players (player_id INT, name VARCHAR(50), height DECIMAL(3, 1), position VARCHAR(50)); INSERT INTO nba_players (player_id, name, height, position) VALUES (1, 'LeBron James', 6.8, 'Forward'); INSERT INTO nba_players (player_id, name, height, position) VALUES (2, 'Stephen Curry', 6.3, 'Guard');
What is the average height of basketball players in the 'nba_players' table?
SELECT AVG(height) FROM nba_players;
gretelai_synthetic_text_to_sql
CREATE TABLE dishes (dish_id INT PRIMARY KEY, dish_name VARCHAR(255), calories INT);CREATE TABLE allergens (allergen_id INT PRIMARY KEY, dish_id INT, FOREIGN KEY (dish_id) REFERENCES dishes(dish_id));
Find dishes with more than 2 allergens and their average calorie count
SELECT d.dish_name, AVG(d.calories) FROM dishes d JOIN allergens a ON d.dish_id = a.dish_id GROUP BY d.dish_id HAVING COUNT(DISTINCT a.allergen_id) > 2;
gretelai_synthetic_text_to_sql
CREATE TABLE concert_sales (id INT, artist VARCHAR(255), country VARCHAR(255), date DATE, tickets_sold INT, revenue FLOAT); INSERT INTO concert_sales (id, artist, country, date, tickets_sold, revenue) VALUES (1, 'AR Rahman', 'India', '2022-04-01', 7500, 225000.00); CREATE TABLE music_streaming (id INT, artist VARCHAR(2...
What is the total revenue generated from concert ticket sales and music streaming in the country of 'India'?
SELECT SUM(concert_sales.revenue + music_streaming.revenue) FROM concert_sales INNER JOIN music_streaming ON concert_sales.country = music_streaming.country WHERE concert_sales.country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE company_eu (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), industry VARCHAR(255)); INSERT INTO company_eu (id, name, location, industry) VALUES (1, 'BioSense', 'London, UK', 'Biosensor Technology'); CREATE TABLE funding_eu (id INT PRIMARY KEY, company_id INT, fund_type VARCHAR(255), amount I...
Show biosensor technology companies in Europe that have over 10 million in funding after 2019.
SELECT c.name, f.fund_type, f.amount FROM company_eu c JOIN funding_eu f ON c.id = f.company_id WHERE c.industry = 'Biosensor Technology' AND c.location LIKE '%Europe%' AND f.funding_date >= '2020-01-01' AND f.amount > 10000000;
gretelai_synthetic_text_to_sql
CREATE TABLE jobs (id INT, department VARCHAR(50), position_name VARCHAR(50), open_position BOOLEAN); INSERT INTO jobs (id, department, position_name, open_position) VALUES (1, 'HR', 'HR Manager', true), (2, 'IT', 'Software Engineer', true), (3, 'Marketing', 'Marketing Coordinator', false);
What is the number of open positions by department?
SELECT department, COUNT(*) FROM jobs WHERE open_position = true GROUP BY department;
gretelai_synthetic_text_to_sql
CREATE TABLE timber_production (id INT, volume REAL, year INT, country TEXT); INSERT INTO timber_production (id, volume, year, country) VALUES (1, 12345.0, 2012, 'United States'), (2, 67890.0, 2015, 'United States');
What is the minimum volume of timber produced in the last 10 years in the United States?
SELECT MIN(volume) FROM timber_production WHERE country = 'United States' AND year BETWEEN 2012 AND 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE doctor_visits (id INT, age_group VARCHAR(255), year INT, visits INT); INSERT INTO doctor_visits VALUES (1, '0-10', 2020, 3), (2, '11-20', 2020, 2), (3, '21-30', 2020, 1);
What is the average number of doctor visits per year by age group?
SELECT age_group, AVG(visits) AS avg_visits FROM doctor_visits GROUP BY age_group;
gretelai_synthetic_text_to_sql
CREATE TABLE OrganizationMembers (employee_id INT, department VARCHAR(20), role VARCHAR(20), date DATE); INSERT INTO OrganizationMembers (employee_id, department, role, date) VALUES (1, 'Animal Care', 'Volunteer', '2019-12-31'), (2, 'Animal Care', 'Staff', '2019-12-31'), (3, 'Education', 'Volunteer', '2019-12-31'), (4,...
What was the total number of volunteers and staff members in each department as of December 31, 2019?
SELECT department, COUNT(*) FROM OrganizationMembers WHERE date = '2019-12-31' AND role = 'Volunteer' GROUP BY department; SELECT department, COUNT(*) FROM OrganizationMembers WHERE date = '2019-12-31' AND role = 'Staff' GROUP BY department;
gretelai_synthetic_text_to_sql
CREATE TABLE songs (song_id INT, title VARCHAR(255), release_year INT, genre VARCHAR(50), length FLOAT); INSERT INTO songs (song_id, title, release_year, genre, length) VALUES (1, 'Song1', 2020, 'pop', 180.5), (2, 'Song2', 2019, 'rock', 210.3), (3, 'Song3', 2020, 'pop', 205.7);
What is the average length (in seconds) of songs released in 2020 in the pop genre?
SELECT AVG(length) FROM songs WHERE release_year = 2020 AND genre = 'pop';
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (id INT, name VARCHAR(50), age INT, country VARCHAR(50)); INSERT INTO Volunteers (id, name, age, country) VALUES (1, 'Alice', 25, 'USA'), (2, 'Bob', NULL, 'Canada'), (3, 'Charlie', 30, 'Mexico');
What is the total number of volunteers in the Volunteers table, excluding those who have not provided their age?
SELECT COUNT(*) FROM Volunteers WHERE age IS NOT NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE deep_sea_species (species VARCHAR(255), ocean VARCHAR(255), year INT); INSERT INTO deep_sea_species (species, ocean, year) VALUES ('Foraminifera sp.', 'Southern Ocean', 2012), ('Hadal Snailfish', 'Southern Ocean', 2014);
List all deep-sea species discovered in the Southern Ocean since 2010.
SELECT species FROM deep_sea_species WHERE ocean = 'Southern Ocean' AND year >= 2010;
gretelai_synthetic_text_to_sql
CREATE TABLE CoOwnedProperties (PropertyID int, Price int, Borough varchar(255), SustainabilityRating int); CREATE TABLE Owners (PropertyID int, OwnerName varchar(255)); INSERT INTO CoOwnedProperties (PropertyID, Price, Borough, SustainabilityRating) VALUES (1, 400000, 'Brooklyn', 3); INSERT INTO Owners (PropertyID, Ow...
List the names of all owners who co-own a property in Brooklyn with a SustainabilityRating of at least 3.
SELECT o.OwnerName FROM CoOwnedProperties c INNER JOIN Owners o ON c.PropertyID = o.PropertyID WHERE c.Borough = 'Brooklyn' AND c.SustainabilityRating >= 3;
gretelai_synthetic_text_to_sql
CREATE TABLE south_american_countries (country VARCHAR(50), eco_tourists INT); INSERT INTO south_american_countries (country, eco_tourists) VALUES ('Brazil', 500000), ('Argentina', 400000), ('Colombia', 350000), ('Peru', 450000), ('Chile', 300000);
Which South American countries have the highest number of eco-tourists?
SELECT country FROM south_american_countries ORDER BY eco_tourists DESC LIMIT 2;
gretelai_synthetic_text_to_sql
CREATE TABLE rd_expenditure (drug varchar(255), year int, expenditure int); INSERT INTO rd_expenditure (drug, year, expenditure) VALUES ('DrugA', 2021, 8000000), ('DrugB', 2021, 9000000);
What is the maximum R&D expenditure for each drug in 2021?
SELECT drug, MAX(expenditure) FROM rd_expenditure WHERE year = 2021 GROUP BY drug;
gretelai_synthetic_text_to_sql
CREATE TABLE drugs (drug_id INT, drug_name TEXT, sales INT); INSERT INTO drugs (drug_id, drug_name, sales) VALUES (1, 'DrugA', 500), (2, 'DrugB', 750), (3, 'DrugC', 0);
What are the total sales for each drug in the 'drugs' table, grouped by drug name, including drugs with no sales?
SELECT d.drug_name, COALESCE(SUM(s.sales), 0) AS total_sales FROM drugs d LEFT JOIN sales s ON d.drug_id = s.drug_id GROUP BY d.drug_name;
gretelai_synthetic_text_to_sql
CREATE TABLE patients (patient_id INT, name VARCHAR(50), gender VARCHAR(10), therapy_completed BOOLEAN, medication_completed BOOLEAN, therapy_outcome INT, medication_outcome INT);
What is the number of patients who improved after therapy and medication, separated by gender?
SELECT gender, SUM(CASE WHEN therapy_outcome > 0 THEN 1 ELSE 0 END) AS improved_therapy, SUM(CASE WHEN medication_outcome > 0 THEN 1 ELSE 0 END) AS improved_medication FROM patients WHERE therapy_completed = TRUE AND medication_completed = TRUE GROUP BY gender;
gretelai_synthetic_text_to_sql
CREATE TABLE tropical_fish (id INT, name VARCHAR(50), water_temperature FLOAT); INSERT INTO tropical_fish (id, name, water_temperature) VALUES (1, 'Clownfish', 28.5), (2, 'Angelfish', 26.7), (3, 'Surgeonfish', 29.2);
What is the average water temperature for tropical fish farms?
SELECT AVG(water_temperature) FROM tropical_fish;
gretelai_synthetic_text_to_sql
CREATE TABLE donations (id INT, country TEXT, amount DECIMAL(10,2)); INSERT INTO donations (id, country, amount) VALUES (1, 'Country A', 500.00), (2, 'Country A', 750.00), (3, 'Country B', 300.00), (4, 'Country C', 1000.00);
What is the maximum donation amount per country, for countries that have received donations?
SELECT country, MAX(amount) FROM donations GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE deep_sea_pressure (depth INT, region VARCHAR(20), pressure INT); INSERT INTO deep_sea_pressure (depth, region, pressure) VALUES (6000, 'Pacific Ocean', 600); INSERT INTO deep_sea_pressure (depth, region, pressure) VALUES (6000, 'Pacific Ocean', 610); INSERT INTO deep_sea_pressure (depth, region, pressure) ...
What is the average deep-sea pressure at 6000 meters in the Pacific Ocean?
SELECT AVG(pressure) FROM deep_sea_pressure WHERE depth = 6000 AND region = 'Pacific Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE events (event_id INT PRIMARY KEY, event_name VARCHAR(100), event_location VARCHAR(100), start_time DATETIME, end_time DATETIME, attendance INT);
Delete the record for event_id 5001
DELETE FROM events WHERE event_id = 5001;
gretelai_synthetic_text_to_sql
CREATE TABLE fifa_scores (team_a TEXT, team_b TEXT, goals_a INT, goals_b INT); INSERT INTO fifa_scores (team_a, team_b, goals_a, goals_b) VALUES ('Brazil', 'Germany', 1, 7), ('Spain', 'Netherlands', 1, 5), ('Argentina', 'France', 3, 3);
What is the highest scoring game in the 2022 FIFA World Cup?
SELECT team_a, team_b, MAX(goals_a + goals_b) as highest_score FROM fifa_scores;
gretelai_synthetic_text_to_sql
CREATE TABLE train_routes (id INT, route_name VARCHAR(255), fare DECIMAL(5, 2)); INSERT INTO train_routes (id, route_name, fare) VALUES (1, 'Route A', 2.75), (2, 'Route B', 3.50), (3, 'Route C', 2.25); CREATE TABLE route_intersections (id INT, route1 VARCHAR(255), route2 VARCHAR(255)); INSERT INTO route_intersections (...
What are the names and fares of all the train routes that intersect with Route C in the NYC subway system?
SELECT route_name, fare FROM train_routes TR JOIN route_intersections RI ON TR.route_name = RI.route1 WHERE RI.route2 = 'Route C';
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, vehicle_id INT, sale_date DATE, quantity INT, vehicle_type VARCHAR(50)); INSERT INTO sales (id, vehicle_id, sale_date, quantity, vehicle_type) VALUES (1, 1, '2018-01-01', 5, 'electric'); INSERT INTO sales (id, vehicle_id, sale_date, quantity, vehicle_type) VALUES (2, 2, '2019-03-15', 8, 'hyb...
How many electric vehicles were sold in China between 2018 and 2020?
SELECT SUM(quantity) FROM sales WHERE vehicle_type = 'electric' AND sale_date BETWEEN '2018-01-01' AND '2020-12-31';
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityProjects (id INT PRIMARY KEY, project_name VARCHAR(255), location VARCHAR(255), status VARCHAR(255));
Add a new record to the "CommunityProjects" table for a new project called 'Solar Street Lights' in the village of 'Koraro'
INSERT INTO CommunityProjects (project_name, location, status) VALUES ('Solar Street Lights', 'Koraro', 'planning');
gretelai_synthetic_text_to_sql
CREATE TABLE GameRevenue (GameID int, GameName varchar(50), Category varchar(50), Revenue decimal(10,2));
What is the total revenue for each game in the "Racing" category?
SELECT Category, SUM(Revenue) OVER(PARTITION BY Category) as TotalRevenue FROM GameRevenue;
gretelai_synthetic_text_to_sql
CREATE TABLE WasteGeneration (country VARCHAR(50), year INT, waste_generated_kg FLOAT);
What is the total waste generated in India in the year 2020?
SELECT SUM(waste_generated_kg) FROM WasteGeneration WHERE country = 'India' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE season_stats (season_id INT, player_id INT, blocks INT);
What is the maximum number of blocks in a season by players from Europe who have played more than 50 games in a season?
SELECT MAX(blocks) FROM season_stats JOIN players ON season_stats.player_id = players.player_id WHERE players.country = 'Europe' GROUP BY players.country HAVING games_played > 50;
gretelai_synthetic_text_to_sql
CREATE TABLE decentralized_applications (app_id INT, app_name VARCHAR(50)); INSERT INTO decentralized_applications (app_id, app_name) VALUES (1, 'Ethereum'); INSERT INTO decentralized_applications (app_id, app_name) VALUES (2, 'Cardano'); CREATE TABLE regulatory_frameworks (framework_id INT, framework_name VARCHAR(50),...
What are the decentralized applications with their corresponding regulatory frameworks, ranked by framework ID in ascending order?
SELECT da.app_name, rf.framework_name, rf.framework_id, ROW_NUMBER() OVER (PARTITION BY da.app_name ORDER BY rf.framework_id ASC) as rank FROM regulatory_frameworks rf JOIN decentralized_applications da ON rf.app_id = da.app_id ORDER BY da.app_name;
gretelai_synthetic_text_to_sql
CREATE TABLE school_districts (district_id INT, district_name TEXT); CREATE TABLE students (student_id INT, district_id INT, num_courses INT);
What is the number of students enrolled in each district, grouped by district and ordered by the number of students in descending order?
SELECT sd.district_name, COUNT(s.student_id) as num_students FROM students s JOIN school_districts sd ON s.district_id = sd.district_id GROUP BY sd.district_name ORDER BY num_students DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Farm (FarmID int, FarmType varchar(20), Yield int); INSERT INTO Farm (FarmID, FarmType, Yield) VALUES (1, 'Organic', 150), (2, 'Conventional', 200), (3, 'Urban', 100);
What is the average yield of crops for each farm type, ranked by the highest average yield?
SELECT FarmType, AVG(Yield) as AvgYield FROM Farm GROUP BY FarmType ORDER BY AvgYield DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE cybersecurity_strategies (id INT, strategy_name VARCHAR(255), implementation_date DATE, region VARCHAR(255)); INSERT INTO cybersecurity_strategies (id, strategy_name, implementation_date, region) VALUES (1, 'Strategy 1', '2019-01-01', 'Middle East'), (2, 'Strategy 2', '2018-05-15', 'Middle East');
List all cybersecurity strategies and their implementation dates in the Middle East, ordered by the implementation date in descending order.
SELECT * FROM cybersecurity_strategies WHERE region = 'Middle East' ORDER BY implementation_date DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE port (id INT PRIMARY KEY, name VARCHAR(50), location VARCHAR(50), capacity INT); INSERT INTO port VALUES (1, 'New York', 'USA', 5000); INSERT INTO port VALUES (2, 'Los Angeles', 'USA', 4000); CREATE TABLE ship (id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), length INT, port_id INT, FOREIGN KEY (po...
What is the total cargo capacity (in weight) for each port, including the types of ships docked at that port?
SELECT p.name as port_name, s.type as ship_type, SUM(c.weight) as total_weight FROM cargo c JOIN ship s ON c.ship_id = s.id JOIN port p ON s.port_id = p.id GROUP BY p.name, s.type;
gretelai_synthetic_text_to_sql
CREATE TABLE SkincareProducts(productId INT, productName VARCHAR(100), isCrueltyFree BOOLEAN, saleYear INT, country VARCHAR(50)); INSERT INTO SkincareProducts(productId, productName, isCrueltyFree, saleYear, country) VALUES (1, 'Green Tea Toner', true, 2017, 'Italy'), (2, 'Cocoa Butter Moisturizer', false, 2018, 'Italy...
How many cruelty-free skincare products were sold in Italy between 2017 and 2020?
SELECT COUNT(*) FROM SkincareProducts WHERE isCrueltyFree = true AND saleYear BETWEEN 2017 AND 2020 AND country = 'Italy';
gretelai_synthetic_text_to_sql
CREATE TABLE Auto_Sales (Vehicle_Type VARCHAR(20), Model VARCHAR(20), Battery_Range INT);
What are the top 5 electric vehicles by battery range in the Auto_Sales table?
SELECT Vehicle_Type, Model, Battery_Range FROM Auto_Sales WHERE Vehicle_Type = 'Electric' ORDER BY Battery_Range DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE ai_applications (app_id INT, name TEXT, country TEXT, category TEXT); INSERT INTO ai_applications (app_id, name, country, category) VALUES (1, 'ArtBot', 'Nigeria', 'Creative'), (2, 'MusicGen', 'South Africa', 'Creative'), (3, 'DataViz', 'US', 'Analytical'), (4, 'ChatAssist', 'Canada', 'Assistive'), (5, 'AI...
What is the maximum number of creative AI applications developed in a single country?
SELECT MAX(count_per_country) FROM (SELECT COUNT(*) AS count_per_country FROM ai_applications GROUP BY country);
gretelai_synthetic_text_to_sql
CREATE TABLE City (Name VARCHAR(20), Population INT); CREATE TABLE Park (City VARCHAR(20), Type VARCHAR(10)); INSERT INTO City (Name, Population) VALUES ('CityA', 1500000), ('CityB', 800000), ('CityC', 1200000); INSERT INTO Park (City, Type) VALUES ('CityA', 'Public'), ('CityA', 'Private'), ('CityB', 'Public'), ('CityC...
Find the number of public parks in cities with a population over 1 million.
SELECT COUNT(*) FROM City INNER JOIN Park ON City.Name = Park.City WHERE Population > 1000000 AND Type = 'Public';
gretelai_synthetic_text_to_sql
CREATE TABLE countries (id INT, name TEXT); CREATE TABLE marine_protected_areas (id INT, country_id INT, name TEXT); INSERT INTO countries VALUES (1, 'Peru'), (2, 'Chile'), (3, 'Ecuador'); INSERT INTO marine_protected_areas VALUES (1, 1, 'Galapagos Islands'), (2, 2, 'Easter Island'), (3, 3, 'Cocos Island');
How many marine protected areas are there in each country?
SELECT c.name, COUNT(mpa.id) as num_marine_protected_areas FROM countries c INNER JOIN marine_protected_areas mpa ON c.id = mpa.country_id GROUP BY c.name;
gretelai_synthetic_text_to_sql
CREATE TABLE SafetyViolations (id INT, CompanyType TEXT, Industry TEXT, Year INT, Violations INT);
What is the average number of safety violations per year for non-union companies in the 'Transportation' industry?
SELECT AVG(Violations) FROM SafetyViolations WHERE CompanyType != 'Union' AND Industry = 'Transportation' GROUP BY Industry, Year;
gretelai_synthetic_text_to_sql
CREATE TABLE eco_hotels (hotel_id INT, hotel_name TEXT, country TEXT, revenue FLOAT); INSERT INTO eco_hotels (hotel_id, hotel_name, country, revenue) VALUES (1, 'Green Hotel', 'India', 8000), (2, 'Eco Lodge', 'India', 9000);
What is the maximum revenue generated by eco-friendly hotels in India?
SELECT MAX(revenue) FROM eco_hotels WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE vulnerabilities (id INT, name VARCHAR(255), description TEXT, severity INT); INSERT INTO vulnerabilities (id, name, description, severity) VALUES (1, 'Heartbleed', '...', 8), (3, 'SQL Injection', '...', 6);
What are the names and descriptions of all vulnerabilities with a medium severity rating?
SELECT name, description FROM vulnerabilities WHERE severity = 6;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (SatelliteID INT, Name VARCHAR(50), Country VARCHAR(50), LaunchDate DATE, Weight DECIMAL(10,2), Status VARCHAR(50)); INSERT INTO Satellites (SatelliteID, Name, Country, LaunchDate, Weight, Status) VALUES (1, 'Sentinel-1A', 'France', '2012-04-03', 2315.00, 'Active'), (2, 'Sentinel-1B', 'Germany',...
What is the average weight of satellites launched by the US?
SELECT AVG(Weight) FROM Satellites WHERE Country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE intelligence_agency (id INT, name VARCHAR(255)); INSERT INTO intelligence_agency (id, name) VALUES (1, 'CIA'), (2, 'FBI'), (3, 'NSA'), (4, 'MI6'), (5, 'ASIO'); CREATE TABLE intelligence_operations (id INT, agency_id INT, year INT, operation VARCHAR(255)); INSERT INTO intelligence_operations (id, agency_id,...
How many intelligence operations were conducted by each agency in the last 2 years?
SELECT i.name, COUNT(io.id) as operation_count FROM intelligence_agency i INNER JOIN intelligence_operations io ON i.id = io.agency_id WHERE io.year BETWEEN 2020 AND 2021 GROUP BY i.name;
gretelai_synthetic_text_to_sql
CREATE TABLE Communities (community_id INT PRIMARY KEY, community_name VARCHAR(255), region VARCHAR(255), engagement_level INT); INSERT INTO Communities (community_id, community_name, region, engagement_level) VALUES (2, 'Siddi', 'South Asia', 5);
Which communities have the highest engagement levels in language preservation in South Asia?
SELECT c.community_name, c.region, l.language, l.script, l.speakers, c.engagement_level FROM Communities c INNER JOIN Languages l ON c.region = l.region WHERE c.engagement_level = (SELECT MAX(engagement_level) FROM Communities WHERE region = 'South Asia');
gretelai_synthetic_text_to_sql
CREATE TABLE interaction_data (user_id INT, post_id INT, platform VARCHAR(20), date DATE); INSERT INTO interaction_data (user_id, post_id, platform, date) VALUES (1, 1, 'Pinterest', '2022-01-01'), (2, 2, 'Pinterest', '2022-01-02'), (3, 1, 'Pinterest', '2022-01-03');
How many users have interacted with any post on Pinterest in the last month?
SELECT COUNT(DISTINCT user_id) FROM interaction_data WHERE platform = 'Pinterest' AND date >= DATEADD(month, -1, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, category VARCHAR(50), revenue DECIMAL(10,2), month INT, year INT);
What was the total revenue for each product category in New York in the first half of 2021?
SELECT category, SUM(revenue) FROM sales WHERE state = 'New York' AND (month = 1 OR month = 2 OR month = 3 OR month = 4 OR month = 5 OR month = 6) AND year = 2021 GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE journalists (id INT, name TEXT, gender TEXT, newspaper TEXT); CREATE TABLE articles (id INT, journalist_id INT, title TEXT, content TEXT, publication_date DATE);
Who is the most prolific female journalist in "The New York Times" in 2019?
SELECT j.name FROM journalists j INNER JOIN articles a ON j.id = a.journalist_id WHERE j.gender = 'Female' AND j.newspaper = 'The New York Times' GROUP BY j.id ORDER BY COUNT(a.id) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE flight_safety_records (country VARCHAR(50), accidents INT);
What are the top 3 countries with the most flight accidents in the 'flight_safety_records' table?
SELECT country, accidents FROM flight_safety_records ORDER BY accidents DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE wells (well_id INT, country VARCHAR(50)); INSERT INTO wells (well_id, country) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico');
Find the number of wells drilled in each country, sorted by the most drilled.
SELECT country, COUNT(*) as num_wells FROM wells GROUP BY country ORDER BY num_wells DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Donors (DonorID INT, DonorName TEXT, TotalDonation DECIMAL); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount DECIMAL, Sector TEXT);
Find the top 10 donors who have donated the most to the Education sector?
SELECT DonorName, SUM(DonationAmount) OVER (PARTITION BY DonorID ORDER BY SUM(DonationAmount) DESC) AS TotalDonation FROM Donors JOIN Donations ON Donors.DonorID = Donations.DonorID WHERE Sector = 'Education' GROUP BY DonorID ORDER BY TotalDonation DESC LIMIT 10;
gretelai_synthetic_text_to_sql
CREATE TABLE maritime_law_compliance (compliance_id INT, vessel_name TEXT, compliance_status TEXT, region TEXT); INSERT INTO maritime_law_compliance (compliance_id, vessel_name, compliance_status, region) VALUES (1, 'Vessel A', 'Compliant', 'Arctic Ocean'), (2, 'Vessel B', 'Non-Compliant', 'Antarctic Ocean'), (3, 'Vess...
List the maritime law compliance records for vessels in the Arctic Ocean.
SELECT * FROM maritime_law_compliance WHERE region = 'Arctic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE Worker_Count (ProjectID INT, City VARCHAR(50), Year INT, WorkerCount INT);
What is the maximum number of workers involved in a construction project in New York city in 2020?
SELECT MAX(WorkerCount) FROM Worker_Count WHERE City = 'New York' AND Year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (id INT, department VARCHAR(20), amount FLOAT); INSERT INTO Donations (id, department, amount) VALUES (1, 'Animals', 500.00), (2, 'Education', 300.00);
What is the minimum donation amount in the 'Donations' table?
SELECT MIN(amount) FROM Donations
gretelai_synthetic_text_to_sql
CREATE TABLE restorative_justice_programs (program_id INT, state VARCHAR(2), duration INT); INSERT INTO restorative_justice_programs (program_id, state, duration) VALUES (1, 'OR', 25), (2, 'OR', 50);
What is the minimum time taken to resolve restorative justice programs in Oregon?
SELECT MIN(duration) FROM restorative_justice_programs WHERE state = 'OR';
gretelai_synthetic_text_to_sql
CREATE TABLE mobile_plans (id INT, name VARCHAR(255), price DECIMAL(10,2), created_at TIMESTAMP);
Show the number of mobile plans that were created each month of the last year?
SELECT DATE_FORMAT(created_at, '%Y-%m') as month, COUNT(*) as total_plans FROM mobile_plans WHERE created_at >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 YEAR) GROUP BY month;
gretelai_synthetic_text_to_sql
CREATE TABLE vulnerabilities (id INT, timestamp TIMESTAMP, product VARCHAR(255), region VARCHAR(255), vulnerability_severity VARCHAR(255)); INSERT INTO vulnerabilities (id, timestamp, product, region, vulnerability_severity) VALUES (1, '2022-01-01 12:00:00', 'Product A', 'APAC', 'High'), (2, '2022-01-02 10:30:00', 'Pro...
What is the average severity of vulnerabilities found in the last month for each product in the APAC region?
SELECT product, region, AVG(case when vulnerability_severity = 'High' then 3 when vulnerability_severity = 'Medium' then 2 when vulnerability_severity = 'Low' then 1 else 0 end) as avg_severity FROM vulnerabilities WHERE timestamp >= NOW() - INTERVAL 1 MONTH AND region = 'APAC' GROUP BY product, region;
gretelai_synthetic_text_to_sql
CREATE TABLE Languages (language_id INT, language_name VARCHAR(20), language_family VARCHAR(20), language_status VARCHAR(10)); CREATE TABLE LanguageStatus (language_id INT, status_name VARCHAR(20), status_date DATE);
Update the language_status of endangered languages in the Languages table based on the data in the LanguageStatus table.
UPDATE Languages l SET l.language_status = (SELECT status_name FROM LanguageStatus WHERE l.language_id = LanguageStatus.language_id AND status_date = (SELECT MAX(status_date) FROM LanguageStatus WHERE language_id = LanguageStatus.language_id)) WHERE EXISTS (SELECT 1 FROM LanguageStatus WHERE Languages.language_id = Lan...
gretelai_synthetic_text_to_sql
CREATE TABLE water_consumption (id INT, state VARCHAR(20), year INT, consumption FLOAT); INSERT INTO water_consumption (id, state, year, consumption) VALUES (1, 'California', 2017, 120.5), (2, 'California', 2018, 130.3), (3, 'California', 2019, 140.0), (4, 'New York', 2017, 115.3), (5, 'New York', 2018, 120.0), (6, 'Ne...
What is the maximum water consumption in California for the years 2017 and 2018?
SELECT MAX(consumption) FROM water_consumption WHERE state = 'California' AND year IN (2017, 2018);
gretelai_synthetic_text_to_sql
CREATE TABLE TextileSourcing (id INT, location VARCHAR(50), fabric_type VARCHAR(50), quantity INT); INSERT INTO TextileSourcing (id, location, fabric_type, quantity) VALUES (1, 'Egypt', 'Organic Cotton', 700), (2, 'Morocco', 'Tencel', 450), (3, 'South Africa', 'Recycled Polyester', 600);
What is the total quantity of sustainable fabrics sourced from Africa?
SELECT SUM(quantity) FROM TextileSourcing WHERE location IN ('Egypt', 'Morocco', 'South Africa') AND fabric_type IN ('Organic Cotton', 'Tencel', 'Recycled Polyester');
gretelai_synthetic_text_to_sql
CREATE TABLE videos (id INT, title TEXT, category TEXT, watch_time INT); INSERT INTO videos (id, title, category, watch_time) VALUES (1, 'Video1', 'Entertainment', 120), (2, 'Video2', 'Sports', 90);
What's the total watch time of videos in the 'Entertainment' category?
SELECT SUM(watch_time) FROM videos WHERE category = 'Entertainment';
gretelai_synthetic_text_to_sql
CREATE TABLE teacher_pd (teacher_id INT, course_id INT, completion_date DATE); INSERT INTO teacher_pd (teacher_id, course_id, completion_date) VALUES (1, 1001, '2021-01-01'), (1, 1002, '2020-06-01'), (2, 1001, '2019-12-31'), (3, 1003, '2021-03-15'), (3, 1004, '2019-09-01');
What is the percentage of teachers who have completed at least one professional development course in the last year?
SELECT 100.0 * SUM(CASE WHEN completion_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) THEN 1 ELSE 0 END) / COUNT(DISTINCT teacher_id) FROM teacher_pd;
gretelai_synthetic_text_to_sql
CREATE TABLE Departments (DepartmentID INT, DepartmentName VARCHAR(255)); CREATE TABLE Budget (BudgetID INT, DepartmentID INT, Amount DECIMAL(10,2), BudgetDate DATE);
What is the total budget for each department in Q1 of 2021?
SELECT Departments.DepartmentID, Departments.DepartmentName, SUM(Budget.Amount) as TotalBudget FROM Budget INNER JOIN Departments ON Budget.DepartmentID = Departments.DepartmentID WHERE QUARTER(Budget.BudgetDate) = 1 AND YEAR(Budget.BudgetDate) = 2021 GROUP BY Departments.DepartmentID, Departments.DepartmentName;
gretelai_synthetic_text_to_sql
CREATE TABLE safety_incidents (chemical VARCHAR(20), incident_date DATE); INSERT INTO safety_incidents VALUES ('chemical D', '2022-01-15'); INSERT INTO safety_incidents VALUES ('chemical E', '2022-02-01');
Identify safety incidents involving chemical D in the past year.
SELECT * FROM safety_incidents WHERE chemical = 'chemical D' AND incident_date BETWEEN DATEADD(year, -1, GETDATE()) AND GETDATE();
gretelai_synthetic_text_to_sql
CREATE TABLE customers (customer_id INT, customer_name VARCHAR(50), account_number VARCHAR(20), primary_contact VARCHAR(50)); CREATE TABLE transactions (transaction_id INT, customer_id INT, transaction_type VARCHAR(20), transaction_amount DECIMAL(10,2), transaction_date DATE);
List the customers who made a transaction on the 1st of any month in the year 2022, including their names, account numbers, and transaction types?
SELECT c.customer_name, c.account_number, t.transaction_type FROM customers c JOIN transactions t ON c.customer_id = t.customer_id WHERE DAY(transaction_date) = 1 AND YEAR(transaction_date) = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE community_development (project_id INT, org_name VARCHAR(50), country VARCHAR(50), project_status VARCHAR(20)); INSERT INTO community_development (project_id, org_name, country, project_status) VALUES (1, 'World Vision', 'China', 'completed'), (2, 'Save the Children', 'India', 'in progress');
How many community development projects were completed in Asia by each organization?
SELECT org_name, COUNT(*) FROM community_development WHERE country LIKE 'Asia%' AND project_status = 'completed' GROUP BY org_name;
gretelai_synthetic_text_to_sql
CREATE TABLE ExplainableAIs (id INT, name VARCHAR(255), budget DECIMAL(10,2));
What is the maximum budget for any AI application in the field of explainable AI?
SELECT MAX(budget) FROM ExplainableAIs;
gretelai_synthetic_text_to_sql
CREATE TABLE org_details (org_name VARCHAR(50), location VARCHAR(50)); INSERT INTO org_details (org_name, location) VALUES ('LMN Foundation', 'Los Angeles');
List all the organizations in 'org_details' table located in 'Los Angeles'?
SELECT org_name FROM org_details WHERE location = 'Los Angeles';
gretelai_synthetic_text_to_sql
CREATE TABLE Programs (program VARCHAR(50), attendees INT); INSERT INTO Programs (program, attendees) VALUES ('Art', 120), ('Music', 15), ('Dance', 180), ('Art', 5), ('Music', 150), ('Dance', 20);
Which programs had the most attendees for each type of program, excluding any programs with less than 10 attendees?
SELECT program, MAX(attendees) FROM Programs WHERE attendees >= 10 GROUP BY program;
gretelai_synthetic_text_to_sql
CREATE TABLE sales_3 (sale_id INT, region VARCHAR(20), revenue DECIMAL(10,2)); INSERT INTO sales_3 (sale_id, region, revenue) VALUES (1, 'North', 5000.00), (2, 'South', 3000.00), (3, 'East', 7000.00);
Which regions have a higher revenue than the average revenue?
SELECT region FROM sales_3 WHERE revenue > (SELECT AVG(revenue) FROM sales_3);
gretelai_synthetic_text_to_sql
CREATE TABLE products (id INT, name TEXT, material TEXT, production_cost FLOAT); INSERT INTO products (id, name, material, production_cost) VALUES (1, 'Dress', 'Linen', 40.0), (2, 'Skirt', 'Linen', 30.0);
What is the minimum production cost for items made of linen?
SELECT MIN(production_cost) FROM products WHERE material = 'Linen';
gretelai_synthetic_text_to_sql
CREATE TABLE aid (aid_id INT, country TEXT, community TEXT, year INT, amount FLOAT); INSERT INTO aid (aid_id, country, community, year, amount) VALUES (1, 'Mexico', 'Mayan', 2019, 150000), (2, 'Mexico', 'Zapotec', 2020, 200000), (3, 'Mexico', 'Mixtec', 2021, 180000);
What is the total amount of foreign aid received by indigenous communities in rural Mexico for community development projects in the last 3 years?
SELECT SUM(amount) as total_aid FROM aid WHERE country = 'Mexico' AND community IS NOT NULL AND year BETWEEN (SELECT EXTRACT(YEAR FROM CURRENT_DATE) - 3) AND (SELECT EXTRACT(YEAR FROM CURRENT_DATE));
gretelai_synthetic_text_to_sql
CREATE TABLE CybersecurityIncidents(id INT PRIMARY KEY, year INT, incidents INT);INSERT INTO CybersecurityIncidents(id, year, incidents) VALUES (1, 2020, 150), (2, 2021, 200);
Provide the number of cybersecurity incidents reported in 2020 and 2021.
SELECT year, incidents FROM CybersecurityIncidents WHERE year IN (2020, 2021);
gretelai_synthetic_text_to_sql
CREATE TABLE intelligence_operations (id INT, country TEXT, operation TEXT, year INT);INSERT INTO intelligence_operations (id, country, operation, year) VALUES (1, 'Country X', 'Operation Red Fox', 2019), (2, 'Country X', 'Operation Black Hawk', 2020);
How many intelligence operations were conducted by country X in the years 2019 and 2020?
SELECT country, COUNT(*) as total_operations FROM intelligence_operations WHERE country = 'Country X' AND year IN (2019, 2020) GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE digital_assets (id INT, issue_date DATE, company TEXT, country TEXT); INSERT INTO digital_assets (id, issue_date, company, country) VALUES (1, '2021-01-01', 'ExampleCompany1', 'Canada');
How many digital assets were issued in 2021, by companies based in Canada?
SELECT COUNT(*) FROM digital_assets WHERE YEAR(issue_date) = 2021 AND country = 'Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE wastewater_treatment (province VARCHAR(255), location VARCHAR(255), capacity INT); INSERT INTO wastewater_treatment (province, location, capacity) VALUES ('Ontario', 'Toronto', 5000000);
What is the total wastewater treatment capacity for each province in Canada in 2017?'
SELECT province, SUM(capacity) FROM wastewater_treatment WHERE province IN ('Alberta', 'British Columbia', 'Manitoba', 'New Brunswick', 'Newfoundland and Labrador', 'Northwest Territories', 'Nova Scotia', 'Nunavut', 'Ontario', 'Prince Edward Island', ' Quebec', 'Saskatchewan') GROUP BY province;
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (id INT, artist_name VARCHAR(255), gender VARCHAR(10), ethnicity VARCHAR(255)); CREATE TABLE Artworks (id INT, artist_id INT, artwork_name VARCHAR(255), year_created INT, price FLOAT); INSERT INTO Artists (id, artist_name, gender, ethnicity) VALUES (1, 'Frida Kahlo', 'Female', 'European'); INSERT I...
What is the most expensive artwork created by a 'Female European' artist?
SELECT A.artist_name, B.artwork_name, B.price FROM Artists A INNER JOIN Artworks B ON A.id = B.artist_id WHERE A.gender = 'Female' AND A.ethnicity = 'European' ORDER BY B.price DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE drug_approval (drug_name VARCHAR(50), approval_year INT); CREATE TABLE drug_sales (drug_name VARCHAR(50), sales FLOAT, year INT); INSERT INTO drug_approval (drug_name, approval_year) VALUES ('DrugA', 2018), ('DrugB', 2018), ('DrugC', 2018), ('DrugD', 2017); INSERT INTO drug_sales (drug_name, sales, year) V...
Identify the drugs that were approved by the FDA in 2018 and also had sales greater than $1 billion in the same year.
SELECT a.drug_name FROM drug_approval a INNER JOIN drug_sales b ON a.drug_name = b.drug_name WHERE a.approval_year = 2018 AND b.sales > 1000 AND b.year = 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE GMOFreeCereals (id INT, country VARCHAR(50), year INT, quantity INT); INSERT INTO GMOFreeCereals (id, country, year, quantity) VALUES (1, 'USA', 2018, 300), (2, 'USA', 2019, 400), (3, 'Canada', 2018, 250), (4, 'Canada', 2019, 275);
Find the number of GMO-free cereals produced in the USA in 2019.
SELECT COUNT(*) FROM GMOFreeCereals WHERE country = 'USA' AND year = 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE Community_Health_Workers (Worker_ID INT, Name VARCHAR(255), Training_Topic VARCHAR(255), Completion_Date DATE); INSERT INTO Community_Health_Workers (Worker_ID, Name, Training_Topic, Completion_Date) VALUES (1, 'Jamila', 'Cultural Competency 101', '2022-06-01'), (2, 'Luis', 'Cultural Competency 101', '2022...
List the cultural competency training topics for Community Health Workers and their respective completion dates.
SELECT Training_Topic, Completion_Date FROM Community_Health_Workers WHERE Training_Topic LIKE '%Cultural Competency%';
gretelai_synthetic_text_to_sql