context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE conservation_initiatives(initiative_id INT, initiative_name TEXT, region TEXT); INSERT INTO conservation_initiatives(initiative_id, initiative_name, region) VALUES (1, 'Rainwater harvesting', 'X'), (2, 'Greywater recycling', 'X'), (3, 'Smart irrigation', 'Y'), (4, 'Drip irrigation', 'Y');
Identify the water conservation initiatives that overlap between two regions, X and Y?
SELECT initiative_name FROM conservation_initiatives WHERE region IN ('X', 'Y') GROUP BY initiative_name HAVING COUNT(DISTINCT region) = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE rural_clinics( clinic_id INT PRIMARY KEY, name VARCHAR(255), beds INT, doctor_count INT);
Insert 3 records into 'rural_clinics' table
INSERT INTO rural_clinics(clinic_id, name, beds, doctor_count) VALUES (1, 'Clinic A', 5, 3), (2, 'Clinic B', 3, 2), (3, 'Clinic C', 4, 3);
gretelai_synthetic_text_to_sql
CREATE TABLE diabetes_consultations (id INT, consult_date DATE, location TEXT, consultation BOOLEAN); INSERT INTO diabetes_consultations (id, consult_date, location, consultation) VALUES (1, '2022-02-15', 'Urban', true); INSERT INTO diabetes_consultations (id, consult_date, location, consultation) VALUES (2, '2022-03-0...
What is the total number of diabetes consultations in urban areas in the last month?
SELECT SUM(CASE WHEN location = 'Urban' THEN 1 ELSE 0 END) FROM diabetes_consultations WHERE consult_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE japan_accessories (accessory_type VARCHAR(255), sales_quantity INT, quarter INT, year INT); INSERT INTO japan_accessories (accessory_type, sales_quantity, quarter, year) VALUES ('Hat', 200, 1, 2021), ('Scarf', 300, 1, 2021);
How many accessories were sold in Japan in Q1 2021?
SELECT SUM(sales_quantity) FROM japan_accessories WHERE quarter = 1 AND year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE podcasts (id INT, title TEXT, category TEXT, duration INT); INSERT INTO podcasts (id, title, category, duration) VALUES (1, 'Podcast1', 'Education', 60), (2, 'Podcast2', 'Education', 90);
What's the maximum duration of a podcast in the 'Education' category?
SELECT MAX(duration) FROM podcasts WHERE category = 'Education';
gretelai_synthetic_text_to_sql
CREATE TABLE tv_shows (id INT, title VARCHAR(100), genre VARCHAR(50), release_year INT, marketing_spend INT); INSERT INTO tv_shows (id, title, genre, release_year, marketing_spend) VALUES (1, 'ShowX', 'Comedy', 2017, 5000000); INSERT INTO tv_shows (id, title, genre, release_year, marketing_spend) VALUES (2, 'ShowY', 'R...
Delete the TV show with the title "ShowX" and release year 2017.
DELETE FROM tv_shows WHERE title = 'ShowX' AND release_year = 2017;
gretelai_synthetic_text_to_sql
CREATE TABLE talent_acquisition (id SERIAL PRIMARY KEY, job_title VARCHAR(50), source VARCHAR(50), submission_date DATE);
Insert data about a software engineer position submitted through LinkedIn on 2023-01-10
INSERT INTO talent_acquisition (job_title, source, submission_date) VALUES ('Software Engineer', 'LinkedIn', '2023-01-10');
gretelai_synthetic_text_to_sql
CREATE TABLE athletes (id INT PRIMARY KEY, name VARCHAR(100), gender VARCHAR(10), sport VARCHAR(50)); CREATE TABLE participation (id INT PRIMARY KEY, athlete_id INT, year INT);
Get all athletes who participated in 2021
SELECT athletes.name FROM athletes INNER JOIN participation ON athletes.id = participation.athlete_id WHERE participation.year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE teacher_professional_development (teacher_id INT, program_id INT, school_id INT); INSERT INTO teacher_professional_development (teacher_id, program_id, school_id) VALUES (1, 1001, 101), (2, 1002, 101), (3, 1003, 102), (4, 1004, 103), (5, 1005, 104); CREATE TABLE programs (program_id INT, program_name VARCH...
Which professional development programs were attended by teachers in a specific school?
SELECT p.program_name FROM teacher_professional_development tpd JOIN programs p ON tpd.program_id = p.program_id WHERE tpd.school_id = 101;
gretelai_synthetic_text_to_sql
CREATE TABLE beneficiaries (id INT, name TEXT, country TEXT); INSERT INTO beneficiaries VALUES (1, 'Ahmed', 'Afghanistan'); CREATE TABLE support (id INT, beneficiary_id INT, sector TEXT, support_date DATE); INSERT INTO support VALUES (1, 1, 'education', '2019-01-01'); INSERT INTO support VALUES (2, 1, 'health', '2019-0...
Identify all the unique beneficiaries who received support from the 'education' and 'health' sectors in Afghanistan in 2019, and the number of times they received support.
SELECT b.name, COUNT(s.id) FROM beneficiaries b INNER JOIN support s ON b.id = s.beneficiary_id WHERE b.country = 'Afghanistan' AND s.sector IN ('education', 'health') AND s.support_date BETWEEN '2019-01-01' AND '2019-12-31' GROUP BY b.name;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), Age INT, HasReceivedDiversityTraining BOOLEAN); INSERT INTO Employees (EmployeeID, Department, Age, HasReceivedDiversityTraining) VALUES (1, 'HR', 35, true), (2, 'IT', 28, false), (3, 'HR', 40, true); CREATE TABLE DiversityTraining (TrainingID INT, Employe...
What is the average age of employees in the HR department who have received diversity and inclusion training?
SELECT AVG(Age) FROM Employees INNER JOIN DiversityTraining ON Employees.EmployeeID = DiversityTraining.EmployeeID WHERE Department = 'HR';
gretelai_synthetic_text_to_sql
CREATE TABLE biosensors (id INT, manufacturer VARCHAR(50), model VARCHAR(50), price FLOAT, quantity INT, date DATE);
Show top 3 expensive biosensors in descending order.
SELECT manufacturer, model, price FROM biosensors ORDER BY price DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE policyholders (id INT, name TEXT, state TEXT, policy_type TEXT, premium FLOAT); INSERT INTO policyholders (id, name, state, policy_type, premium) VALUES (1, 'John Doe', 'NY', 'Auto', 1200.00), (2, 'Jane Smith', 'CA', 'Home', 2500.00), (3, 'Jim Brown', 'NJ', 'Auto', 1500.00);
Calculate the total premium for policyholders living in 'NY' and 'NJ'.
SELECT state, SUM(premium) as total_premium FROM policyholders WHERE state IN ('NY', 'NJ') GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE IndigenousCommunities (community VARCHAR(50), country VARCHAR(50)); INSERT INTO IndigenousCommunities (community, country) VALUES ('Inuit', 'Greenland'); INSERT INTO IndigenousCommunities (community, country) VALUES ('Sami', 'Norway'); INSERT INTO IndigenousCommunities (community, country) VALUES ('Chukchi...
What is the total number of indigenous communities in the Arctic region?
SELECT COUNT(community) FROM IndigenousCommunities;
gretelai_synthetic_text_to_sql
CREATE TABLE employees (id INT, name VARCHAR(50), title VARCHAR(50), salary DECIMAL(10,2), department VARCHAR(50), region VARCHAR(50));
What is the average salary of employees working in ethical supply chain roles, grouped by job title and region?
SELECT title, region, AVG(salary) as avg_salary FROM employees WHERE department = 'Ethical Supply Chain' GROUP BY title, region;
gretelai_synthetic_text_to_sql
CREATE TABLE members (id INT, country VARCHAR(50)); INSERT INTO members (id, country) VALUES (1, 'Australia'); CREATE TABLE workouts (id INT, member_id INT, date DATE, heart_rate INT); INSERT INTO workouts (id, member_id, date, heart_rate) VALUES (1, 1, '2021-08-01', 120);
What is the average heart rate of members from Australia during evening workouts?
SELECT AVG(heart_rate) FROM members JOIN workouts ON members.id = workouts.member_id WHERE members.country = 'Australia' AND HOUR(workouts.date) BETWEEN 17 AND 23;
gretelai_synthetic_text_to_sql
CREATE TABLE city_budget (city VARCHAR(20), department VARCHAR(20), budget INT); INSERT INTO city_budget (city, department, budget) VALUES ('Toronto', 'Police', 8000000);
What is the total budget allocated for public safety in the city of Toronto, including all departments, for the fiscal year 2024?
SELECT SUM(budget) FROM city_budget WHERE city = 'Toronto' AND department LIKE '%Safety%' AND fiscal_year = 2024;
gretelai_synthetic_text_to_sql
CREATE TABLE CybersecurityIncidents(id INT PRIMARY KEY, year INT, incidents INT);INSERT INTO CybersecurityIncidents(id, year, incidents) VALUES (1, 2005, 50), (2, 2010, 100), (3, 2015, 150);
When did the first cybersecurity incident occur in the database?
SELECT MIN(year) FROM CybersecurityIncidents;
gretelai_synthetic_text_to_sql
CREATE TABLE coal_depletion (site_id INT, amount FLOAT); CREATE TABLE gold_depletion (site_id INT, amount FLOAT); INSERT INTO coal_depletion (site_id, amount) VALUES (1, 200), (2, 300), (3, 150); INSERT INTO gold_depletion (site_id, amount) VALUES (1, 50), (2, 75), (3, 100);
List all mining sites that have higher coal depletion compared to gold depletion.
SELECT c.site_id, c.amount as coal_depletion, g.amount as gold_depletion FROM coal_depletion c INNER JOIN gold_depletion g ON c.site_id = g.site_id WHERE c.amount > g.amount;
gretelai_synthetic_text_to_sql
CREATE TABLE Emissions (Id INT, Mine_Site VARCHAR(50), Material VARCHAR(50), Emission_Tons INT, Date DATE); INSERT INTO Emissions (Id, Mine_Site, Material, Emission_Tons, Date) VALUES (1, 'SiteA', 'Coal', 800, '2020-01-01'); INSERT INTO Emissions (Id, Mine_Site, Material, Emission_Tons, Date) VALUES (2, 'SiteB', 'Iron'...
What is the maximum daily CO2 emission for each mine site in the first week of 2020, if any site had over 1000 tons of daily CO2 emission, exclude it from the results?
SELECT Mine_Site, MAX(Emission_Tons) as Max_Daily_Emission FROM Emissions WHERE Material IN ('Coal', 'Iron') AND Date >= '2020-01-01' AND Date < '2020-01-08' GROUP BY Mine_Site HAVING Max_Daily_Emission < 1000;
gretelai_synthetic_text_to_sql
CREATE TABLE production_data (year INT, element VARCHAR(10), quantity INT); INSERT INTO production_data (year, element, quantity) VALUES (2018, 'Gadolinium', 50), (2019, 'Gadolinium', 60), (2020, 'Gadolinium', 75), (2021, 'Gadolinium', 90);
What was the production of Gadolinium in 2020 and 2021?
SELECT quantity FROM production_data WHERE element = 'Gadolinium' AND year IN (2020, 2021);
gretelai_synthetic_text_to_sql
CREATE TABLE orders (customer_id INT, order_date DATE, size VARCHAR(10), quantity INT); INSERT INTO orders (customer_id, order_date, size, quantity) VALUES (1, '2022-01-01', 'large', 100), (2, '2022-01-02', 'large', 200), (3, '2022-01-03', 'large', 150), (4, '2022-01-04', 'medium', 120), (4, '2022-01-05', 'medium', 130...
How many orders were placed by each customer in the 'medium' size category?
SELECT customer_id, COUNT(*) as num_orders FROM orders WHERE size = 'medium' GROUP BY customer_id;
gretelai_synthetic_text_to_sql
CREATE TABLE cosmetics_sales(product_name TEXT, price DECIMAL(5,2), is_cruelty_free BOOLEAN, country TEXT); INSERT INTO cosmetics_sales VALUES ('Lipstick', 15.99, true, 'Canada'); INSERT INTO cosmetics_sales VALUES ('Mascara', 9.99, false, 'Canada'); INSERT INTO cosmetics_sales VALUES ('Eyeshadow', 19.99, true, 'Canada...
What is the average price of cruelty-free makeup products sold in Canada?
SELECT AVG(price) FROM cosmetics_sales WHERE is_cruelty_free = true AND country = 'Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE Players (PlayerID INT, PlayerName VARCHAR(100), Age INT, Country VARCHAR(100), Game VARCHAR(100)); INSERT INTO Players (PlayerID, PlayerName, Age, Country, Game) VALUES (1, 'John Doe', 25, 'USA', 'Fortnite'), (2, 'Jane Smith', 30, 'Canada', 'Fortnite'), (3, 'Mike Johnson', 35, 'USA', 'Call of Duty');
Identify the total number of players from the United States who play "Fortnite".
SELECT COUNT(*) FROM Players WHERE Country = 'USA' AND Game = 'Fortnite';
gretelai_synthetic_text_to_sql
CREATE TABLE satellites(satellite_id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE, launch_success BOOLEAN); INSERT INTO satellites VALUES (1, 'Sat1', 'USA', '2000-01-01', true); INSERT INTO satellites VALUES (2, 'Sat2', 'USA', '2001-01-01', false); INSERT INTO satellites VALUES (3, 'Sat3', 'China', '200...
What is the total number of satellites launched by country and their successful launch rate?
SELECT country, COUNT(*) as total_satellites, ROUND(SUM(launch_success)/COUNT(*)*100, 2) as success_rate FROM satellites GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE user_ratings (user_id INT, movie_title VARCHAR(50), rating INT, rating_date DATE); CREATE TABLE shows (show_id INT, show_name VARCHAR(50), category VARCHAR(20), air_date DATE);
Find the number of unique users who have rated R-rated movies and watched sports shows.
SELECT COUNT(DISTINCT user_id) FROM user_ratings INNER JOIN movies ON user_ratings.movie_title = movies.title INNER JOIN shows ON user_ratings.user_id = shows.show_id WHERE movies.rating = 'R' AND shows.category = 'Sports';
gretelai_synthetic_text_to_sql
CREATE TABLE user_details (user_id INT, num_posts INT); INSERT INTO user_details (user_id, num_posts) VALUES (1, 25), (2, 32), (3, 18), (4, 45);
Identify the user with the maximum number of posts in the 'social_media' schema.
SELECT user_id, num_posts FROM user_details ORDER BY num_posts DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE farms (id INT, name TEXT, region TEXT); INSERT INTO farms (id, name, region) VALUES (1, 'Farm A', 'Asia-Pacific'); INSERT INTO farms (id, name, region) VALUES (2, 'Farm B', 'Europe'); INSERT INTO farms (id, name, region) VALUES (3, 'Farm C', 'Asia-Pacific'); INSERT INTO farms (id, name, region) VALUES (4, ...
List all farms in the 'farms' table and their corresponding region.
SELECT name, region FROM farms;
gretelai_synthetic_text_to_sql
CREATE TABLE Policies (Policy_ID INT, City TEXT); INSERT INTO Policies (Policy_ID, City) VALUES (1, 'Chicago'), (2, 'Houston'), (3, 'Chicago'), (4, 'Miami'); CREATE TABLE Claims (Claim_ID INT, Policy_ID INT, Amount INT); INSERT INTO Claims (Claim_ID, Policy_ID, Amount) VALUES (1, 1, 2000), (2, 2, 3000), (3, 1, 1500), (...
What is the total number of policies and total claim amount for each city?
SELECT City, COUNT(DISTINCT Policies.Policy_ID) AS Num_Policies, SUM(Claims.Amount) AS Total_Claim_Amount FROM Policies INNER JOIN Claims ON Policies.Policy_ID = Claims.Policy_ID GROUP BY City;
gretelai_synthetic_text_to_sql
CREATE TABLE ota_bookings (booking_id INT, hotel_id INT, ota_platform TEXT, region TEXT, booking_date DATE); INSERT INTO ota_bookings (booking_id, hotel_id, ota_platform, region, booking_date) VALUES (1, 1, 'OTA E', 'Caribbean', '2022-02-01'), (2, 2, 'OTA F', 'Africa', '2022-02-10'), (3, 3, 'OTA G', 'Caribbean', '2022-...
What is the total number of OTA bookings made for hotels in the Caribbean, in the last month?
SELECT COUNT(*) FROM ota_bookings WHERE region = 'Caribbean' AND booking_date >= DATEADD(month, -1, CURRENT_DATE);
gretelai_synthetic_text_to_sql
CREATE TABLE safety_data (id INT PRIMARY KEY, application_id INT, safety_score DECIMAL(5,4), safety_category VARCHAR(50), measurement_date DATE); INSERT INTO safety_data (id, application_id, safety_score, safety_category, measurement_date) VALUES (1, 1, 0.9123, 'Security', '2021-01-15'), (2, 2, 0.8321, 'Reliability', '...
Insert new safety metrics for an application with an id of 4 and a safety score of 0.91 for the category 'Reliability'.
INSERT INTO safety_data (id, application_id, safety_score, safety_category, measurement_date) VALUES (3, 4, 0.91, 'Reliability', '2021-01-15');
gretelai_synthetic_text_to_sql
CREATE TABLE recycling_centers (location VARCHAR(50), area VARCHAR(50), province VARCHAR(50)); INSERT INTO recycling_centers (location, area, province) VALUES ('CenterA', 'rural', 'ProvinceX'), ('CenterB', 'urban', 'ProvinceY'), ('CenterC', 'rural', 'ProvinceX');
How many recycling centers are there in the rural areas and in each province?
SELECT province, COUNT(*) FROM recycling_centers WHERE area = 'rural' GROUP BY province;
gretelai_synthetic_text_to_sql
CREATE TABLE contractor_regions (contractor_id INT, region VARCHAR(255)); INSERT INTO contractor_regions (contractor_id, region) VALUES (1, 'North America'), (2, 'North America'), (3, 'Europe');
What is the total value of military equipment sales for each defense contractor, grouped by region?
SELECT r.region, d.contractor_name, SUM(s.sale_value) as total_sales FROM defense_contractors d INNER JOIN contractor_regions r ON d.contractor_id = r.contractor_id INNER JOIN military_sales s ON d.contractor_id = s.contractor_id GROUP BY r.region, d.contractor_name;
gretelai_synthetic_text_to_sql
CREATE TABLE patients (patient_id INT, age INT, gender TEXT, therapy_type TEXT); INSERT INTO patients (patient_id, age, gender, therapy_type) VALUES (1, 35, 'Female', 'CBT'); INSERT INTO patients (patient_id, age, gender, therapy_type) VALUES (2, 42, 'Male', 'DBT');
What is the most common therapy type for patients with anxiety?
SELECT therapy_type, COUNT(*) as count FROM patients WHERE condition = 'Anxiety' GROUP BY therapy_type ORDER BY count DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE RestorativeJusticeFunds (ID INT, FundID VARCHAR(20), District VARCHAR(20), Amount INT, Year INT); INSERT INTO RestorativeJusticeFunds (ID, FundID, District, Amount, Year) VALUES (1, 'RJF2015', 'North Valley', 5000, 2015), (2, 'RJF2016', 'South Peak', 8000, 2016), (3, 'RJF2018', 'North Valley', 6000, 2018);
What is the total amount of funds allocated to restorative justice programs in 'North Valley' justice district?
SELECT SUM(Amount) FROM RestorativeJusticeFunds WHERE District = 'North Valley';
gretelai_synthetic_text_to_sql
CREATE TABLE accommodations (id INT, country VARCHAR(255), region VARCHAR(255), accommodation_type VARCHAR(255), count INT); INSERT INTO accommodations (id, country, region, accommodation_type, count) VALUES (1, 'Australia', 'Northern', 'Braille Materials', 150); INSERT INTO accommodations (id, country, region, accommo...
What is the total number of accommodations provided in Australia by accommodation type?
SELECT accommodation_type, SUM(count) as total_count FROM accommodations WHERE country = 'Australia' GROUP BY accommodation_type;
gretelai_synthetic_text_to_sql
CREATE TABLE AircraftType (ID INT, Name VARCHAR(50)); CREATE TABLE Accidents (AircraftTypeID INT, AccidentDate DATE);
What is the total number of accidents for each aircraft type?
SELECT at.Name, COUNT(a.AircraftTypeID) AS AccidentCount FROM AircraftType at JOIN Accidents a ON at.ID = a.AircraftTypeID GROUP BY at.Name;
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours_sweden (id INT, country VARCHAR(20), revenue FLOAT); INSERT INTO virtual_tours_sweden (id, country, revenue) VALUES (1, 'Sweden', 800.0), (2, 'Sweden', 900.0), (3, 'Sweden', 1000.0);
What is the minimum revenue generated by a single virtual tour in Sweden?
SELECT MIN(revenue) FROM virtual_tours_sweden WHERE country = 'Sweden';
gretelai_synthetic_text_to_sql
CREATE TABLE trench_info (trench_name TEXT, ocean_basin TEXT, max_depth INTEGER);
Find the top 10 deepest trenches in the Indian Ocean.
SELECT trench_name, max_depth FROM trench_info WHERE ocean_basin = 'Indian Ocean' ORDER BY max_depth DESC LIMIT 10;
gretelai_synthetic_text_to_sql
CREATE TABLE students (id INT, name VARCHAR(255), gender VARCHAR(10), department VARCHAR(255)); CREATE TABLE departments (id INT, name VARCHAR(255), type VARCHAR(10)); INSERT INTO students (id, name, gender, department) VALUES (1, 'Alex', 'Non-binary', 'Physics'), (2, 'Bob', 'Male', 'Mathematics'), (3, 'Charlie', 'Male...
How many non-binary graduate students are there in the 'students' and 'departments' tables, grouped by department?
SELECT d.name, COUNT(s.id) FROM students s JOIN departments d ON s.department = d.name WHERE s.gender = 'Non-binary' AND d.type = 'Graduate' GROUP BY d.name;
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityHealthWorkers (CHW_ID INT, Name VARCHAR(50), Job_Title VARCHAR(50), Training_Completion_Date DATE); INSERT INTO CommunityHealthWorkers (CHW_ID, Name, Job_Title, Training_Completion_Date) VALUES (1, 'Alex', 'Community Health Worker', NULL); INSERT INTO CommunityHealthWorkers (CHW_ID, Name, Job_Titl...
Who are the community health workers who have not completed any training?
SELECT Name, Job_Title FROM CommunityHealthWorkers WHERE Training_Completion_Date IS NULL;
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists arts_culture;CREATE TABLE if not exists arts_culture.funding_sources (funding_source_id INT PRIMARY KEY, name VARCHAR(255), category VARCHAR(255));INSERT INTO arts_culture.funding_sources (funding_source_id, name, category) VALUES (1, 'National Endowment for the Arts', 'Federal Agency'), (2,...
What is the distribution of grants by funding source category?
SELECT category, COUNT(*) as grant_count FROM arts_culture.funding_sources GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE crop (id INT, type VARCHAR(255), temperature FLOAT); INSERT INTO crop (id, type, temperature) VALUES (1, 'corn', 22.5), (2, 'soybean', 20.0), (3, 'cotton', 24.3), (4, 'corn', 18.5), (5, 'soybean', 19.5);
Find the minimum temperature for all crops
SELECT MIN(temperature) FROM crop;
gretelai_synthetic_text_to_sql
CREATE TABLE hiring (id INT, employee_name VARCHAR(50), position VARCHAR(50), date_hired DATE);
Get the number of employees hired in each month of the year from the 'hiring' table
SELECT MONTH(date_hired) AS month, COUNT(*) FROM hiring GROUP BY MONTH(date_hired);
gretelai_synthetic_text_to_sql
CREATE TABLE education_programs (region TEXT, program_count INTEGER); INSERT INTO education_programs (region, program_count) VALUES ('North', 15), ('South', 20), ('East', 10), ('West', 25);
What is the total number of education programs conducted?
SELECT SUM(program_count) FROM education_programs;
gretelai_synthetic_text_to_sql
CREATE TABLE irrigation (id INT, farm_id INT, irrigation_amount INT); INSERT INTO irrigation (id, farm_id, irrigation_amount) VALUES (1, 1, 1000), (2, 2, 1500);
What is the average water requirement for crops grown in India?
SELECT AVG(crops.water_requirement) FROM crops JOIN (SELECT farm_id FROM farms WHERE country = 'India') as subquery ON crops.id = subquery.farm_id JOIN irrigation ON crops.id = irrigation.farm_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Parks (quarter INT, region VARCHAR(255), count INT); INSERT INTO Parks (quarter, region, count) VALUES (1, 'South', 50), (1, 'South', 55), (2, 'South', 60), (2, 'South', 65);
How many public parks were built in the South region between Q1 and Q2 of 2019?
SELECT SUM(count) FROM Parks WHERE (quarter = 1 OR quarter = 2) AND region = 'South';
gretelai_synthetic_text_to_sql
CREATE TABLE factories (id INT, name VARCHAR(50), location VARCHAR(50), production_count INT); INSERT INTO factories (id, name, location, production_count) VALUES (1, 'Factory A', 'Asia', 1500), (2, 'Factory B', 'Europe', 1200), (3, 'Factory C', 'Asia', 1800); CREATE TABLE waste (factory_id INT, date DATE, waste_quanti...
What is the total waste generated by factories in Asia?
SELECT f.location, SUM(w.waste_quantity) FROM waste w JOIN factories f ON w.factory_id = f.id WHERE f.location = 'Asia' GROUP BY f.location;
gretelai_synthetic_text_to_sql
CREATE TABLE Artworks (artwork VARCHAR(50), artist VARCHAR(50)); INSERT INTO Artworks (artwork, artist) VALUES ('Guernica', 'Picasso'), ('The Starry Night', 'Van Gogh');
Who is the creator of 'The Starry Night'?
SELECT artist FROM Artworks WHERE artwork = 'The Starry Night';
gretelai_synthetic_text_to_sql
CREATE TABLE military_personnel (id INT, name VARCHAR(255), branch VARCHAR(255), personnel_count INT); INSERT INTO military_personnel (id, name, branch, personnel_count) VALUES (1, 'Fort Bragg', 'Army', 53300), (2, 'Naval Base San Diego', 'Navy', 36000);
What is the number of military personnel in each branch of the US Armed Forces?
SELECT mp.branch, COUNT(*) as total_personnel FROM military_personnel AS mp GROUP BY mp.branch;
gretelai_synthetic_text_to_sql
CREATE TABLE pollution_levels (id INT, location TEXT, pollution_level FLOAT); INSERT INTO pollution_levels (id, location, pollution_level) VALUES (1, 'Mediterranean Sea', 5.0), (2, 'Baltic Sea', 3.0);
What is the minimum pollution level in the Mediterranean Sea?
SELECT MIN(pollution_level) FROM pollution_levels WHERE location = 'Mediterranean Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE wells (well_id varchar(10), production int); INSERT INTO wells (well_id, production) VALUES ('W001', 1500), ('W002', 1200);
What is the total production of well 'W001' in the year 2020?
SELECT SUM(production) FROM wells WHERE well_id = 'W001' AND YEAR(datetime) = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (SatelliteID INT, Name VARCHAR(50), Manufacturer VARCHAR(50), LaunchDate DATE, Orbit VARCHAR(50), Status VARCHAR(50)); INSERT INTO Satellites (SatelliteID, Name, Manufacturer, LaunchDate, Orbit, Status) VALUES (18, 'GPS V', 'Lockheed Martin', '2013-04-29', 'GEO', 'Active'), (19, 'GPS VI', 'Rayth...
Determine the number of satellites launched per year and their status.
SELECT YEAR(LaunchDate) AS LaunchYear, Status, COUNT(*) AS CountOfSatellites FROM Satellites GROUP BY YEAR(LaunchDate), Status;
gretelai_synthetic_text_to_sql
CREATE TABLE smart_contracts (contract_name TEXT, deployment_country TEXT, deployment_date DATE);
How many smart contracts were deployed in each country during the past year?
SELECT deployment_country, COUNT(contract_name) FROM smart_contracts WHERE deployment_date >= DATEADD(year, -1, GETDATE()) GROUP BY deployment_country;
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists rural_healthcare; use rural_healthcare; CREATE TABLE hospitals (id int, name varchar(255), location varchar(255));
What is the number of hospitals in 'rural_healthcare' schema?
SELECT COUNT(*) FROM hospitals;
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (ExhibitionID INT, Name VARCHAR(100), City VARCHAR(100), StartDate DATE, EndDate DATE); INSERT INTO Exhibitions (ExhibitionID, Name, City, StartDate, EndDate) VALUES (1, 'Paris Art Exhibition', 'Paris', '1949-05-01', '1950-09-30'), (2, 'Modern Art in Paris', 'Paris', '1968-03-01', '1971-01-10')...
How many exhibitions were there in Paris between 1950 and 1970, including those that started before 1950 and ended after 1970?
SELECT COUNT(*) FROM Exhibitions WHERE City = 'Paris' AND StartDate <= '1970-12-31' AND EndDate >= '1950-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE mobile_usage (subscriber_id INT, usage FLOAT, month INT); INSERT INTO mobile_usage (subscriber_id, usage, month) VALUES (1, 4.1, 1), (1, 4.5, 2), (1, 5.0, 3), (2, 3.0, 1), (2, 3.3, 2), (2, 3.6, 3);
Identify mobile subscribers with consecutive data usage greater than 4GB for the last 3 months, in ascending order of subscription IDs.
SELECT subscriber_id, usage, month FROM (SELECT subscriber_id, usage, month, LAG(usage, 1) OVER (PARTITION BY subscriber_id ORDER BY month) as prev_usage FROM mobile_usage) t WHERE t.usage > 4.0 AND (t.prev_usage IS NULL OR t.prev_usage <= 4.0) ORDER BY subscriber_id;
gretelai_synthetic_text_to_sql
CREATE TABLE cities (id INT, name TEXT);CREATE TABLE crimes (id INT, city_id INT, date DATE);
What is the total number of crimes committed in each city in the last 12 months?
SELECT c.name, COUNT(cr.id) FROM cities c JOIN crimes cr ON c.id = cr.city_id WHERE cr.date >= DATEADD(year, -1, GETDATE()) GROUP BY c.id;
gretelai_synthetic_text_to_sql
CREATE TABLE wells (id INT, state VARCHAR(20), date DATE); INSERT INTO wells (id, state, date) VALUES (1, 'Texas', '2020-01-01'); INSERT INTO wells (id, state, date) VALUES (2, 'Texas', '2020-02-01'); INSERT INTO wells (id, state, date) VALUES (3, 'Louisiana', '2020-03-01');
Find the number of wells drilled in Texas and Louisiana in 2020
SELECT COUNT(*) FROM wells WHERE state IN ('Texas', 'Louisiana') AND YEAR(date) = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Vessels (ID INT, Name TEXT, Voyages INT, Dangerous_Goods BOOLEAN, Prefix TEXT, Year INT);CREATE VIEW Southern_Ocean_Vessels AS SELECT * FROM Vessels WHERE Region = 'Southern Ocean';
What is the maximum number of voyages of vessels with 'HMM' prefix that carried dangerous goods in the Southern Ocean in 2017?
SELECT MAX(Voyages) FROM Southern_Ocean_Vessels WHERE Prefix = 'HMM' AND Dangerous_Goods = 1 AND Year = 2017;
gretelai_synthetic_text_to_sql
CREATE TABLE BuildingMaterials (Id INT, ProjectId INT, Material VARCHAR(50), Quantity INT, Cost DECIMAL(10,2)); INSERT INTO BuildingMaterials (Id, ProjectId, Material, Quantity, Cost) VALUES (1, 1, 'Concrete', 500, 4500.00); INSERT INTO BuildingMaterials (Id, ProjectId, Material, Quantity, Cost) VALUES (2, 2, 'Steel', ...
Which building materials were used in ProjectId 2 with a quantity greater than 350?
SELECT * FROM BuildingMaterials WHERE ProjectId = 2 AND Quantity > 350;
gretelai_synthetic_text_to_sql
CREATE TABLE sleep (id INT, user_id INT, sleep_duration INT, sleep_date DATE); INSERT INTO sleep (id, user_id, sleep_duration, sleep_date) VALUES (1, 1, 7, '2022-02-01'), (2, 2, 6, '2022-02-05');
What is the minimum sleep duration for each user in the last week?
SELECT user_id, MIN(sleep_duration) FROM sleep WHERE sleep_date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK) AND CURRENT_DATE() GROUP BY user_id;
gretelai_synthetic_text_to_sql
CREATE TABLE patients (patient_id INT, diagnosis VARCHAR(255), age INT); INSERT INTO patients (patient_id, diagnosis, age) VALUES (1, 'depression', 35), (2, 'anxiety', 28), (3, 'depression', 42), (4, 'anxiety', 50), (5, 'anxiety', 38);
What is the maximum age of patients diagnosed with anxiety in the 'mental_health' schema?
SELECT MAX(age) FROM mental_health.patients WHERE diagnosis = 'anxiety';
gretelai_synthetic_text_to_sql
CREATE TABLE independent_restaurants.inspections (restaurant_id INT, name TEXT, food_safety_violation BOOLEAN); INSERT INTO independent_restaurants.inspections (restaurant_id, name, food_safety_violation) VALUES (1, 'Fancy Eats', true), (2, 'Home Cooking', false);
Which restaurants in the 'independent_restaurants' schema have a food safety violation?
SELECT * FROM independent_restaurants.inspections WHERE food_safety_violation = true;
gretelai_synthetic_text_to_sql
CREATE TABLE attorneys (id INT, name TEXT, state TEXT); INSERT INTO attorneys (id, name, state) VALUES (1, 'Barry Zuckerkorn', 'California'); CREATE TABLE cases (id INT, attorney_id INT, result TEXT, state TEXT); INSERT INTO cases (id, attorney_id, result, state) VALUES (1, 1, 'won', 'California');
How many cases did each attorney win in California?
SELECT attorneys.name, COUNT(cases.id) FROM attorneys INNER JOIN cases ON attorneys.id = cases.attorney_id WHERE attorneys.state = 'California' AND cases.result = 'won' GROUP BY attorneys.name;
gretelai_synthetic_text_to_sql
CREATE TABLE rural_infrastructure (id INT, project_name VARCHAR(255), budget INT, location VARCHAR(255));
List the names and budgets of all rural infrastructure projects in the 'rural_infrastructure' table that are located in 'Asia'.
SELECT project_name, budget FROM rural_infrastructure WHERE location = 'Asia';
gretelai_synthetic_text_to_sql
CREATE TABLE movie (id INT, title VARCHAR(100), release_year INT, country VARCHAR(50), genre VARCHAR(50), budget INT); INSERT INTO movie (id, title, release_year, country, genre, budget) VALUES (1, 'Movie1', 2016, 'India', 'Action', 10000000); INSERT INTO movie (id, title, release_year, country, genre, budget) VALUES (...
What is the average budget for Indian movies released after 2015, grouped by genre?
SELECT genre, AVG(budget) FROM movie WHERE country = 'India' AND release_year > 2015 GROUP BY genre;
gretelai_synthetic_text_to_sql
CREATE TABLE Military_Equipment_Sales(id INT, country VARCHAR(50), equipment_type VARCHAR(50), sale_value FLOAT); INSERT INTO Military_Equipment_Sales(id, country, equipment_type, sale_value) VALUES (1, 'South Korea', 'Aircraft', 30000000), (2, 'Japan', 'Vehicles', 20000000);
What is the total value of military equipment sales to South Korea and Japan?
SELECT SUM(sale_value) FROM Military_Equipment_Sales WHERE country IN ('South Korea', 'Japan');
gretelai_synthetic_text_to_sql
CREATE TABLE clinical_trials (drug_name TEXT, trial_status TEXT); INSERT INTO clinical_trials (drug_name, trial_status) VALUES ('DrugA', 'Approved'), ('DrugB', 'Denied'), ('DrugC', 'Pending');
What is the approval status of a specific drug in clinical trials?
SELECT trial_status FROM clinical_trials WHERE drug_name = 'DrugA';
gretelai_synthetic_text_to_sql
CREATE TABLE autonomous_trains (train_id INT, trip_id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, start_latitude DECIMAL(9,6), start_longitude DECIMAL(9,6), end_latitude DECIMAL(9,6), end_longitude DECIMAL(9,6), distance DECIMAL(10,2), trip_date DATE);
What is the average distance traveled per day by autonomous trains in Berlin?
SELECT AVG(distance/100) FROM autonomous_trains WHERE start_longitude BETWEEN 13.1 AND 13.8 AND start_latitude BETWEEN 52.3 AND 52.7 GROUP BY DATE(trip_date);
gretelai_synthetic_text_to_sql
CREATE TABLE articles (id INT, publication_date DATE, topic TEXT); INSERT INTO articles VALUES (1, '2022-01-01', 'Media Literacy'), (2, '2022-01-15', 'Content Diversity'), (3, '2022-02-01', 'Media Representation'), (4, '2022-02-15', 'Disinformation Detection'), (5, '2022-03-01', 'Media Literacy'), (6, '2022-03-15', 'C...
What is the total number of articles published per month?
SELECT EXTRACT(MONTH FROM publication_date) as month, COUNT(*) as article_count FROM articles GROUP BY month;
gretelai_synthetic_text_to_sql
CREATE TABLE departments (dept_id INT, dept_name TEXT); CREATE TABLE courses (course_id INT, course_name TEXT, dept_id INT, num_students INT); INSERT INTO departments (dept_id, dept_name) VALUES (1, 'Computer Science'), (2, 'Mathematics'), (3, 'English'); INSERT INTO courses (course_id, course_name, dept_id, num_studen...
What is the minimum number of students enrolled in a course in each department?
SELECT dept_name, MIN(num_students) as min_enrollment FROM departments JOIN courses ON departments.dept_id = courses.dept_id GROUP BY dept_name;
gretelai_synthetic_text_to_sql
CREATE TABLE customer (customer_id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE debit_card (transaction_id INT, customer_id INT, value DECIMAL(10,2), timestamp TIMESTAMP, currency VARCHAR(3)); CREATE TABLE foreign_exchange (date DATE, currency VARCHAR(3), rate DECIMAL(10,4));
What is the average transaction value, in EUR, for each customer in the "debit_card" table, grouped by their country, for transactions that occurred in the month of May 2023?
SELECT c.country, AVG(dc.value * fx.rate) as avg_value FROM customer c JOIN debit_card dc ON c.customer_id = dc.customer_id LEFT JOIN foreign_exchange fx ON dc.currency = fx.currency AND DATE_FORMAT(dc.timestamp, '%Y-%m') = '2023-05' GROUP BY c.country;
gretelai_synthetic_text_to_sql
CREATE TABLE farmers (id INT, name VARCHAR(50), region VARCHAR(50), sustainability_rating INT);
Identify unique fish farmers in the Mediterranean with sustainable practices
SELECT DISTINCT name FROM farmers WHERE region = 'Mediterranean' AND sustainability_rating = 5;
gretelai_synthetic_text_to_sql
CREATE TABLE Safety_Testing (Vehicle_ID INT, Manufacturer VARCHAR(30), Model VARCHAR(20), Safety_Rating FLOAT);
What is the minimum safety rating of vehicles in the Safety_Testing table?
SELECT MIN(Safety_Rating) FROM Safety_Testing;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_life (species_name TEXT, location TEXT); INSERT INTO marine_life (species_name, location) VALUES ('Narwhal', 'Arctic Ocean'), ('Beluga', 'Arctic Ocean'), ('Walrus', 'Arctic Ocean'), ('Bearded Seal', 'Arctic Ocean'), ('Ringed Seal', 'Arctic Ocean');
How many species of marine life are present in the Arctic Ocean?
SELECT COUNT(DISTINCT species_name) FROM marine_life WHERE location = 'Arctic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (id INT PRIMARY KEY, name TEXT, location TEXT, sustainability_rating REAL);
Insert the following suppliers into the suppliers table: (1, 'Acme Quinoa Inc.', 'Colorado, USA', 4.2), (2, 'Boulder Salt Co.', 'Utah, USA', 4.5), (3, 'Green Olive Oil Ltd.', 'Italy', 4.8)
INSERT INTO suppliers (id, name, location, sustainability_rating) VALUES (1, 'Acme Quinoa Inc.', 'Colorado, USA', 4.2), (2, 'Boulder Salt Co.', 'Utah, USA', 4.5), (3, 'Green Olive Oil Ltd.', 'Italy', 4.8);
gretelai_synthetic_text_to_sql
CREATE TABLE wells (id INT, location VARCHAR(20), depth FLOAT); INSERT INTO wells (id, location, depth) VALUES (1, 'Gulf of Mexico', 2500.3); INSERT INTO wells (id, location, depth) VALUES (2, 'Gulf of Mexico', 1800.5); INSERT INTO wells (id, location, depth) VALUES (3, 'Arctic', 4000.0);
What is the minimum depth of wells drilled in the Gulf of Mexico?
SELECT MIN(depth) FROM wells WHERE location = 'Gulf of Mexico';
gretelai_synthetic_text_to_sql
CREATE TABLE projects(id INT, project_name VARCHAR(50), project_type VARCHAR(50), country VARCHAR(50));CREATE TABLE project_capacity(project_id INT, capacity_mw FLOAT);
List the total installed capacity for each country in the projects and project_capacity tables, excluding South America.
SELECT p.country, SUM(pc.capacity_mw) AS total_capacity FROM projects p INNER JOIN project_capacity pc ON p.id = pc.project_id WHERE p.country NOT LIKE 'SA%' GROUP BY p.country;
gretelai_synthetic_text_to_sql
CREATE TABLE tourism_trends (trend_id INT, trend_name VARCHAR(50), popularity_score DECIMAL(3,1), PRIMARY KEY (trend_id));
Insert a new record into the "tourism_trends" table with the following information: trend_id = 201, trend_name = 'Virtual Reality Tours', popularity_score = 9.2
INSERT INTO tourism_trends (trend_id, trend_name, popularity_score) VALUES (201, 'Virtual Reality Tours', 9.2);
gretelai_synthetic_text_to_sql
CREATE TABLE excavations (id INT, country VARCHAR(255)); INSERT INTO excavations (id, country) VALUES (1, 'Mexico'), (2, 'USA'), (3, 'Canada');
Count the number of excavation sites in each country, sorted by the count in descending order.
SELECT country, COUNT(*) AS excavation_count FROM excavations GROUP BY country ORDER BY excavation_count DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Carbon_Offset_Programs (id INT, sector VARCHAR(20), year INT, carbon_offset_amount INT); INSERT INTO Carbon_Offset_Programs (id, sector, year, carbon_offset_amount) VALUES (1, 'Transportation', 2018, 40000), (2, 'Energy Production', 2019, 75000), (3, 'Transportation', 2020, 45000), (4, 'Manufacturing', 202...
What is the minimum carbon offset amount for carbon offset programs in the 'Transportation' sector?
SELECT MIN(carbon_offset_amount) FROM Carbon_Offset_Programs WHERE sector = 'Transportation';
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, city TEXT, hours INT, open_pedagogy BOOLEAN);
What is the total number of hours spent on open pedagogy projects by students in each city?
SELECT city, SUM(hours) FROM projects WHERE open_pedagogy = TRUE GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE energy_storage (country VARCHAR(50), num_projects INT); INSERT INTO energy_storage (country, num_projects) VALUES ('Indonesia', 10), ('Malaysia', 15), ('Thailand', 20);
How many energy storage projects are there in Indonesia, Malaysia, and Thailand?
SELECT country, num_projects FROM energy_storage WHERE country IN ('Indonesia', 'Malaysia', 'Thailand');
gretelai_synthetic_text_to_sql
CREATE TABLE Samarium_Production (id INT, year INT, country VARCHAR(20), production_volume INT);
What is the total production volume of Samarium in Canada and the USA combined?
SELECT SUM(production_volume) FROM Samarium_Production WHERE country IN ('Canada', 'USA');
gretelai_synthetic_text_to_sql
CREATE TABLE RuralHealthFacility9 (patient_id INT, patient_name VARCHAR(50), age INT, diagnosis VARCHAR(20));
Insert a new patient 'Oliver' with age 40 and diagnosis 'hypertension' into 'RuralHealthFacility9' table.
INSERT INTO RuralHealthFacility9 (patient_id, patient_name, age, diagnosis) VALUES (21, 'Oliver', 40, 'hypertension');
gretelai_synthetic_text_to_sql
CREATE TABLE Production (fabric_type VARCHAR(20), date DATE, quantity INT); INSERT INTO Production (fabric_type, date, quantity) VALUES ('Recycled Polyester', '2021-09-01', 1200), ('Recycled Polyester', '2021-10-01', 1300), ('Recycled Polyester', '2021-11-01', 1400), ('Recycled Polyester', '2021-12-01', 1500), ('Recycl...
Calculate the moving average of 'Recycled Polyester' production (in kg) over the past 3 months.
SELECT fabric_type, AVG(quantity) OVER (PARTITION BY fabric_type ORDER BY date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) as moving_avg, date FROM Production WHERE fabric_type = 'Recycled Polyester';
gretelai_synthetic_text_to_sql
CREATE TABLE drug_approval (id INT, drug_name VARCHAR(255), approval_year INT, cost DECIMAL(10,2)); INSERT INTO drug_approval (id, drug_name, approval_year, cost) VALUES (1, 'DrugA', 2018, 1200.00), (2, 'DrugB', 2019, 1500.00), (3, 'DrugC', 2020, 2000.00), (4, 'DrugD', 2021, 2500.00);
What is the average cost of drugs approved in 2020?
SELECT AVG(cost) FROM drug_approval WHERE approval_year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE environmental_impact (site_id INT, date DATE, co2_emissions FLOAT, water_consumption FLOAT); INSERT INTO environmental_impact (site_id, date, co2_emissions, water_consumption) VALUES (1, '2021-01-01', 150.5, 20000), (1, '2021-01-02', 160.3, 21000), (1, '2021-01-03', 158.7, 20500);
What are the CO2 emissions for site 1 on January 3rd, 2021?
SELECT date, co2_emissions FROM environmental_impact WHERE site_id = 1 AND date = '2021-01-03';
gretelai_synthetic_text_to_sql
CREATE TABLE energy_efficiency_china (id INT, sector VARCHAR(50), year INT, improvement FLOAT);
What is the minimum energy efficiency improvement in the Chinese industrial sector?
SELECT MIN(improvement) FROM energy_efficiency_china WHERE sector = 'industrial';
gretelai_synthetic_text_to_sql
CREATE TABLE Astronauts (id INT, name VARCHAR(50), organization VARCHAR(50)); CREATE TABLE Missions (id INT, astronaut_id INT, company VARCHAR(50), mission_type VARCHAR(50)); INSERT INTO Astronauts (id, name, organization) VALUES (1, 'Alice', 'SpacePioneers'), (2, 'Bob', 'SpacePioneers'), (3, 'Charlie', 'SpacePioneers'...
Who are the astronauts that have not been on any mission for 'SpacePioneers'?
SELECT a.name FROM Astronauts a LEFT JOIN Missions m ON a.id = m.astronaut_id AND a.organization = m.company WHERE m.id IS NULL AND a.organization = 'SpacePioneers';
gretelai_synthetic_text_to_sql
CREATE TABLE Policies (PolicyID TEXT, PolicyHolder TEXT, Premium INT); INSERT INTO Policies (PolicyID, PolicyHolder, Premium) VALUES ('P123', 'John Doe', 1000); INSERT INTO Policies (PolicyID, PolicyHolder, Premium) VALUES ('Y456', 'Jane Smith', 2000);
What are the details of policies with premiums between 500 and 2000?
SELECT * FROM Policies WHERE Premium BETWEEN 500 AND 2000;
gretelai_synthetic_text_to_sql
CREATE TABLE healthcare_providers (provider_id INT, name TEXT, state TEXT); INSERT INTO healthcare_providers (provider_id, name, state) VALUES (1, 'Ms. Sofia Patel', 'NJ'); CREATE TABLE cultural_competency (provider_id INT, score INT, community TEXT);
Find underrepresented communities with cultural competency scores above 80 in NJ.
SELECT c.community, AVG(c.score) AS avg_score FROM cultural_competency c INNER JOIN healthcare_providers h ON c.provider_id = h.provider_id WHERE h.state = 'NJ' AND c.community IN ('Underrepresented') GROUP BY c.community HAVING avg_score > 80;
gretelai_synthetic_text_to_sql
CREATE TABLE Water_treatment_plants (Name VARCHAR(255), Capacity_gallons_per_day INT, State VARCHAR(255)); INSERT INTO Water_treatment_plants (Name, Capacity_gallons_per_day, State) VALUES ('Los Angeles Water Reclamation Plant', 200, 'California');
Which water treatment plants in California have a capacity over 100 million gallons per day?
SELECT Name FROM Water_treatment_plants WHERE Capacity_gallons_per_day > 100 AND State = 'California';
gretelai_synthetic_text_to_sql
CREATE TABLE Staff (StaffID INT, Region VARCHAR(50)); INSERT INTO Staff (StaffID, Region) VALUES (1, 'Northeast'), (2, 'Southeast'), (3, 'Midwest'), (4, 'West'), (5, 'Northeast'), (6, 'Southeast'), (7, 'Midwest'), (8, 'West'), (9, 'Northeast'), (10, 'Southeast'), (11, 'Midwest'), (12, 'West'); CREATE TABLE SupportStaff...
List all regions and the number of support staff working in each
SELECT Region, COUNT(DISTINCT StaffID) as NumSupportStaff FROM Staff JOIN SupportStaff ON Staff.StaffID = SupportStaff.StaffID GROUP BY Region;
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 Texas, USA.
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 = 'Texas, USA';
gretelai_synthetic_text_to_sql
CREATE TABLE esports_events (id INT, name VARCHAR(255), date DATE);
Delete the row with ID 3 from the 'esports_events' table
DELETE FROM esports_events WHERE id = 3;
gretelai_synthetic_text_to_sql
CREATE TABLE employees(employee_id INT, department VARCHAR(255), employment_date DATE); INSERT INTO employees(employee_id, department, employment_date) VALUES (1, 'Department of Justice', '2022-01-01');
What is the total number of employees in the Department of Justice as of January 1, 2022?
SELECT COUNT(*) FROM employees WHERE department = 'Department of Justice' AND EXTRACT(YEAR FROM employment_date) = 2022 AND EXTRACT(MONTH FROM employment_date) = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Artworks(id INT, title VARCHAR(255)); INSERT INTO Artworks(id, title) VALUES (1, 'Impression, Sunrise'); INSERT INTO Artworks(id, title) VALUES (2, 'Ballet Rehearsal'); INSERT INTO Artworks(id, title) VALUES (3, 'The Card Players'); INSERT INTO Artworks(id, title) VALUES (4, 'Starry Night'); INSERT INTO Ar...
What is the total number of artworks in the database?
SELECT COUNT(*) FROM Artworks;
gretelai_synthetic_text_to_sql
CREATE TABLE ota_partners (id INT, partner_name TEXT, region TEXT, commission_percentage FLOAT); INSERT INTO ota_partners (id, partner_name, region, commission_percentage) VALUES (1, 'Expedia', 'Europe', 0.15), (2, 'Booking.com', 'Europe', 0.18), (3, 'Agoda', 'Asia', 0.12);
What is the average commission percentage of OTA partners based in 'Europe'?
SELECT AVG(commission_percentage) FROM ota_partners WHERE region = 'Europe';
gretelai_synthetic_text_to_sql