context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE ProductMaterials (product_id INT, sustainable_materials BOOLEAN); | What is the percentage of products made with sustainable materials in India? | SELECT 100.0 * COUNT(*) / (SELECT COUNT(*) FROM ProductMaterials) FROM ProductMaterials WHERE sustainable_materials = TRUE AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE intel_ops (id INT, name VARCHAR(255), type VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO intel_ops (id, name, type, location, start_date, end_date) VALUES (1, 'Operation Iraqi Freedom', 'Military Operation', 'Iraq', '2003-03-20', '2011-12-15'); INSERT INTO intel_ops (id,... | Which military operations were initiated after the ones initiated by Israel? | SELECT name, type, location, start_date, LAG(start_date) OVER (ORDER BY start_date) as previous_start_date FROM intel_ops WHERE type = 'Military Operation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (loan_id INT, client_id INT, loan_type VARCHAR(50), issue_date DATE, country VARCHAR(50)); | Add a new row to the 'loans' table for a socially responsible loan issued to a client in Malaysia. | INSERT INTO loans VALUES (1001, 3, 'Socially Responsible Loan', '2022-04-01', 'Malaysia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE luxury_hotel_rooms (id INT, country VARCHAR(50), rooms INT); INSERT INTO luxury_hotel_rooms (id, country, rooms) VALUES (1, 'South Africa', 500), (2, 'South Africa', 600), (3, 'South Africa', 700), (4, 'Morocco', 400); | What is the total number of luxury hotel rooms in South Africa? | SELECT SUM(rooms) FROM luxury_hotel_rooms WHERE country = 'South Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE savings_accounts (account_id INT, customer_id INT, account_open_date DATE, is_shariah_compliant BOOLEAN);CREATE TABLE customers (customer_id INT, customer_name VARCHAR(255), customer_type VARCHAR(255));INSERT INTO customers (customer_id, customer_name, customer_type) VALUES (1, 'John Doe', 'New'), (2, 'Jan... | How many Shariah-compliant savings accounts were opened in the last 6 months by new customers? | SELECT COUNT(sa.account_id) as new_shariah_compliant_savings_accounts FROM savings_accounts sa INNER JOIN customers c ON sa.customer_id = c.customer_id WHERE sa.account_open_date BETWEEN (CURRENT_DATE - INTERVAL '6 months') AND CURRENT_DATE AND sa.is_shariah_compliant = TRUE AND c.customer_type = 'New'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (CaseID INT, Region VARCHAR(25)); INSERT INTO MentalHealthParity (CaseID, Region) VALUES (1, 'Northeast'), (2, 'Midwest'), (3, 'South'), (4, 'Northeast'), (5, 'West'); | How many mental health parity cases were reported in each region? | SELECT Region, COUNT(*) as NumCases FROM MentalHealthParity GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE if NOT EXISTS community_education (program_id INT, program_name VARCHAR(50), donation_count INT); INSERT INTO community_education (program_id, program_name, donation_count) VALUES (1, 'Wildlife Conservation 101', 500); INSERT INTO community_education (program_id, program_name, donation_count) VALUES (2, 'E... | List the community education programs that have received more than 500 donations. | SELECT program_name FROM community_education WHERE donation_count > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy_performance (id INT AUTO_INCREMENT, company_name VARCHAR(50), waste_reduction_percentage FLOAT, PRIMARY KEY(id)); | Insert 3 records in the 'circular_economy_performance' table with values: ('Company A', 35.5), ('Company B', 28.6), ('Company C', 42.2) | INSERT INTO circular_economy_performance (company_name, waste_reduction_percentage) VALUES ('Company A', 35.5), ('Company B', 28.6), ('Company C', 42.2); | gretelai_synthetic_text_to_sql |
CREATE TABLE GlobalSales (id INT, vehicle_type VARCHAR(50), quantity INT); INSERT INTO GlobalSales (id, vehicle_type, quantity) VALUES (1, 'Hybrid', 35000), (2, 'Electric', 40000), (3, 'Autonomous', 20000), (4, 'Sedan', 45000), (5, 'SUV', 50000), (6, 'Truck', 55000); | What is the total number of hybrid vehicles sold in the world? | SELECT SUM(quantity) FROM GlobalSales WHERE vehicle_type = 'Hybrid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_treatment (id INT, location TEXT, treatment_date DATE, volume FLOAT); INSERT INTO wastewater_treatment (id, location, treatment_date, volume) VALUES (1, 'New York City', '2022-01-01', 1000000), (2, 'New York City', '2022-02-01', 1200000), (3, 'Buffalo', '2022-01-01', 500000); | What is the total volume of wastewater treated in New York State by month? | SELECT MONTH(treatment_date) as month, SUM(volume) as total_volume FROM wastewater_treatment WHERE location LIKE 'New York%' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE associated_press (article_id INT, title TEXT, category TEXT, publisher TEXT); INSERT INTO associated_press (article_id, title, category, publisher) VALUES (1, 'Article 1', 'US', 'Associated Press'), (2, 'Article 2', 'World', 'Associated Press'); CREATE TABLE reuters (article_id INT, title TEXT, category TE... | Identify the total number of articles published by 'Associated Press' and 'Reuters' in the 'US' and 'World' categories. | SELECT COUNT(*) FROM ( (SELECT * FROM associated_press WHERE category IN ('US', 'World')) UNION (SELECT * FROM reuters WHERE category IN ('World')) ); | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_ops (operation TEXT, region TEXT, cost INTEGER); INSERT INTO intelligence_ops (operation, region, cost) VALUES ('Operation Red', 'Asia', 10000), ('Operation Blue', 'Europe', 8000), ('Operation Green', 'Asia', 12000); | List all intelligence operations in the 'Asia' region and their corresponding costs. | SELECT operation, cost FROM intelligence_ops WHERE region = 'Asia' | gretelai_synthetic_text_to_sql |
CREATE TABLE education_workers (id INT, sector VARCHAR(20), union_member BOOLEAN); INSERT INTO education_workers (id, sector, union_member) VALUES (1, 'education', TRUE), (2, 'education', FALSE), (3, 'education', TRUE), (4, 'education', FALSE); | Calculate the ratio of union members to non-union members in the 'education' sector | SELECT (COUNT(*) FILTER (WHERE union_member = TRUE) * 1.0 / COUNT(*) FILTER (WHERE union_member = FALSE)) AS union_ratio FROM education_workers; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, datetime DATETIME, hashtags VARCHAR(255)); INSERT INTO posts (id, user_id, datetime, hashtags) VALUES (1, 123, '2021-01-01 12:00:00', '#climatechange, #eco'), (2, 456, '2021-12-31 23:59:59', '#climatechange'); | What was the daily average number of user posts containing the hashtag "#climatechange" between January 1, 2021 and December 31, 2021? | SELECT AVG(count) as avg_daily_posts FROM (SELECT DATE(datetime) as date, COUNT(*) as count FROM posts WHERE hashtags LIKE '%#climatechange%' AND datetime BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY date) as daily_posts; | gretelai_synthetic_text_to_sql |
CREATE VIEW first_medical_records AS SELECT astronaut_id, MIN(medical_record_date) AS first_date FROM astronaut_medical GROUP BY astronaut_id; | Calculate the average weight of astronauts on their first medical record. | SELECT AVG(weight) FROM astronaut_medical INNER JOIN first_medical_records ON astronaut_medical.astronaut_id = first_medical_records.astronaut_id AND astronaut_medical.medical_record_date = first_medical_records.first_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_data (region VARCHAR(255), year INT, anomaly FLOAT); INSERT INTO climate_data (region, year, anomaly) VALUES ('North America', 2016, 1.2), ('North America', 2017, 1.5), ('South America', 2018, 1.4), ('Asia', 2019, 1.8), ('Asia', 2020, 1.6), ('Africa', 2021, 2.0); | What is the maximum temperature anomaly for Asia? | SELECT MAX(anomaly) FROM climate_data WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE resources (id INT, mine_type VARCHAR(50), country VARCHAR(50), reserve_tons INT); | Insert a new record into the "resources" table for a new gold mine in "Peru" with ID 901 and reserves of 5000 tons | INSERT INTO resources (id, mine_type, country, reserve_tons) VALUES (901, 'gold', 'Peru', 5000); | gretelai_synthetic_text_to_sql |
CREATE TABLE Contractors (ContractorID INT, ContractorName VARCHAR(50), City VARCHAR(50), State VARCHAR(2), Country VARCHAR(50)); CREATE TABLE LaborStatistics (StatisticID INT, ContractorID INT, EmployeeCount INT, HourlyRate FLOAT, Date DATE); INSERT INTO Contractors (ContractorID, ContractorName, City, State, Country)... | What is the average hourly labor rate for contractors in California? | SELECT ContractorID FROM Contractors WHERE State = 'CA'; SELECT AVG(HourlyRate) FROM LaborStatistics WHERE ContractorID IN (SELECT ContractorID FROM Contractors WHERE State = 'CA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE pilates_classes (class_id INT, user_id INT, duration INT, last_name VARCHAR(20)); | What is the total duration (in minutes) of all pilates classes taken by users with the last name 'Garcia'? | SELECT SUM(duration) FROM pilates_classes WHERE last_name = 'Garcia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE matches (match_id INT, home_team TEXT, away_team TEXT, home_points INT, away_points INT, match_date DATE); | Add a new volleyball match to the 'matches' table with the given details. | INSERT INTO matches (match_id, home_team, away_team, home_points, away_points, match_date) VALUES (1, 'Italy', 'Brazil', 3, 1, '2022-07-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Guides (id INT, name TEXT, city TEXT, country TEXT);CREATE TABLE VirtualTours (id INT, guide_id INT, date DATE); | Determine the average number of virtual tours per guide in 2024, for guides who have led at least 10 tours. | SELECT AVG(virtual_tours_per_guide) FROM (SELECT guide_id, COUNT(*) AS virtual_tours_per_guide FROM VirtualTours WHERE YEAR(date) = 2024 GROUP BY guide_id HAVING COUNT(*) >= 10) AS Subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Department VARCHAR(50), Manager VARCHAR(50)); INSERT INTO Employees (EmployeeID, Name, Department, Manager) VALUES (1, 'John Doe', 'HR', 'Peter'), (2, 'Jane Smith', 'IT', 'Sarah'), (3, 'Mike Johnson', 'HR', 'Peter'), (4, 'Emma White', 'Finance', 'David'); CREATE... | Who is the manager for each department? | SELECT e.Department, e.Manager FROM Employees e JOIN Departments d ON e.Department = d.Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Berlin_Neighborhoods (Neighborhood VARCHAR(255), Price INT); INSERT INTO Berlin_Neighborhoods (Neighborhood, Price) VALUES ('Mitte', 800000), ('Prenzlauer Berg', 700000), ('Friedrichshain', 600000), ('Kreuzberg', 500000), ('Neukoelln', 400000); | Show the top 3 most affordable neighborhoods in Berlin based on property price. | SELECT Neighborhood, Price FROM Berlin_Neighborhoods ORDER BY Price LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (ID INT, Disease VARCHAR(20), State VARCHAR(20)); INSERT INTO Patients (ID, Disease, State) VALUES (1, 'Influenza', 'California'), (2, 'Pneumonia', 'California'); | What is the total number of patients diagnosed with Influenza or Pneumonia in each state? | SELECT Disease, State, COUNT(*) AS Total FROM Patients WHERE Disease IN ('Influenza', 'Pneumonia') GROUP BY Disease, State; | gretelai_synthetic_text_to_sql |
CREATE TABLE Community_Centers (cc_name TEXT, families_assisted INTEGER, assist_date DATE); INSERT INTO Community_Centers (cc_name, families_assisted, assist_date) VALUES ('Center A', 200, '2021-04-01'); INSERT INTO Community_Centers (cc_name, families_assisted, assist_date) VALUES ('Center B', 150, '2021-05-15'); | How many families were assisted by each community center in Q2 of 2021? | SELECT cc_name, SUM(families_assisted) FROM Community_Centers WHERE assist_date BETWEEN '2021-04-01' AND '2021-06-30' GROUP BY cc_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipment (shipment_id INT, warehouse_id INT, delivery_date DATE); INSERT INTO Shipment (shipment_id, warehouse_id, delivery_date) VALUES (1, 1, '2022-01-01'), (2, 2, '2022-02-01'), (3, 3, '2022-03-01'), (4, 1, '2022-04-01'), (5, 2, '2022-05-01'); CREATE TABLE Warehouse (warehouse_id INT, warehouse_name VAR... | What is the average delivery time for shipments that were delivered to warehouses in the state of New York? | SELECT AVG(DATEDIFF('day', s.delivery_date, w.state_joined_date)) as avg_delivery_time FROM Shipment s JOIN Warehouse w ON s.warehouse_id = w.warehouse_id WHERE w.state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT PRIMARY KEY, name VARCHAR(50)); INSERT INTO species (id, name) VALUES (1, 'Spruce'); INSERT INTO species (id, name) VALUES (2, 'Pine'); CREATE TABLE trees (id INT PRIMARY KEY, species_id INT, age INT, height INT); INSERT INTO trees (id, species_id, age, height) VALUES (1, 1, 50, 30); INSERT... | What is the average age of trees in each species for trees with a height greater than 35? | SELECT s.name, AVG(t.age) FROM trees t JOIN species s ON t.species_id = s.id WHERE t.height > 35 GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (country VARCHAR(20), element VARCHAR(10), impact FLOAT); INSERT INTO environmental_impact VALUES ('China', 'Europium', 6.1), ('China', 'Gadolinium', 7.6), ('United States', 'Europium', 2.7), ('United States', 'Gadolinium', 3.5), ('Australia', 'Europium', 2.2), ('Australia', 'Gadoliniu... | Compare the environmental impact of Europium and Gadolinium production in different countries | SELECT element, country, impact FROM environmental_impact WHERE element IN ('Europium', 'Gadolinium') ORDER BY element, country, impact; | gretelai_synthetic_text_to_sql |
CREATE TABLE museums (id INT, name VARCHAR(50), sector VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO museums (id, name, sector, revenue) VALUES (1, 'Louvre Museum', 'public', 320000000.00); INSERT INTO museums (id, name, sector, revenue) VALUES (2, 'Vatican Museums', 'public', 450000000.00); INSERT INTO museums (id,... | What is the total revenue generated by each museum in the 'public' sector? | SELECT sector, SUM(revenue) FROM museums WHERE sector = 'public' GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, student_name VARCHAR(255), gender VARCHAR(255), age INT, accommodation_date DATE); | Identify the number of students who received accommodations in the last year, grouped by their gender, age, and the type of accommodation? | SELECT s.gender, s.age, a.accommodation_type, COUNT(*) as accommodations_count FROM students s JOIN (SELECT EXTRACT(YEAR FROM accommodation_date) as accommodation_year, accommodation_type FROM accommodations WHERE accommodation_date >= DATEADD(year, -1, CURRENT_DATE)) a ON s.student_id = a.student_id GROUP BY s.gender,... | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (id serial, name text); CREATE TABLE grants (id serial, researcher_id integer, title text, amount real, year integer); | Insert a new research grant for researcher 3 in 2022 | INSERT INTO grants (researcher_id, title, amount, year) VALUES (3, 'Glacier Melt in Greenland', 50000, 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_unions.strikes (id INT, union TEXT, year INT, duration INT); | How many strikes took place in 'mining_unions' in the year 2010? | SELECT COUNT(*) FROM mining_unions.strikes WHERE year = 2010 AND union_member = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE PollutionSources (SourceID INT PRIMARY KEY, SourceName TEXT);CREATE TABLE PollutionLevels (LevelID INT PRIMARY KEY, SourceID INT, PollutionLevel FLOAT, FOREIGN KEY (SourceID) REFERENCES PollutionSources(SourceID)); | Show all pollution sources with their respective maximum pollution levels in the 'PollutionLevels' table. | SELECT PollutionSources.SourceName, PollutionLevels.PollutionLevel FROM PollutionSources JOIN PollutionLevels ON PollutionSources.SourceID = PollutionLevels.SourceID; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_figures_2 (drug_name TEXT, region TEXT, sales_value NUMERIC); INSERT INTO sales_figures_2 (drug_name, region, sales_value) VALUES ('Drexo', 'South Africa', 800000), ('Axo', 'Nigeria', 900000); | Calculate the total sales figure for all drugs in Africa. | SELECT SUM(sales_value) FROM sales_figures_2 WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity (id INT, company_id INT, gender VARCHAR(50), race VARCHAR(50), role VARCHAR(50)); INSERT INTO diversity (id, company_id, gender, race, role) VALUES (1, 1, 'Female', 'Asian', 'Engineer'); INSERT INTO diversity (id, company_id, gender, race, role) VALUES (2, 2, 'Male', 'Hispanic', 'Executive'); CRE... | What is the percentage of diverse individuals in the workforce for companies with headquarters in 'Brazil' and 'India'? | SELECT d.company_id, ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM diversity WHERE company_id = d.company_id), 2) as percentage FROM diversity d WHERE (SELECT country FROM company WHERE id = d.company_id) IN ('Brazil', 'India') GROUP BY d.company_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (company_id INT, department VARCHAR(20)); INSERT INTO companies (company_id, department) VALUES (1, 'manufacturing'), (2, 'HR'), (3, 'manufacturing'); CREATE TABLE employees (employee_id INT, company_id INT); CREATE TABLE training (employee_id INT, training VARCHAR(20)); INSERT INTO employees (em... | What is the total number of employees working in the 'manufacturing' department, excluding any employees who also appear in the 'training' table? | SELECT COUNT(*) FROM companies INNER JOIN employees ON companies.company_id = employees.company_id WHERE companies.department = 'manufacturing' AND employees.employee_id NOT IN (SELECT employee_id FROM training); | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name TEXT, region TEXT, year INT);CREATE TABLE projects (id INT, name TEXT, region TEXT, year INT); | What is the total number of farmers and community development projects in 'rural_development' database, grouped by region and year? | SELECT region, year, COUNT(DISTINCT farmers.id) + COUNT(DISTINCT projects.id) FROM farmers FULL OUTER JOIN projects ON farmers.region = projects.region AND farmers.year = projects.year GROUP BY region, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE seoul_bikeshare (trip_id INT, start_station VARCHAR(100), end_station VARCHAR(100), start_time TIMESTAMP); CREATE TABLE tokyo_bikeshare (ride_id INT, start_station VARCHAR(100), end_station VARCHAR(100), start_time TIMESTAMP); | Find the difference in the number of bike-sharing trips between Seoul and Tokyo. | SELECT COUNT(*) FROM seoul_bikeshare EXCEPT SELECT COUNT(*) FROM tokyo_bikeshare; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, dish_id INT, sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO sales (id, dish_id, sale_date, revenue) VALUES (1, 101, '2021-07-01', 50.00), (2, 102, '2021-07-02', 35.00), (3, 103, '2021-07-03', 60.00); CREATE TABLE dishes (id INT, name TEXT, is_vegan BOOLEAN); INSERT INTO dishes (id, name... | What is the total revenue generated from vegan dishes in the last six months? | SELECT SUM(sales.revenue) FROM sales JOIN dishes ON sales.dish_id = dishes.id WHERE dishes.is_vegan = true AND sales.sale_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (satellite_id INT, name VARCHAR(255), country VARCHAR(255), altitude FLOAT, constellation VARCHAR(255)); INSERT INTO Satellites (satellite_id, name, country, altitude, constellation) VALUES (1, 'SpaceX-1', 'USA', 550, 'Starlink'), (2, 'SpaceX-2', 'USA', 550, 'Starlink'), (3, 'OneWeb-1', 'UK', 12... | What is the average altitude of satellites in the Starlink constellation? | SELECT AVG(altitude) FROM Satellites WHERE constellation = 'Starlink'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicleAdoption (Model VARCHAR(20), Country VARCHAR(10), AdoptionRate FLOAT); | List the electric vehicle models and their adoption rates in the US. | SELECT Model, AdoptionRate FROM ElectricVehicleAdoption WHERE Country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FluShots (ShotID INT, Organization VARCHAR(255), Date DATE); INSERT INTO FluShots (ShotID, Organization, Date) VALUES (1, 'Pharmacy A', '2021-10-01'); | What is the total number of flu shots administered, broken down by the organization that administered them? | SELECT Organization, COUNT(*) FROM FluShots GROUP BY Organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE Chemical_Sales (Product_ID INT, Product_Name VARCHAR(50), Sales INT, Safety_Violation BOOLEAN); INSERT INTO Chemical_Sales (Product_ID, Product_Name, Sales, Safety_Violation) VALUES (1, 'ProductA', 1000, FALSE), (2, 'ProductB', 1200, TRUE), (3, 'ProductC', 1500, FALSE), (4, 'ProductD', 800, FALSE); | Identify the top three chemical products with the highest sales in Q1 2022, excluding those with safety violations. | SELECT Product_Name, Sales FROM (SELECT Product_Name, Sales, RANK() OVER(ORDER BY Sales DESC) as rnk FROM Chemical_Sales WHERE Safety_Violation = FALSE) tmp WHERE rnk <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_competency_training (id INT, community_health_worker_id INT, hours INT, gender VARCHAR(50)); INSERT INTO cultural_competency_training (id, community_health_worker_id, hours, gender) VALUES (1, 1, 10, 'Female'), (2, 1, 5, 'Female'), (3, 2, 8, 'Male'), (4, 3, 12, 'Non-binary'); | What is the average cultural competency training hours for community health workers by gender? | SELECT gender, AVG(hours) as avg_hours FROM cultural_competency_training GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists Projects (id INT, name VARCHAR(50), type VARCHAR(50), budget DECIMAL(10,2)); INSERT INTO Projects (id, name, type, budget) VALUES (1, 'Seawall', 'Resilience', 5000000.00), (2, 'Floodgate', 'Resilience', 3000000.00), (3, 'Bridge', 'Transportation', 8000000.00), (4, 'Highway', 'Transportation',... | What is the maximum budget for all transportation projects in the infrastructure development database? | SELECT MAX(budget) FROM Projects WHERE type = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Platform VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Platform) VALUES (1, 25, 'PC'), (2, 30, 'Console'), (3, 20, 'Mobile'); CREATE TABLE EsportsEvents (EventID INT, PlayerID INT); INSERT INTO EsportsEvents (EventID, PlayerID) VALUES (1, 1), (2, 2), (3, 3); | What is the average age of console players who have participated in esports events, compared to PC players? | SELECT p1.Platform, AVG(p1.Age) as AvgAge FROM Players p1 JOIN EsportsEvents e ON p1.PlayerID = e.PlayerID WHERE p1.Platform IN ('PC', 'Console') GROUP BY p1.Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissionExperiments (id INT, mission VARCHAR(255), num_experiments INT); INSERT INTO SpaceMissionExperiments (id, mission, num_experiments) VALUES (1, 'Apollo 17', 113); INSERT INTO SpaceMissionExperiments (id, mission, num_experiments) VALUES (2, 'Gemini 12', 52); | What is the maximum number of scientific experiments conducted during a single space mission? | SELECT mission, MAX(num_experiments) FROM SpaceMissionExperiments; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (region TEXT, rate REAL); INSERT INTO recycling_rates (region, rate) VALUES ('NA', 0.35), ('EU', 0.50), ('AS', 0.28); | Which regions have recycling rates higher than the global average? | SELECT region FROM recycling_rates WHERE rate > (SELECT AVG(rate) FROM recycling_rates); | gretelai_synthetic_text_to_sql |
CREATE TABLE geothermal_plants (id INT PRIMARY KEY, country VARCHAR(50), name VARCHAR(50), capacity FLOAT); INSERT INTO geothermal_plants (id, country, name, capacity) VALUES (1, 'New Zealand', 'Geothermal Plant A', 60.5), (2, 'New Zealand', 'Geothermal Plant B', 85.2); | What is the maximum capacity of geothermal plants in New Zealand? | SELECT MAX(capacity) FROM geothermal_plants WHERE country = 'New Zealand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicles (vehicle_id INT PRIMARY KEY, license_plate VARCHAR(255), model VARCHAR(255), year INT); INSERT INTO Vehicles (vehicle_id, license_plate, model, year) VALUES (2, 'XYZ123', 'Bus', 2018); CREATE TABLE Maintenance (maintenance_id INT PRIMARY KEY, vehicle_id INT, last_maintenance_date DATE, next_mainte... | What is the next maintenance date for the vehicle with license plate XYZ123? | SELECT m.next_maintenance_date FROM Maintenance m WHERE m.vehicle_id = (SELECT v.vehicle_id FROM Vehicles v WHERE v.license_plate = 'XYZ123'); | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_tech_patents (patent_id INT, patent_number VARCHAR(20), issue_date DATE, patent_type VARCHAR(30), description VARCHAR(100)); | What is the total number of legal technology patents issued by year in the 'legal_tech_patents' table? | SELECT YEAR(issue_date) AS year, COUNT(*) AS patent_count FROM legal_tech_patents GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Streaming (StreamID INT, SongID INT, UserID INT, Location VARCHAR(50), Revenue DECIMAL(10,2), Genre VARCHAR(50), Artist VARCHAR(100)); INSERT INTO Streaming (StreamID, SongID, UserID, Location, Revenue, Genre, Artist) VALUES (5, 5, 5, 'Mexico', 1.29, 'Latin', 'Carlos Santana'); INSERT INTO Streaming (Strea... | Who is the most popular Latin artist based on streaming? | SELECT Artist, COUNT(*) FROM Streaming WHERE Genre = 'Latin' GROUP BY Artist ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, city VARCHAR(20), collections INT); INSERT INTO artists (id, city, collections) VALUES (1, 'London', 2), (2, 'London', 3), (3, 'New York', 1); | How many art collections does each artist have in 'London'? | SELECT city, collections FROM artists WHERE city = 'London'; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (warehouse_id VARCHAR(10), city VARCHAR(20), state VARCHAR(20), country VARCHAR(20)); | Insert records into the warehouse table for a new warehouse with warehouse_id '002', city 'Chicago', state 'IL', and country 'USA' | INSERT INTO warehouse (warehouse_id, city, state, country) VALUES ('002', 'Chicago', 'IL', 'USA'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists pharma; CREATE TABLE if not exists pharma.clinical_trials (drug VARCHAR(255), phase INT, result VARCHAR(255)); INSERT INTO pharma.clinical_trials (drug, phase, result) VALUES ('Drug A', 1, 'Completed'), ('Drug A', 2, 'Failed'), ('Drug B', 3, 'Completed'), ('Drug C', 3, 'Failed'), ('Drug D', ... | Which drugs had the highest clinical trial success rate in phase 3? | SELECT drug, (SUM(CASE WHEN result = 'Completed' THEN 1 ELSE 0 END) / COUNT(*)) * 100.0 AS success_rate FROM pharma.clinical_trials WHERE phase = 3 GROUP BY drug ORDER BY success_rate DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, region VARCHAR(20), contributions DECIMAL(10,2), focus VARCHAR(20)); INSERT INTO donors (donor_id, region, contributions, focus) VALUES (1, 'Africa', 50000.00, 'accessibility'), (2, 'Europe', 100000.00, 'education'), (3, 'North America', 200000.00, 'policy'), (4, 'Africa', 75000.00, '... | Who are the top 3 donors for accessibility-focused social good projects in Africa? | SELECT donor_id, contributions FROM donors WHERE region = 'Africa' AND focus = 'accessibility' ORDER BY contributions DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, join_date DATE); INSERT INTO mobile_subscribers (subscriber_id, join_date) VALUES (1, '2021-01-01'), (2, '2021-02-01'), (3, '2020-12-01'); | List all mobile subscribers who joined after a specific date and their respective joining dates. | SELECT * FROM mobile_subscribers WHERE join_date > '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workouts (id VARCHAR(10), member_id VARCHAR(10), duration INT, date DATE); INSERT INTO workouts (id, member_id, duration, date) VALUES ('001', '001', 60, '2022-01-01'), ('002', '002', 45, '2022-01-02'), ('003', '001', 90, '2022-01-03'); | Delete the workout with ID 003 from the workouts table. | DELETE FROM workouts WHERE id = '003'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (ID INT PRIMARY KEY, PatientID INT, Procedure VARCHAR(20), Cost INT); | What is the total cost of mental health parity procedures performed on a specific date? | SELECT SUM(Cost) as TotalCost FROM MentalHealthParity WHERE Date = '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE riders (rider_id INT, rider_name TEXT); CREATE TABLE trips (trip_id INT, rider_id INT, trip_date DATE, trip_time TIME); | What is the maximum number of trips taken by a single rider in a week? | SELECT r.rider_name, MAX(COUNT(*)) as max_weekly_trips FROM riders r INNER JOIN trips t ON r.rider_id = t.rider_id GROUP BY r.rider_name, DATEPART(week, t.trip_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE BerlinExhibitions (id INT, visitorAge INT); INSERT INTO BerlinExhibitions (id, visitorAge) VALUES (1, 35), (2, 42), (3, 31), (4, 28), (5, 39), (6, 45); | Calculate the median age of visitors who attended exhibitions in Berlin. | SELECT AVG(visitorAge) FROM (SELECT visitorAge FROM BerlinExhibitions t1 WHERE (SELECT COUNT(*) FROM BerlinExhibitions t2 WHERE t2.visitorAge <= t1.visitorAge) > (SELECT COUNT(*) / 2 FROM BerlinExhibitions)) t; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Platform VARCHAR(10));CREATE TABLE ESportsEvents (EventID INT, PlayerID INT); | What is the average age of players who have participated in ESports events, categorized by the platform (PC, Console, Mobile)? | SELECT Platform, AVG(Age) FROM Players p INNER JOIN ESportsEvents e ON p.PlayerID = e.PlayerID GROUP BY Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE grad_students (id INT, name VARCHAR(50), race_ethnicity VARCHAR(50));CREATE TABLE papers (id INT, paper_id INT, title VARCHAR(100), year INT, author_id INT); | What is the number of graduate students from historically marginalized racial and ethnic groups who have published 3 or more academic papers in the last 2 years? | SELECT COUNT(DISTINCT gs.id) FROM grad_students gs JOIN papers p ON gs.id = p.author_id WHERE gs.race_ethnicity IN ('historically_marginalized_1', 'historically_marginalized_2') AND p.year BETWEEN YEAR(CURRENT_DATE) - 2 AND YEAR(CURRENT_DATE) GROUP BY gs.id HAVING COUNT(DISTINCT p.paper_id) >= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_ethics_training (id INT PRIMARY KEY, employee_name VARCHAR(50), training_date DATE); | Insert new records into the "ai_ethics_training" table for new employees from underrepresented communities | INSERT INTO ai_ethics_training (employee_name, training_date) VALUES ('Mohamed Ali', '2023-03-15'), ('Juana Rodriguez', '2023-03-16'), ('Thanh Nguyen', '2023-03-17'), ('Rajesh Patel', '2023-03-18'); | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_data(id INT, member_id INT, workout_type VARCHAR(20), workout_duration INT, country VARCHAR(20)); INSERT INTO workout_data(id, member_id, workout_type, workout_duration, country) VALUES (1, 1, 'Running', 60, 'USA'), (2, 2, 'Cycling', 45, 'Canada'); | Find the unique workout types for members who are older than 40 and from the United States. | SELECT DISTINCT workout_type FROM workout_data WHERE country = 'USA' AND age > 40; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_services (id INT PRIMARY KEY, service VARCHAR(255), location VARCHAR(255), budget DECIMAL(10, 2), provider VARCHAR(255)); | List the total budget allocation for public services in each city, sorted by the total budget in descending order. | SELECT location, SUM(budget) as total_budget FROM public_services GROUP BY location ORDER BY total_budget DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (product_id INT, last_sale_date DATE, ethical_source BOOLEAN); INSERT INTO inventory VALUES (1, '2022-01-01', false), (2, '2022-05-01', false), (3, '2021-12-31', true), (51, '2022-06-15', false); | Update the ethical_source column to true for all products with a last_sale_date within the last month and product_id greater than 50. | UPDATE inventory SET ethical_source = true WHERE last_sale_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND product_id > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_good (id INT, project_name TEXT, budget INT, region TEXT); INSERT INTO social_good (id, project_name, budget, region) VALUES (1, 'Tech4Good Initiative', 50000, 'Africa'), (2, 'SocialTech Program', 75000, 'North America'), (3, 'DigitalDivide Fund', 60000, 'Europe'); CREATE TABLE regions (id INT, regi... | What is the average budget for technology for social good projects in each region? | SELECT r.region, AVG(budget) as avg_budget FROM social_good sg JOIN regions r ON sg.region = r.region GROUP BY r.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (temp FLOAT, time DATETIME, crop VARCHAR(255)); | What is the maximum temperature recorded for each crop type in the past week? | SELECT crop, MAX(temp) FROM WeatherData WHERE time > DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 WEEK) GROUP BY crop; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (program_id INT, social_impact_score DECIMAL(10,2)); INSERT INTO programs (program_id, social_impact_score) VALUES (1, 8.5), (2, 9.0), (3, 7.5); | What is the average social impact score for each program in the programs table? | SELECT AVG(social_impact_score) as avg_social_impact_score, program_id FROM programs GROUP BY program_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID int, Name varchar(50), Country varchar(50)); | Find the top 3 countries with the most volunteers and the total number of volunteers from each. | SELECT Country, COUNT(*) as TotalVolunteers FROM Volunteers GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_production (well_id INT, date DATE, type VARCHAR(10), quantity INT); INSERT INTO daily_production (well_id, date, type, quantity) VALUES (1, '2022-01-01', 'Oil', 100), (1, '2022-01-02', 'Oil', 105), (2, '2022-01-01', 'Gas', 200), (2, '2022-01-02', 'Gas', 205); | Show the daily production quantity per well in the Northern region | SELECT well_id, date, type, quantity FROM daily_production WHERE region = 'Northern'; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, region VARCHAR(20), bookings INT); INSERT INTO virtual_tours (tour_id, region, bookings) VALUES (1, 'North America', 500), (2, 'North America', 600), (3, 'Europe', 400), (4, 'Europe', 300); | What is the number of virtual tours booked in each region? | SELECT region, SUM(bookings) FROM virtual_tours GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE employee_roster (id INT, country VARCHAR(50), employee VARCHAR(50)); INSERT INTO employee_roster (id, country, employee) VALUES (1, 'Canada', 'John Doe'), (2, 'Germany', 'Jane Smith'), (3, 'Canada', 'Jim Brown'); | Find the total number of employees in the manufacturing sector across all countries, excluding any duplicate entries. | SELECT COUNT(DISTINCT employee) FROM employee_roster; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (project_id INT, project_name VARCHAR(100), location VARCHAR(100), energy_type VARCHAR(50), installed_capacity FLOAT); INSERT INTO renewable_energy (project_id, project_name, location, energy_type, installed_capacity) VALUES (1, 'Solar Farm 1', 'Australia', 'Solar', 30.0), (2, 'Wind Farm 1... | How many renewable energy projects are in the 'renewable_energy' table? | SELECT COUNT(*) FROM renewable_energy; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, username VARCHAR(20), region VARCHAR(20));CREATE TABLE transactions (transaction_id INT, user_id INT, amount DECIMAL(10,2), transaction_time TIMESTAMP); | Find users who made a transaction greater than $100 and less than $500? | SELECT user_id FROM transactions WHERE amount > 100 AND amount < 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (country VARCHAR(50), year INT, renewable_energy_share FLOAT); INSERT INTO renewable_energy (country, year, renewable_energy_share) VALUES ('Brazil', 2020, 44.3), ('Argentina', 2020, 9.5), ('Colombia', 2020, 73.4), ('Peru', 2020, 61.7), ('Chile', 2020, 41.7); | What is the renewable energy share in South America in 2020? | SELECT country, AVG(renewable_energy_share) FROM renewable_energy WHERE year = 2020 AND country IN ('Brazil', 'Argentina', 'Colombia', 'Peru', 'Chile') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinics (id INT, name TEXT, location TEXT, ambulances INT, rural BOOLEAN, added DATE); INSERT INTO clinics (id, name, location, ambulances, rural, added) VALUES (1, 'Clinic A', 'Iowa', 5, true, '2019-01-01'), (2, 'Clinic B', 'Iowa', 3, true, '2020-01-01'); | What is the minimum number of ambulances in rural clinics of Iowa that were added in 2020? | SELECT MIN(ambulances) FROM clinics WHERE location = 'Iowa' AND rural = true AND added >= '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (id INT, department VARCHAR(255), year INT, status VARCHAR(255)); INSERT INTO grants (id, department, year, status) VALUES (1, 'Mathematics', 2018, 'approved'), (2, 'Physics', 2019, 'approved'), (3, 'Mathematics', 2020, 'rejected'), (4, 'Computer Science', 2017, 'approved'); | What is the average number of research grants approved per year for the Mathematics department? | SELECT department, AVG(year) as avg_year FROM (SELECT department, YEAR(CURDATE()) - year AS year, status FROM grants WHERE department = 'Mathematics' AND status = 'approved') subquery WHERE status = 'approved' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE savings (account_number INT, customer_rating INT, is_shariah_compliant BOOLEAN, balance DECIMAL(10, 2)); INSERT INTO savings (account_number, customer_rating, is_shariah_compliant, balance) VALUES (1, 5, true, 1500.00), (2, 3, false, 800.00), (3, 4, true, 1200.00), (4, 5, false, 2000.00), (5, 5, true, 2500... | What is the average monthly balance for Shariah-compliant savings accounts with a customer rating above 4? | SELECT AVG(balance) FROM (SELECT account_number, customer_rating, is_shariah_compliant, balance, ROW_NUMBER() OVER (PARTITION BY customer_rating, is_shariah_compliant ORDER BY balance DESC) AS rn FROM savings) tmp WHERE rn = 1 AND customer_rating > 4 AND is_shariah_compliant = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE physician (physician_id INT, name VARCHAR(50), specialty VARCHAR(30)); CREATE TABLE visit (visit_id INT, physician_id INT, rural BOOLEAN); | What is the name of the physician with the most rural patient visits? | SELECT physician.name FROM physician JOIN (SELECT physician_id FROM visit WHERE rural = TRUE GROUP BY physician_id ORDER BY COUNT(*) DESC LIMIT 1) AS subquery ON physician.physician_id = subquery.physician_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE DestinationRatings (DestinationID INT, Destination VARCHAR(50), SustainableRating INT); INSERT INTO DestinationRatings (DestinationID, Destination, SustainableRating) VALUES (1, 'National Park', 5), (2, 'Beach Resort', 3); | Find the top 3 destinations with the highest number of sustainable tourism certifications. | SELECT Destination, SUM(SustainableRating) AS TotalRating FROM DestinationRatings GROUP BY Destination ORDER BY TotalRating DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (MissionID INT, MissionName VARCHAR(255), LaunchDate DATE); INSERT INTO SpaceMissions (MissionID, MissionName, LaunchDate) VALUES (100, 'Apollo 10', '1969-05-18'), (101, 'Apollo 11', '1969-07-16'); | Delete the mission record with the MissionID 100 from the SpaceMissions table. | DELETE FROM SpaceMissions WHERE MissionID = 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(255)); CREATE TABLE games (game_id INT, team_id INT, game_date DATE); CREATE TABLE games_stats (game_id INT, team_id INT, points INT); | What is the highest scoring game for each team, from the teams, games, and games_stats tables? | SELECT t.team_name, MAX(gs.points) AS highest_score FROM games g JOIN teams t ON g.team_id = t.team_id JOIN games_stats gs ON g.game_id = gs.game_id GROUP BY t.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure_Projects (Project_ID INT, Project_Type VARCHAR(255), Resilience_Score FLOAT, Year INT, State VARCHAR(255)); | What is the average resilience score for each type of infrastructure project in Texas for the year 2022? | SELECT Year, Project_Type, AVG(Resilience_Score) FROM Infrastructure_Projects WHERE State = 'Texas' AND Year = 2022 GROUP BY Year, Project_Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_usage (customer_id INT, city VARCHAR(20), data_usage FLOAT); INSERT INTO mobile_usage (customer_id, city, data_usage) VALUES (1, 'Sydney', 12), (2, 'Sydney', 8), (3, 'Melbourne', 15); | What is the percentage of mobile customers in the city of Sydney who have used more than 10GB of data in the past month? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM mobile_usage WHERE city = 'Sydney')) FROM mobile_usage WHERE city = 'Sydney' AND data_usage > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE uk_garment_sales (garment_type VARCHAR(255), geography VARCHAR(255), sales_quantity INT, quarter INT, year INT); INSERT INTO uk_garment_sales (garment_type, geography, sales_quantity, quarter, year) VALUES ('T-Shirt', 'United Kingdom', 1000, 1, 2021), ('Jeans', 'United Kingdom', 1500, 1, 2021), ('Hoodie', ... | How many men's garments were sold in the United Kingdom in Q1 2021? | SELECT SUM(sales_quantity) FROM uk_garment_sales WHERE geography = 'United Kingdom' AND quarter = 1 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE meals (user_id INT, meal_date DATE, calories INT); INSERT INTO meals (user_id, meal_date, calories) VALUES (1, '2022-01-01', 600), (1, '2022-01-02', 800), (2, '2022-01-01', 500); | What is the average calorie intake per meal by users in Canada? | SELECT AVG(calories) FROM (SELECT user_id, meal_date, SUM(calories) OVER (PARTITION BY user_id ORDER BY meal_date) as calories FROM meals) t WHERE t.user_id IN (SELECT user_id FROM users WHERE country = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20), FavoriteGame VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Gender, Country, FavoriteGame) VALUES (1, 22, 'Female', 'India', 'Mobile'); INSERT INTO Players (PlayerID, Age, Gender, Country, FavoriteGame) VALUES (2, 28, 'Male', 'Aust... | Find the top 2 countries with the highest number of female players who prefer Mobile games. | SELECT Country, COUNT(PlayerID) as NumberOfPlayers FROM Players WHERE Gender = 'Female' AND FavoriteGame = 'Mobile' GROUP BY Country ORDER BY NumberOfPlayers DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthClinics (ClinicID INT, Location VARCHAR(50), Type VARCHAR(20)); CREATE TABLE DisadvantagedNeighborhoods (NeighborhoodID INT, Location VARCHAR(50)); INSERT INTO MentalHealthClinics (ClinicID, Location, Type) VALUES (1, '123 Main St', 'Psychiatric'); INSERT INTO DisadvantagedNeighborhoods (Neighb... | List all mental health clinics located in disadvantaged neighborhoods? | SELECT MentalHealthClinics.Location FROM MentalHealthClinics INNER JOIN DisadvantagedNeighborhoods ON MentalHealthClinics.Location = DisadvantagedNeighborhoods.Location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, location VARCHAR(20), entry_fee INT); INSERT INTO Exhibitions (exhibition_id, location, entry_fee) VALUES (1, 'Beijing', 12), (2, 'Beijing', 20), (3, 'Beijing', 30); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT); INSERT INTO Visitors (visitor_id, exhibition_id) V... | What is the total entry fee collected in Beijing for exhibitions with an entry fee above 10? | SELECT SUM(entry_fee) FROM Exhibitions WHERE location = 'Beijing' AND entry_fee > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_projects (id INT, project_name TEXT, budget INT);INSERT INTO transportation_projects (id, project_name, budget) VALUES (1, 'ProjectA', 8000000), (2, 'ProjectB', 5000000), (3, 'ProjectC', 10000000); | What is the maximum budget allocated for any project in the transportation projects table? | SELECT MAX(budget) FROM transportation_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (id INT, fish_id INT, record_date DATE, water_temp DECIMAL(5,2)); INSERT INTO temperature_data (id, fish_id, record_date, water_temp) VALUES (1, 1, '2022-03-01', 27.5), (2, 1, '2022-03-15', 28.2), (3, 2, '2022-03-01', 8.3), (4, 2, '2022-03-15', 8.9); | Update the water temperature for record ID 3 to 9.0 degrees. | UPDATE temperature_data SET water_temp = 9.0 WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (year INT, area_size FLOAT); INSERT INTO marine_protected_areas (year, area_size) VALUES (2010, 25000), (2011, 30000), (2012, 20000), (2013, 35000), (2014, 15000), (2015, 40000); | What was the maximum marine protected area size created each year? | SELECT year, MAX(area_size) OVER(PARTITION BY (year - MOD(year, 5))) as max_area_per_5_years FROM marine_protected_areas; | gretelai_synthetic_text_to_sql |
CREATE TABLE installations (exhibition_id INT, installation_type VARCHAR(10)); INSERT INTO installations (exhibition_id, installation_type) VALUES (1, 'Interactive'), (1, 'Projection'); | How many digital interactive installations were available for each exhibition category? | SELECT exhibition_category, COUNT(DISTINCT exhibition_id) AS num_interactive_installations FROM installations JOIN exhibitions ON installations.exhibition_id = exhibitions.id GROUP BY exhibition_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturers (manufacturer_id INT, manufacturer_name TEXT); CREATE TABLE labor_reports (report_id INT, manufacturer_id INT, violation_count INT); INSERT INTO manufacturers (manufacturer_id, manufacturer_name) VALUES (1, 'Ethical Clothing'), (2, 'Fast Fashion Inc.'); INSERT INTO labor_reports (report_id, m... | How many labor violations have been reported for each manufacturer? | SELECT manufacturer_id, SUM(violation_count) FROM labor_reports GROUP BY manufacturer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE sector_incidents (id INT, incident_type VARCHAR(255), sector VARCHAR(255), incident_date DATE, affected_assets INT); INSERT INTO sector_incidents (id, incident_type, sector, incident_date, affected_assets) VALUES (1, 'Ransomware', 'Transportation', '2022-01-01', 50); | What is the total number of cybersecurity incidents and their types that have occurred in the transportation sector in the past year? | SELECT incident_type, COUNT(*) as total_occurrences FROM sector_incidents WHERE sector = 'Transportation' AND incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY incident_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE Measurement (id INT, farm_id INT, dissolved_oxygen FLOAT, timestamp TIMESTAMP); | Find the top 3 countries with the highest average dissolved oxygen levels in their aquaculture farms. | SELECT f.country, AVG(m.dissolved_oxygen) FROM Farm f JOIN Measurement m ON f.id = m.farm_id GROUP BY f.country ORDER BY AVG(m.dissolved_oxygen) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_creators (id INT, name TEXT, country TEXT, media_literacy_score INT); INSERT INTO content_creators (id, name, country, media_literacy_score) VALUES (1, 'Alice', 'Brazil', 90), (2, 'Bob', 'Argentina', 95); | Who are the top 5 content creators with the highest media literacy scores in Latin American countries? | SELECT name, media_literacy_score FROM content_creators WHERE country IN ('Brazil', 'Argentina', 'Colombia', 'Chile', 'Mexico') ORDER BY media_literacy_score DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_providers_income (income_area VARCHAR(20), provider_count INT); INSERT INTO healthcare_providers_income (income_area, provider_count) VALUES ('Low-income', 500), ('High-income', 200); | How many healthcare providers are there in low-income and high-income areas? | SELECT income_area, provider_count, NTILE(4) OVER (ORDER BY provider_count) AS tier FROM healthcare_providers_income; | gretelai_synthetic_text_to_sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.