context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE clients (client_id INT, name TEXT); CREATE TABLE shariah_compliant_funds (fund_id INT, client_id INT, investment_amount INT); INSERT INTO clients (client_id, name) VALUES (1, 'John Doe'), (2, 'Jane Doe'); INSERT INTO shariah_compliant_funds (fund_id, client_id, investment_amount) VALUES (1, 1, 5000), (2, 1... | List all the clients who have invested in Shariah-compliant funds and their total investment amount. | SELECT clients.name, SUM(shariah_compliant_funds.investment_amount) FROM clients JOIN shariah_compliant_funds ON clients.client_id = shariah_compliant_funds.client_id GROUP BY clients.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_emergencies (donation_id INT, donor VARCHAR(50), amount DECIMAL(10,2), donation_date DATE); INSERT INTO global_emergencies (donation_id, donor, amount, donation_date) VALUES (1, 'Irene White', 75.00, '2021-01-01'), (2, 'James Brown', 100.00, '2021-02-10'); | List all donations made before '2021-02-15' in the 'global_emergencies' table. | SELECT * FROM global_emergencies WHERE donation_date < '2021-02-15'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), sport VARCHAR(20), salary INT, country VARCHAR(50)); | What is the average salary of baseball players from the US? | SELECT AVG(salary) FROM players WHERE sport = 'Baseball' AND country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, name VARCHAR(50), state VARCHAR(2), score INT); | What is the average cultural competency score for community health workers in each state? | SELECT state, AVG(score) FROM community_health_workers GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_materials (id INT, country VARCHAR(50), material VARCHAR(50), quantity INT); INSERT INTO sustainable_materials (id, country, material, quantity) VALUES (1, 'Brazil', 'Organic Cotton', 2000), (2, 'Argentina', 'Hemp', 1500), (3, 'Colombia', 'Tencel', 2500); | List the total quantity of sustainable materials used in garment production in Latin America. | SELECT country, SUM(quantity) as total_quantity FROM sustainable_materials WHERE country IN ('Brazil', 'Argentina', 'Colombia') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visits (ID INT, VesselID INT, VisitDate DATE); CREATE TABLE Vessels (ID INT, Name TEXT, Tonnage INT, Region TEXT); INSERT INTO Visits (ID, VesselID, VisitDate) VALUES (1, 1, '2022-01-01'), (2, 1, '2022-02-01'), (3, 2, '2022-01-01'); INSERT INTO Vessels (ID, Name, Tonnage, Region) VALUES (1, 'Vessel 1', 100... | What is the total tonnage of all vessels that have visited the 'Caribbean' region in the last 6 months? | SELECT SUM(Vessels.Tonnage) FROM Visits INNER JOIN Vessels ON Visits.VesselID = Vessels.ID WHERE VisitDate >= DATEADD(month, -6, GETDATE()) AND Vessels.Region = 'Caribbean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousDriving (Id INT, Location VARCHAR(255), Data VARCHAR(255)); INSERT INTO AutonomousDriving (Id, Location, Data) VALUES (1, 'USA', 'Data 1'), (2, 'Germany', 'Data 2'), (3, 'USA', 'Data 3'); | List all autonomous driving research data from Germany. | SELECT * FROM AutonomousDriving WHERE Location = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, JoinDate DATE, Region VARCHAR(50)); | What is the percentage of volunteers that joined in each region compared to the total number of volunteers? | SELECT v.Region, ROUND(COUNT(*) / (SELECT COUNT(*) FROM Volunteers) * 100, 2) as Percentage FROM Volunteers v GROUP BY v.Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, network_provider VARCHAR(50)); CREATE TABLE broadband_subscribers (subscriber_id INT, network_provider VARCHAR(50)); | What is the total number of mobile and broadband subscribers for a specific network provider? | SELECT 'Mobile' AS service, COUNT(DISTINCT subscriber_id) FROM mobile_subscribers WHERE network_provider = 'XYZ' UNION ALL SELECT 'Broadband', COUNT(DISTINCT subscriber_id) FROM broadband_subscribers WHERE network_provider = 'XYZ'; | gretelai_synthetic_text_to_sql |
CREATE TABLE XAI_Germany (id INT, technique TEXT, location TEXT); INSERT INTO XAI_Germany (id, technique, location) VALUES (1, 'SHAP', 'Germany'), (2, ' anchors', 'Germany'), (3, 'TreeExplainer', 'France'), (4, 'LIME', 'USA'); | Which explainable AI techniques were developed in Germany? | SELECT technique FROM XAI_Germany WHERE location = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (id INT, project_name VARCHAR(255), sector VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO rural_infrastructure (id, project_name, sector, location, start_date, end_date) VALUES (1, 'Rural Road Project', 'Infrastructure', 'Village C, Country M', '2022-... | List all completed rural infrastructure projects in 2022 for Country M? | SELECT * FROM rural_infrastructure WHERE location LIKE '%Country M%' AND YEAR(end_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_budget (country VARCHAR(50), initiative VARCHAR(50), budget INT); INSERT INTO conservation_budget (country, initiative, budget) VALUES ('USA', 'Project A', 500000), ('Canada', 'Project B', 600000), ('Mexico', 'Project C', 400000), ('Brazil', 'Project D', 700000); | What is the maximum water conservation initiative budget by country? | SELECT cb.country, MAX(cb.budget) as max_budget FROM conservation_budget cb GROUP BY cb.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2 (co2_id INT, supplier_id INT, co2_emissions INT, co2_emission_date DATE); INSERT INTO co2 (co2_id, supplier_id, co2_emissions, co2_emission_date) VALUES (1, 1, 1000, '2022-01-01'), (2, 1, 2000, '2022-02-01'); | What is the total CO2 emissions for each supplier, partitioned by year and ordered by total CO2 emissions? | SELECT supplier_id, DATE_TRUNC('year', co2_emission_date) AS year, SUM(co2_emissions) AS total_co2_emissions, RANK() OVER (ORDER BY SUM(co2_emissions) DESC) AS ranking FROM co2 GROUP BY supplier_id, year ORDER BY total_co2_emissions DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects_Timeline (Project_ID INT, Start_Date DATE, Completion_Date DATE); INSERT INTO Projects_Timeline (Project_ID, Start_Date, Completion_Date) VALUES (1, '2019-01-01', '2020-06-30'), (2, '2018-05-01', '2019-12-31'), (3, '2020-07-01', '2021-01-31'), (4, '2017-09-01', '2018-08-31'); | How many transportation projects were completed in the year 2020? | SELECT COUNT(*) FROM Projects_Timeline WHERE YEAR(Start_Date) <= 2020 AND YEAR(Completion_Date) >= 2020 AND Project_Type = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GeopoliticalRiskAssessments (assessmentID INT, contractor VARCHAR(255), region VARCHAR(255)); INSERT INTO GeopoliticalRiskAssessments (assessmentID, contractor, region) VALUES (1, 'Boeing', 'South China Sea'); INSERT INTO GeopoliticalRiskAssessments (assessmentID, contractor, region) VALUES (2, 'Northrop G... | Who are the defense contractors involved in the South China Sea geopolitical risk assessment? | SELECT DISTINCT contractor FROM GeopoliticalRiskAssessments WHERE region = 'South China Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (id INT, patent VARCHAR(50), country VARCHAR(50)); CREATE TABLE defense_diplomacy (id INT, country VARCHAR(50), rank INT); INSERT INTO military_innovation (id, patent, country) VALUES (1, 'Stealth technology', 'United States'), (2, 'Artificial Intelligence', 'China'), (3, 'Cybersecurity... | Identify military innovation patents filed by the top 3 countries in defense diplomacy. | SELECT military_innovation.country, COUNT(military_innovation.patent) as patent_count FROM military_innovation INNER JOIN defense_diplomacy ON military_innovation.country = defense_diplomacy.country GROUP BY military_innovation.country ORDER BY patent_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE plants (id INT, name TEXT, location TEXT, num_employees INT, safety_score FLOAT, quarter INT, year INT); INSERT INTO plants (id, name, location, num_employees, safety_score, quarter, year) VALUES (1, 'PlantA', 'US', 150, 88.5, 2, 2021), (2, 'PlantB', 'CA', 80, 92.3, 2, 2021), (3, 'PlantC', 'US', 250, 85.6,... | What is the average safety score for chemical manufacturing plants in the US, with at least 100 employees, in Q2 2021? | SELECT AVG(safety_score) FROM plants WHERE location = 'US' AND num_employees >= 100 AND quarter = 2 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists smart_contracts (id INT PRIMARY KEY, name TEXT, language TEXT, version TEXT); INSERT INTO smart_contracts (id, name, language, version) VALUES (1, 'CryptoKitties', 'Solidity', '0.4.24'); INSERT INTO smart_contracts (id, name, language, version) VALUES (2, 'Uniswap', 'Vyper', '0.2.6'); | Get smart contracts written in Vyper with version greater than 0.2.8. | SELECT * FROM smart_contracts WHERE language = 'Vyper' AND version > '0.2.8'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name VARCHAR(255), location VARCHAR(255), fair_labor_practices BOOLEAN);INSERT INTO factories (factory_id, name, location, fair_labor_practices) VALUES (1, 'Asian Textiles', 'Asia', false), (2, 'Eastern Fashions', 'Asia', true), (3, 'Pacific Producers', 'Asia', true); | List all factories in Asian countries that have not implemented fair labor practices by the end of 2021. | SELECT name, location FROM factories WHERE location = 'Asia' AND fair_labor_practices = false; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.startups (id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(255), total_funding FLOAT, research_area VARCHAR(255)); INSERT INTO biotech.startups (id, name, country, total_funding, research_area) VALUES (1, 'Genetech Kenya', 'Kenya', 2500000, '... | What is the total funding received by biotech startups in Kenya working on genetic research? | SELECT SUM(total_funding) FROM biotech.startups WHERE country = 'Kenya' AND research_area = 'Genetic Research'; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations_provided (region VARCHAR(20), accommodations INT, employees INT); INSERT INTO accommodations_provided (region, accommodations, employees) VALUES ('Northeast', 20, 100); INSERT INTO accommodations_provided (region, accommodations, employees) VALUES ('Northeast', 25, 150); | What is the average number of disability accommodations provided per employee in the Northeast region? | SELECT region, AVG(accommodations/employees) FROM accommodations_provided WHERE region = 'Northeast'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AthleteWellbeing (ScoreID INT, AthleteID INT, GameID INT, WellbeingScore INT); INSERT INTO AthleteWellbeing VALUES (1, 1, 1, 80), (2, 1, 2, 85), (3, 2, 1, 90), (4, 2, 2, 95), (5, 3, 1, 70), (6, 3, 2, 75); | What is the difference in athlete wellbeing scores between the first and last game for each athlete? | SELECT AthleteID, FIRST_VALUE(WellbeingScore) OVER (PARTITION BY AthleteID ORDER BY GameID) as FirstGameWellbeingScore, LAST_VALUE(WellbeingScore) OVER (PARTITION BY AthleteID ORDER BY GameID ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as LastGameWellbeingScore, LAST_VALUE(WellbeingScore) OVER (PARTITION ... | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS teams (id INT, name VARCHAR(50), league VARCHAR(50)); CREATE TABLE IF NOT EXISTS games (id INT, team_1_id INT, team_2_id INT, location VARCHAR(50), date DATE); CREATE TABLE IF NOT EXISTS sales (id INT, game_id INT, city VARCHAR(50), tickets_sold INT); | List the top 5 cities with the most ticket sales for the 2022 World Series. | SELECT city, SUM(tickets_sold) AS total_sales FROM sales JOIN games ON sales.game_id = games.id JOIN teams ON games.team_1_id = teams.id OR games.team_2_id = teams.id WHERE teams.name IN ('Red Sox', 'Astros') AND date BETWEEN '2022-10-01' AND '2022-10-31' GROUP BY city ORDER BY total_sales DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, vendor_name VARCHAR(255), contract_date DATE); | Find defense contractors who received contracts in both the current year and the previous year | SELECT vendor_name FROM defense_contracts WHERE YEAR(contract_date) IN (YEAR(CURRENT_DATE), YEAR(DATEADD(year, -1, CURRENT_DATE))) GROUP BY vendor_name HAVING COUNT(DISTINCT YEAR(contract_date)) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (name VARCHAR(255), city VARCHAR(255), salary DECIMAL(10,2), government BOOLEAN); INSERT INTO employees (name, city, salary, government) VALUES ('John Doe', 'Washington DC', 80000.00, TRUE), ('Jane Smith', 'Washington DC', 90000.00, TRUE); | What is the average salary of government employees in Washington DC, and how many of them are there? | SELECT AVG(salary) FROM employees WHERE city = 'Washington DC' AND government = TRUE; SELECT COUNT(*) FROM employees WHERE city = 'Washington DC' AND government = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT PRIMARY KEY, donor_id INT, organization_id INT, donation_date DATE, donation_amount DECIMAL(10,2)); INSERT INTO donations (id, donor_id, organization_id, donation_date, donation_amount) VALUES (1, 1, 1, '2021-01-01', 500.00); INSERT INTO donations (id, donor_id, organization_id, donation_... | Who are the top 3 cities with the highest average donation amount in the Climate Change focus area? | SELECT d.city, AVG(d.donation_amount) as avg_donation FROM donations d JOIN organizations o ON d.organization_id = o.id WHERE o.cause = 'Climate Change' GROUP BY d.city ORDER BY avg_donation DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor_deployment (id INT, sensor_type VARCHAR(255), year INT, quantity INT); | List the number of IoT sensors of each type that were installed in each year in the 'sensor_deployment' table. | SELECT sensor_type, year, SUM(quantity) as total_quantity FROM sensor_deployment GROUP BY sensor_type, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_personnel (id INT, name TEXT, rank TEXT, region TEXT); INSERT INTO military_personnel (id, name, rank, region) VALUES (1, 'Jacques Leclerc', 'Colonel', 'Europe'), (2, 'Sofia Müller', 'General', 'Europe'), (3, 'Roberto Rossi', 'Captain', 'Europe'); | Calculate the total number of military personnel in Europe | SELECT COUNT(*) FROM military_personnel WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier_items (id INT, supplier_id INT, item_id INT, price DECIMAL(5,2)); INSERT INTO supplier_items (id, supplier_id, item_id, price) VALUES (1, 1, 1, 50.99), (2, 1, 2, 45.99), (3, 2, 3, 39.99), (4, 3, 4, 60.99), (5, 3, 5, 65.99), (6, 4, 6, 49.99); CREATE TABLE suppliers (id INT, name VARCHAR(50), countr... | Who are the top 3 suppliers by average item price? | SELECT suppliers.name, AVG(supplier_items.price) AS avg_price FROM supplier_items INNER JOIN suppliers ON supplier_items.supplier_id = suppliers.id GROUP BY suppliers.id ORDER BY avg_price DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Department VARCHAR(50), Salary FLOAT); INSERT INTO Employees (EmployeeID, Name, Department, Salary) VALUES (1, 'John Doe', 'IT', 75000.00), (2, 'Jane Smith', 'IT', 80000.00), (3, 'Mike Johnson', 'HR', 60000.00); | What is the difference in average salary between the IT and HR departments? | SELECT (AVG(CASE WHEN Department = 'IT' THEN Salary ELSE NULL END) - AVG(CASE WHEN Department = 'HR' THEN Salary ELSE NULL END)) AS salary_difference; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, name VARCHAR(50), city VARCHAR(50), country VARCHAR(50), certification VARCHAR(50)); INSERT INTO green_buildings (id, name, city, country, certification) VALUES (1, 'EcoTowers', 'Toronto', 'Canada', 'BREEAM Excellent'); CREATE TABLE renewable_energy (id INT, project_name VARCHAR(50... | List the initiatives, cities, and capacities for renewable energy projects related to hydropower energy in countries with BREEAM certified buildings. | SELECT r.project_name, r.city, r.capacity FROM green_buildings g INNER JOIN renewable_energy r ON g.country = r.country WHERE g.certification = 'BREEAM Excellent' AND r.energy_type = 'Hydropower'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, state TEXT); INSERT INTO patients (id, state) VALUES (1, 'California'); INSERT INTO patients (id, state) VALUES (2, 'New York'); INSERT INTO patients (id, state) VALUES (3, 'Florida'); | What is the total number of patients in each state? | SELECT state, COUNT(*) FROM patients GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_item(menu_item VARCHAR(50), price INT, cuisine VARCHAR(50)); INSERT INTO menu_item VALUES ('Burger', 10, 'American'), ('Pizza', 12, 'Italian'), ('Salad', 8, 'European'), ('Tacos', 10, 'Mexican'); | What is the average price of menu items by cuisine? | SELECT cuisine, AVG(price) AS avg_price FROM menu_item GROUP BY cuisine; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA StateData; CREATE TABLE StateServices (Service varchar(255), Type varchar(255)); INSERT INTO StateServices (Service, Type) VALUES ('Police', 'Safety'), ('Fire', 'Safety'), ('Transportation', 'Infrastructure'); | Update the names of the services 'Police' and 'Fire' to 'Public Safety - Police' and 'Public Safety - Fire' in the 'StateData' schema's 'StateServices' table. | UPDATE StateData.StateServices SET Service = CASE Service WHEN 'Police' THEN 'Public Safety - Police' WHEN 'Fire' THEN 'Public Safety - Fire' ELSE Service END; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, gender TEXT, treatment TEXT, state TEXT); INSERT INTO patients (patient_id, age, gender, treatment, state) VALUES (1, 30, 'Female', 'CBT', 'Texas'); INSERT INTO patients (patient_id, age, gender, treatment, state) VALUES (2, 45, 'Male', 'DBT', 'California'); INSERT INTO p... | What is the maximum age of patients who received therapy in Canada? | SELECT MAX(age) FROM patients WHERE treatment = 'Therapy' AND state = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmergencyCalls (call_id INT, call_type VARCHAR(10)); INSERT INTO EmergencyCalls VALUES (1, 'Fire'), (2, 'Medical'), (3, 'Fire'), (4, 'Medical'); | What is the total number of emergency calls in both 'Fire' and 'Medical' categories? | SELECT call_type, COUNT(*) FROM EmergencyCalls WHERE call_type IN ('Fire', 'Medical') GROUP BY call_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (id INT, farm_id INT, date DATE, temperature FLOAT, humidity FLOAT); INSERT INTO weather_data (id, farm_id, date, temperature, humidity) VALUES (1, 1, '2018-01-01', -6.0, 80.0); INSERT INTO weather_data (id, farm_id, date, temperature, humidity) VALUES (2, 1, '2018-01-02', -1.0, 75.0); | Delete any weather records where temperature is below -5 degrees Celsius. | DELETE FROM weather_data WHERE temperature < -5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (UserID INT, UserName VARCHAR(100), Country VARCHAR(50)); INSERT INTO Users (UserID, UserName, Country) VALUES (1, 'JamesBond', 'USA'), (2, 'SpyCatcher', 'Canada'); CREATE TABLE Transactions (TransactionID INT, UserID INT, TransactionValue DECIMAL(10, 2)); INSERT INTO Transactions (TransactionID, Use... | What is the average transaction value for users from the United States? | SELECT AVG(TransactionValue) FROM Transactions INNER JOIN Users ON Transactions.UserID = Users.UserID WHERE Users.Country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(50), email VARCHAR(50)); | Delete a graduate student record from the "students" table | WITH deleted_student AS (DELETE FROM students WHERE id = 1 RETURNING *) SELECT * FROM deleted_student; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, diet TEXT); CREATE TABLE meals (id INT, customer_id INT, date DATE, calories INT); INSERT INTO customers (id, diet) VALUES (1, 'paleo'), (2, 'non-paleo'), (3, 'paleo'); INSERT INTO meals (id, customer_id, date, calories) VALUES (1, 1, '2022-01-01', 1500), (2, 1, '2022-01-02', 1800), (3, ... | What is the daily calorie intake distribution for customers following the paleo diet? | SELECT customer_id, date_trunc('day', date) AS date, AVG(calories) FROM meals JOIN customers ON meals.customer_id = customers.id WHERE customers.diet = 'paleo' GROUP BY date, customer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name VARCHAR(50), region VARCHAR(50), water_temperature DECIMAL(5,2)); INSERT INTO marine_species (id, name, region, water_temperature) VALUES (1, 'Clownfish', 'Pacific Ocean', 28.00), (2, 'Sea Otter', 'Pacific Ocean', 10.00); | What are the maximum and minimum water temperatures for marine species in the Pacific Ocean? | SELECT MIN(marine_species.water_temperature) AS "Minimum Water Temperature", MAX(marine_species.water_temperature) AS "Maximum Water Temperature" FROM marine_species WHERE marine_species.region = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists gcc_financial_assets (id INT, institution_name VARCHAR(100), country VARCHAR(50), is_shariah_compliant BOOLEAN, assets DECIMAL(15,2)); | Find the total financial assets of Shariah-compliant institutions in Gulf Cooperation Council countries? | SELECT SUM(assets) FROM gcc_financial_assets WHERE country IN ('Saudi Arabia', 'Kuwait', 'Bahrain', 'United Arab Emirates', 'Oman', 'Qatar') AND is_shariah_compliant = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE EV_Adoption (id INT, country VARCHAR(50), adoption_rate FLOAT); | What is the adoption rate of electric vehicles in the world? | SELECT SUM(adoption_rate) FROM EV_Adoption; | gretelai_synthetic_text_to_sql |
CREATE TABLE org_sector_3 (id INT, org VARCHAR(100), sector VARCHAR(50), ESG_score FLOAT); INSERT INTO org_sector_3 (id, org, sector, ESG_score) VALUES (1, 'Microsoft', 'Technology', 85.0), (2, 'Google', 'Technology', 87.5), (3, 'Tesla', 'Consumer Discretionary', 82.5), (4, 'Siemens', 'Industrials', 80.0), (5, 'Rolls-R... | Identify the number of organizations in each sector that have ESG scores above 80. | SELECT sector, COUNT(*) as num_orgs FROM org_sector_3 WHERE ESG_score > 80 GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_bed_capacity (id INT PRIMARY KEY, hospital_name VARCHAR(255), region VARCHAR(255), total_beds INT); CREATE TABLE healthcare_workers (id INT PRIMARY KEY, worker_name VARCHAR(255), hospital_id INT, position VARCHAR(255), years_of_experience INT); | Create a view for displaying hospital bed capacity and associated healthcare workers | CREATE VIEW hospital_worker_capacity AS SELECT h.hospital_name, h.region, h.total_beds, w.worker_name, w.position, w.years_of_experience FROM hospital_bed_capacity h JOIN healthcare_workers w ON h.id = w.hospital_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE river_flow_rates (id INT, basin VARCHAR(255), rate_liters_per_sec INT, month INT); INSERT INTO river_flow_rates (id, basin, rate_liters_per_sec, month) VALUES (1, 'Amazon', 120000, 6), (2, 'Amazon', 130000, 7), (3, 'Amazon', 110000, 8); | What is the minimum water flow rate (in liters per second) in the rivers of the Amazon basin in the month of June? | SELECT MIN(rate_liters_per_sec) FROM river_flow_rates WHERE basin = 'Amazon' AND month = 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE salesperson (salesperson_id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO salesperson VALUES (1, 'John Doe', 'East Coast'); INSERT INTO salesperson VALUES (2, 'Jane Smith', 'West Coast'); CREATE TABLE military_equipment_sales (sale_id INT, salesperson_id INT, equipment_type VARCHAR(50), quantity ... | What is the total revenue generated from military equipment sales in each region, ranked by highest revenue? | SELECT s.region, SUM(mES.sale_price * mES.quantity) as total_revenue FROM military_equipment_sales mES JOIN salesperson s ON mES.salesperson_id = s.salesperson_id GROUP BY s.region ORDER BY total_revenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ConstructionLabor (LaborID INT PRIMARY KEY, ProjectID INT, Hours INT, HourlyWage DECIMAL(5,2)); INSERT INTO ConstructionLabor (LaborID, ProjectID, Hours, HourlyWage) VALUES (1, 1, 50, 50.00); | What is the total labor cost for each project? | SELECT ProjectID, SUM(Hours * HourlyWage) as TotalLaborCost FROM ConstructionLabor GROUP BY ProjectID; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety (id INT, country VARCHAR, sentiment FLOAT); | What is the average sentiment score for each country in the AI safety dataset? | SELECT country, AVG(sentiment) OVER (PARTITION BY country) FROM ai_safety; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT); INSERT INTO donors (donor_id, donor_name) VALUES (1, 'John Doe'), (2, 'Jane Smith'), (3, 'Alice Johnson'); | how_many_donors | SELECT COUNT(*) FROM donors; | gretelai_synthetic_text_to_sql |
CREATE TABLE indigenous_food_systems (id INT, name TEXT, total_funding FLOAT, region TEXT); INSERT INTO indigenous_food_systems (id, name, total_funding, region) VALUES (1, 'System 1', 50000.0, 'Africa'), (2, 'System 2', 30000.0, 'Africa'), (3, 'System 3', 70000.0, 'Africa'); | Which indigenous food systems have the highest and lowest total funding in Africa? | SELECT name, total_funding FROM (SELECT name, total_funding, ROW_NUMBER() OVER (ORDER BY total_funding DESC) as rank FROM indigenous_food_systems WHERE region = 'Africa') as ranked_systems WHERE rank = 1 OR rank = (SELECT COUNT(*) FROM indigenous_food_systems WHERE region = 'Africa') ORDER BY total_funding; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousElectricVehicleSales (id INT, sale_date DATE, make VARCHAR(20), model VARCHAR(20), is_electric BOOLEAN, autonomy_level INT); INSERT INTO AutonomousElectricVehicleSales (id, sale_date, make, model, is_electric, autonomy_level) VALUES (1, '2022-01-01', 'Tesla', 'Model S', true, 4), (2, '2022-01-01'... | What is the market share of electric vehicles, partitioned by autonomous driving capability, per month? | SELECT EXTRACT(MONTH FROM sale_date) AS month, autonomy_level, make, COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (PARTITION BY EXTRACT(MONTH FROM sale_date)) AS pct_market_share FROM AutonomousElectricVehicleSales WHERE is_electric = true GROUP BY month, autonomy_level, make; | gretelai_synthetic_text_to_sql |
CREATE TABLE Daily_Water_Consumption (city VARCHAR(20), water_consumption FLOAT, date DATE); INSERT INTO Daily_Water_Consumption (city, water_consumption, date) VALUES ('Chicago', 1500000, '2022-01-01'), ('Los Angeles', 2000000, '2022-01-02'), ('Chicago', 1700000, '2022-01-03'), ('New York', 1600000, '2022-01-04'); | What is the maximum water consumption in a single day for the city of Chicago? | SELECT city, MAX(water_consumption) FROM Daily_Water_Consumption WHERE city = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (policyholder_id INT, claim_amount DECIMAL(10,2), state VARCHAR(2)); INSERT INTO claims (policyholder_id, claim_amount, state) VALUES (1, 500, 'IL'), (2, 200, 'IL'), (3, 800, 'IL'); | Show total claim amounts and policyholder id for policyholders in Illinois | SELECT policyholder_id, SUM(claim_amount) FROM claims WHERE state = 'IL' GROUP BY policyholder_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityPrograms (id INT, name VARCHAR(255), country VARCHAR(255), UNIQUE (id)); CREATE TABLE Events (id INT, name VARCHAR(255), community_program_id INT, year INT, UNIQUE (id), FOREIGN KEY (community_program_id) REFERENCES CommunityPrograms(id)); CREATE TABLE Attendance (id INT, event_id INT, attendees I... | What are the names of community engagement programs in Nigeria with more than 2 events in the last year and an average attendance greater than 30? | SELECT cp.name FROM CommunityPrograms cp JOIN Events e ON cp.id = e.community_program_id JOIN Attendance a ON e.id = a.event_id WHERE cp.country = 'Nigeria' GROUP BY cp.name HAVING COUNT(DISTINCT e.id) > 2 AND AVG(a.attendees) > 30 AND e.year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, Amount FLOAT, DonationDate DATE); INSERT INTO Donations (DonationID, DonorID, Amount, DonationDate) VALUES (1, 1, 500.00, '2021-01-01'), (2, 2, 800.00, '2021-02-01'); | Insert a new record for a donation of $300 made by 'David' on '2022-03-15'. | INSERT INTO Donations (DonationID, DonorID, Amount, DonationDate) VALUES (3, (SELECT DonorID FROM Donors WHERE Name = 'David'), 300.00, '2022-03-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_vehicles_by_type_2 (id INT PRIMARY KEY, city VARCHAR(255), type VARCHAR(255), num_vehicles INT); | Find the number of electric vehicles in each city, for sedans and SUVs | CREATE VIEW electric_vehicles_by_type_city_2 AS SELECT city, type, COUNT(*) as num_vehicles FROM electric_vehicles WHERE type IN ('Sedan', 'SUV') GROUP BY city, type; SELECT * FROM electric_vehicles_by_type_city_2; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, max_depth INTEGER); INSERT INTO marine_protected_areas (area_name, max_depth) VALUES ('Sargasso Sea', 7000), ('Java Trench', 8000), ('Mariana Trench', 10000), ('Tonga Trench', 10600), ('Molucca Deep', 9100); | What is the average depth of the top 3 deepest marine protected areas? | SELECT AVG(max_depth) FROM (SELECT max_depth FROM marine_protected_areas ORDER BY max_depth DESC LIMIT 3) AS top_3_deepest; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT PRIMARY KEY, name VARCHAR(255), num_trucks INT); | Add a new warehouse 'XYZ' with 3 delivery trucks | INSERT INTO warehouse (id, name, num_trucks) VALUES ((SELECT COALESCE(MAX(id), 0) + 1 FROM warehouse), 'XYZ', 3); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name VARCHAR(50), Atlantic BOOLEAN, Indian BOOLEAN, Arctic BOOLEAN); INSERT INTO marine_species (id, name, Atlantic, Indian, Arctic) VALUES (1, 'Species1', TRUE, TRUE, FALSE), (2, 'Species2', TRUE, FALSE, TRUE), (3, 'Species3', FALSE, TRUE, FALSE); | List the names of marine species that are found in either the Atlantic or Indian oceans, but not in both? | SELECT name FROM marine_species WHERE Atlantic = TRUE AND Indian = FALSE UNION SELECT name FROM marine_species WHERE Atlantic = FALSE AND Indian = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities.buildings (id INT, city VARCHAR(255), co2_emissions INT, reduction_percentage DECIMAL(5,2)); CREATE VIEW smart_cities.buildings_view AS SELECT id, city, co2_emissions, reduction_percentage FROM smart_cities.buildings; | Increase the CO2 emissions reduction percentage for buildings in the city of 'San Francisco' by 2% if the current reduction is less than 15%. | UPDATE smart_cities.buildings SET reduction_percentage = reduction_percentage + 2 FROM smart_cities.buildings_view WHERE city = 'San Francisco' AND reduction_percentage < 15; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, department VARCHAR(255)); INSERT INTO students (id, department) VALUES (1, 'art'), (2, 'science'), (3, 'art'), (4, 'mathematics'), (5, 'art'); CREATE TABLE accommodations (id INT, student_id INT, year INT); INSERT INTO accommodations (id, student_id, year) VALUES (1, 1, 2018), (2, 1, 2019... | What is the maximum number of accommodations provided to a single student in the art department? | SELECT MAX(accommodations) FROM (SELECT student_id, COUNT(*) as accommodations FROM accommodations GROUP BY student_id) as subquery WHERE student_id IN (SELECT id FROM students WHERE department = 'art'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT, industry VARCHAR(255), name VARCHAR(255), email VARCHAR(255), phone VARCHAR(255)); INSERT INTO Suppliers (id, industry, name, email, phone) VALUES (1, 'Automotive', 'ABC Supplies', 'abc@supplies.com', '123-456-7890'), (2, 'Aerospace', 'XYZ Supplies', 'xyz@supplies.com', '987-654-3210'); | List all suppliers that provide materials for the automotive industry and their corresponding contact information. | SELECT name, email, phone FROM Suppliers WHERE industry = 'Automotive'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mars_exploration (id INT, mission_name VARCHAR(50), launch_date DATE, mission_cost DECIMAL(15,2)); | What is the total cost of the Mars Exploration Program? | SELECT SUM(mission_cost) FROM mars_exploration; | gretelai_synthetic_text_to_sql |
CREATE TABLE Rural_Development_Fund(farmer_id INT, farmer_name VARCHAR(50), country VARCHAR(50), funding FLOAT); INSERT INTO Rural_Development_Fund(farmer_id, farmer_name, country, funding) VALUES (1, 'Raj Patel', 'India', 12000), (2, 'Min Jeong', 'South Korea', 18000); | Who are the farmers who received funding from the 'Rural Development Fund' in 'Asia' and their respective funding amounts? | SELECT farmer_name, funding FROM Rural_Development_Fund WHERE country = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (project_id INT PRIMARY KEY, project_name VARCHAR(100), sector VARCHAR(50), country VARCHAR(50), region VARCHAR(50), start_date DATE, end_date DATE); | Delete all 'Agricultural' sector records from the 'rural_development' database's 'projects' table | DELETE FROM projects WHERE sector = 'Agricultural'; | 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, 1.9), ('Africa', 2022, 1.6); | What is the minimum temperature anomaly for 'Africa'? | SELECT MIN(anomaly) FROM climate_data WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, name VARCHAR(50), location VARCHAR(30), status VARCHAR(20), artifacts INT); INSERT INTO heritage_sites (id, name, location, status, artifacts) VALUES (1, 'Site1', 'NYC', 'Good', 50), (2, 'Site2', 'LA', 'Fair', 75), (3, 'Site3', 'Sydney', 'Poor', 60); | List all heritage sites and their respective conservation status, along with the number of artifacts in each site. | SELECT h.status, h.name, h.location, h.artifacts FROM heritage_sites h ORDER BY h.status; | gretelai_synthetic_text_to_sql |
CREATE TABLE Operations.Pollution_Initiatives ( id INT, initiative_name VARCHAR(255), budget INT ); | List all the marine pollution initiatives in the 'Operations' schema's 'Pollution_Initiatives' table, along with their corresponding budgets | SELECT initiative_name, budget FROM Operations.Pollution_Initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameSessions (PlayerID INT, GameID INT, SessionDuration FLOAT, SessionDate DATE); INSERT INTO GameSessions (PlayerID, GameID, SessionDuration, SessionDate) VALUES (1, 1001, 50.5, '2022-02-01'), (2, 1002, 130.3, '2022-03-10'); | Identify the top 2 games with the highest number of active players in the last month. | SELECT GameID, COUNT(PlayerID) as PlayerCount, RANK() OVER (ORDER BY COUNT(PlayerID) DESC) as Rank FROM GameSessions WHERE SessionDate BETWEEN DATEADD(month, -1, CURRENT_DATE) AND CURRENT_DATE GROUP BY GameID HAVING Rank <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, age INT, disease TEXT, country TEXT); INSERT INTO patients (id, name, age, disease, country) VALUES (1, 'John Doe', 35, 'Malaria', 'Kenya'), (2, 'Jane Smith', 42, 'Malaria', 'Tanzania'), (3, 'Bob Johnson', 50, 'Malaria', 'Tanzania'), (4, 'Alice Williams', 60, 'Malaria', 'Kenya'... | How many patients have been treated for Malaria in each country in Africa? | SELECT country, COUNT(*) FROM patients WHERE disease = 'Malaria' AND country IN ('Kenya', 'Tanzania') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterUsage (user_type VARCHAR(20), water_consumption INT); INSERT INTO WaterUsage (user_type, water_consumption) VALUES ('Residential', 500), ('Commercial', 800), ('Industrial', 1200); | What are the water consumption values for commercial users in 'WaterUsage' table? | SELECT water_consumption FROM WaterUsage WHERE user_type = 'Commercial'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, destination VARCHAR(50), packages INT, timestamp DATE); INSERT INTO Shipments (id, destination, packages, timestamp) VALUES (1, 'Tokyo', 55, '2021-04-01'), (2, 'Seoul', 60, '2021-04-02'), (3, 'Beijing', 45, '2021-04-03'), (4, 'Shanghai', 70, '2021-04-04'), (5, 'Tokyo', 80, '2021-04-05'); | List the destinations that received more than 50 packages in a single day in April 2021 | SELECT destination FROM Shipments WHERE packages > 50 GROUP BY destination HAVING COUNT(DISTINCT timestamp) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_adoptions (id INT, program_id INT, animal_id INT); INSERT INTO animal_adoptions (id, program_id, animal_id) VALUES (1, 1, 101), (2, 1, 102), (3, 2, 103), (4, 2, 104), (5, 3, 105), (6, 3, 106), (7, 3, 107); | Find the number of animals adopted by each program, sorted by the adoption count in descending order. | SELECT program_id, COUNT(*) AS adoptions FROM animal_adoptions GROUP BY program_id ORDER BY adoptions DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, department VARCHAR(255), severity VARCHAR(255), date DATE); INSERT INTO vulnerabilities (id, department, severity, date) VALUES (1, 'Finance', 'medium', '2022-01-01'), (2, 'HR', 'high', '2022-01-05'), (3, 'IT', 'low', '2022-01-07'), (4, 'HR', 'medium', '2022-01-04'); | How many vulnerabilities with a severity of 'medium' were detected in the HR department in the last week? | SELECT COUNT(*) FROM vulnerabilities WHERE department = 'HR' AND severity = 'medium' AND date >= DATEADD(day, -7, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(255), age INT); CREATE TABLE zumba_classes (id INT, user_id INT, class_date DATE); | Find the number of users who have never attended a Zumba class? | SELECT COUNT(DISTINCT u.id) FROM users u LEFT JOIN zumba_classes zc ON u.id = zc.user_id WHERE zc.user_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments(id INT, sector VARCHAR(20), esg_score INT); INSERT INTO investments VALUES(1, 'Tech', 85), (2, 'Healthcare', 75), (3, 'Tech', 82); | What is the sum of ESG scores for the Renewable Energy sector? | SELECT SUM(esg_score) as total_esg_score FROM investments WHERE sector = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(50)); CREATE TABLE Donations (DonationID INT, ProgramID INT, DonationAmount DECIMAL(10,2)); CREATE TABLE Outcomes (ProgramID INT, ProgramOutcome VARCHAR(20)); INSERT INTO Programs (ProgramID, ProgramName) VALUES (1, 'Healthcare for All'), (2, 'Education for All'... | Which programs have donations but no reported outcomes? | SELECT Programs.ProgramName FROM Programs LEFT JOIN Outcomes ON Programs.ProgramID = Outcomes.ProgramID WHERE Outcomes.ProgramID IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Meals (meal_name VARCHAR(50), meal_type VARCHAR(20), country VARCHAR(50), calorie_count INT); INSERT INTO Meals (meal_name, meal_type, country, calorie_count) VALUES ('Chickpea Curry', 'vegetarian', 'Australia', 700), ('Lentil Soup', 'vegetarian', 'Australia', 450), ('Spaghetti Bolognese', 'non-vegetarian'... | What are the top 2 most caloric vegetarian dishes served in Australian schools? | SELECT meal_name, calorie_count FROM Meals WHERE meal_type = 'vegetarian' AND country = 'Australia' ORDER BY calorie_count DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage_history (id INT PRIMARY KEY, date DATE, region VARCHAR(20), usage INT); | Delete all records from the 'water_usage_history' table where the 'usage' is less than 1000 | DELETE FROM water_usage_history WHERE usage < 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_response(id INT, team VARCHAR(255), location VARCHAR(255)); INSERT INTO disaster_response(id, team, location) VALUES ('DR001', 'Team A', 'Afghanistan'), ('DR002', 'Team B', 'Pakistan'), ('DR003', 'Team C', 'Nepal'), ('DR004', 'Team A', 'Bangladesh'); | List all unique locations in 'disaster_response' table where 'Team A' has worked. | SELECT DISTINCT location FROM disaster_response WHERE team = 'Team A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_unemployment (state varchar(255), unemployment_date date, unemployment_rate decimal(5,2)); | What is the unemployment rate for veterans in California as of March 2022? | SELECT unemployment_rate FROM veteran_unemployment WHERE state = 'California' AND MONTH(unemployment_date) = 3 AND YEAR(unemployment_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_conferences (conference_id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); | Create a table for storing information about climate change conferences | CREATE TABLE climate_conferences (conference_id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE fabrics (id INT, name VARCHAR(50), type VARCHAR(50), supplier_country VARCHAR(50)); INSERT INTO fabrics (id, name, type, supplier_country) VALUES (1, 'Hemp', 'Natural', 'Nepal'); INSERT INTO fabrics (id, name, type, supplier_country) VALUES (2, 'Bamboo Viscose', 'Semi-Synthetic', 'China'); | What are the names and prices of all garments made from fabrics produced by suppliers from Asia? | SELECT garments.name, garments.price FROM garments JOIN fabrics ON garments.fabric_id = fabrics.id WHERE fabrics.supplier_country IN ('Asia', 'Nepal', 'China'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fruits (country VARCHAR(20), fruit VARCHAR(20)); INSERT INTO fruits VALUES ('Thailand', 'Mango'), ('Thailand', 'Durian'), ('Thailand', 'Pineapple'), ('Philippines', 'Mango'), ('Philippines', 'Banana'), ('Philippines', 'Papaya'); | Identify the common fruits grown in Thailand and Philippines. | SELECT fruit FROM fruits WHERE country = 'Thailand' INTERSECT SELECT fruit FROM fruits WHERE country = 'Philippines' | gretelai_synthetic_text_to_sql |
CREATE TABLE agriculture_innovation (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), location VARCHAR(50)); INSERT INTO agriculture_innovation (id, name, age, gender, location) VALUES (1, 'Jane', 45, 'Female', 'Rural Texas'); INSERT INTO agriculture_innovation (id, name, age, gender, location) VALUES (2, 'Alice'... | What is the average age of farmers in 'agriculture_innovation' table, grouped by location? | SELECT location, AVG(age) FROM agriculture_innovation GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy.suppliers (supplier_id INT, supplier_name VARCHAR(50), region VARCHAR(50)); INSERT INTO circular_economy.suppliers (supplier_id, supplier_name, region) VALUES (1, 'Supplier X', 'Asia'), (2, 'Supplier Y', 'Asia'), (3, 'Supplier Z', 'Europe'), (4, 'Supplier W', 'Africa'); | How many suppliers are there in the 'circular_economy' schema for each region? | SELECT region, COUNT(*) as total_suppliers FROM circular_economy.suppliers GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (item_id INT, item_name TEXT, quantity INT, cost_per_unit DECIMAL(5,2), is_gluten_free BOOLEAN, region TEXT); INSERT INTO inventory (item_id, item_name, quantity, cost_per_unit, is_gluten_free, region) VALUES (1, 'Veggie Burger', 50, 2.50, false, 'NY'), (2, 'Chicken Caesar Salad', 30, 3.50, false... | What is the total inventory cost for the gluten-free items in the inventory? | SELECT SUM(quantity * cost_per_unit) as total_inventory_cost FROM inventory WHERE is_gluten_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers(SupplierID INT, Name VARCHAR(50), Organic BOOLEAN);CREATE TABLE Products(ProductID INT, SupplierID INT, ProductName VARCHAR(50), Quantity INT, Organic BOOLEAN);INSERT INTO Suppliers VALUES (1, 'Supplier A', TRUE), (2, 'Supplier B', FALSE), (3, 'Organic Orchard', TRUE);INSERT INTO Products VALUES ... | Identify suppliers with the highest and lowest quantity of organic products supplied? | SELECT Name FROM Suppliers WHERE SupplierID IN (SELECT SupplierID FROM Products WHERE Organic = TRUE GROUP BY SupplierID HAVING MAX(Quantity) OR MIN(Quantity)); | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (ID INT, Disease VARCHAR(20), Age INT, DiagnosisDate DATE, State VARCHAR(20)); INSERT INTO Patients (ID, Disease, Age, DiagnosisDate, State) VALUES (1, 'Tuberculosis', 34, '2020-01-15', 'Texas'); INSERT INTO Patients (ID, Disease, Age, DiagnosisDate, State) VALUES (2, 'Tuberculosis', 42, '2020-02-... | What is the average age of patients diagnosed with Tuberculosis in 2020 in Texas? | SELECT AVG(Age) FROM Patients WHERE Disease = 'Tuberculosis' AND YEAR(DiagnosisDate) = 2020 AND State = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TVShows (show_id INT, viewership INT, genre VARCHAR(255)); INSERT INTO TVShows (show_id, viewership, genre) VALUES (1, 2500000, 'Sports'), (2, 1800000, 'Action'), (3, 2000000, 'Sports'); | What is the average viewership for sports-related TV shows? | SELECT AVG(viewership) FROM TVShows WHERE genre = 'Sports'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerability_categories (id INT, category VARCHAR(50), severity FLOAT); | What is the maximum severity score for each category of vulnerabilities, ordered by the maximum severity score in descending order? | SELECT category, MAX(severity) as max_severity FROM vulnerability_categories GROUP BY category ORDER BY max_severity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_id INT, name TEXT, city TEXT, has_virtual_tour BOOLEAN); INSERT INTO cultural_sites (site_id, name, city, has_virtual_tour) VALUES (1, 'Tsukiji Fish Market', 'Tokyo', true), (2, 'Meiji Shrine', 'Tokyo', true); | Delete virtual tour availability for the Meiji Shrine in Tokyo | UPDATE cultural_sites SET has_virtual_tour = false WHERE name = 'Meiji Shrine' AND city = 'Tokyo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, founder_race TEXT); CREATE TABLE investment (startup_id INT, investment_amount INT); INSERT INTO startup (id, name, founder_race) VALUES (1, 'Theta Corp', 'African American'); INSERT INTO investment (startup_id, investment_amount) VALUES (1, 1000000); INSERT INTO startup (id, na... | What is the total investment amount for startups founded by underrepresented racial or ethnic groups? | SELECT SUM(i.investment_amount) FROM startup s INNER JOIN investment i ON s.id = i.startup_id WHERE s.founder_race IN ('African American', 'Latinx', 'Native American', 'Pacific Islander'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (hospital_id INT, name TEXT, type TEXT, rural BOOLEAN); CREATE TABLE states (state_code TEXT, state_name TEXT); INSERT INTO hospitals (hospital_id, name, type, rural) VALUES (1, 'Rural General Hospital', 'Hospital', TRUE), (2, 'Rural Clinic', 'Clinic', TRUE); INSERT INTO states (state_code, state... | List the number of rural hospitals and clinics in each state, ordered by the state name. | SELECT 'Hospital' as type, states.state_name, COUNT(hospitals.hospital_id) as count FROM hospitals INNER JOIN states ON TRUE WHERE hospitals.rural = TRUE GROUP BY states.state_name UNION SELECT 'Clinic' as type, states.state_name, COUNT(hospitals.hospital_id) as count FROM hospitals INNER JOIN states ON TRUE WHERE hosp... | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_pricing (id INT, country VARCHAR(50), price FLOAT); INSERT INTO carbon_pricing (id, country, price) VALUES (1, 'Germany', 30.5), (2, 'France', 25.2), (3, 'US', 15.1), (4, 'Canada', 20.3); | What is the difference in carbon pricing (in USD/ton) between countries in Europe and North America? | SELECT country, price FROM carbon_pricing WHERE country IN ('Germany', 'France', 'US', 'Canada') ORDER BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (id INT, item_name VARCHAR(50), material VARCHAR(50), revenue INT); INSERT INTO Sales (id, item_name, material, revenue) VALUES (1, 'Shirt', 'Organic Cotton', 25), (2, 'Pants', 'Hemp', 30), (3, 'Jacket', 'Recycled Polyester', 50), (4, 'Shirt', 'Tencel', 20), (5, 'Skirt', 'Bamboo', 35); | What is the average revenue generated per sustainable clothing item sold? | SELECT AVG(revenue) FROM Sales WHERE material IN ('Organic Cotton', 'Hemp', 'Recycled Polyester', 'Tencel', 'Bamboo'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Hiring (HireID INT, EmployeeID INT, HireDate DATE); INSERT INTO Hiring (HireID, EmployeeID, HireDate) VALUES (1, 5, '2021-01-01'), (2, 6, '2020-06-15'), (3, 7, '2019-12-20'), (4, 8, '2020-02-14'); | How many female employees were hired in the last two years? | SELECT COUNT(*) FROM Hiring JOIN Employees ON Hiring.EmployeeID = Employees.EmployeeID WHERE Employees.Gender = 'Female' AND HireDate >= DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_harvest (id INT, forest_type VARCHAR(50), region VARCHAR(50), volume FLOAT, year INT); INSERT INTO timber_harvest (id, forest_type, region, volume, year) VALUES (1, 'Sustainable', 'Australia', 1200.5, 2010), (2, 'Sustainable', 'New Zealand', 800.3, 2010); | What is the average volume of timber harvested in Australian and New Zealand forests using sustainable practices since 2010? | SELECT AVG(volume) FROM timber_harvest WHERE forest_type = 'Sustainable' AND (region = 'Australia' OR region = 'New Zealand') AND year >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_production (id INT, country VARCHAR(50), source VARCHAR(50), production FLOAT, timestamp TIMESTAMP); INSERT INTO energy_production (id, country, source, production, timestamp) VALUES (1, 'Canada', 'Wind', 500.2, '2022-01-01 10:00:00'), (2, 'Canada', 'Solar', 700.3, '2022-01-02 15:00:00'); | What is the total energy production by renewable source in Canada for the month of January 2022? | SELECT source, SUM(production) as total_production FROM energy_production WHERE country = 'Canada' AND timestamp BETWEEN '2022-01-01 00:00:00' AND '2022-01-31 23:59:59' AND source IN ('Wind', 'Solar') GROUP BY source; | 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.