context
stringlengths 11
9.12k
| question
stringlengths 0
1.06k
| SQL
stringlengths 2
4.44k
| source
stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Country TEXT); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (1, 'John Doe', 'USA'); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (2, 'Jane Smith', 'Canada'); CREATE TABLE Contributions (ContributionID INT, DonorID INT, Program TEXT, Amount DECIMAL); INSERT INTO Contributions (ContributionID, DonorID, Program, Amount) VALUES (1, 1, 'Clean Water', 15000); INSERT INTO Contributions (ContributionID, DonorID, Program, Amount) VALUES (2, 2, 'Clean Water', 8000);
|
Which donors contributed more than 10000 to 'Clean Water' program?
|
SELECT Donors.DonorName FROM Donors INNER JOIN Contributions ON Donors.DonorID = Contributions.DonorID WHERE Contributions.Program = 'Clean Water' AND Contributions.Amount > 10000;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE fabric_stock (id INT PRIMARY KEY, fabric VARCHAR(20), quantity INT);
|
Which sustainable material has the minimum stock quantity?
|
SELECT fabric, MIN(quantity) FROM fabric_stock WHERE fabric IN ('organic_cotton', 'hemp', 'Tencel') GROUP BY fabric;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE innovation_projects (id INT, name VARCHAR(50), completion_date DATE); INSERT INTO innovation_projects (id, name, completion_date) VALUES (1, 'Innovative Irrigation System', '2011-06-30');
|
Which agricultural innovation projects in the 'rural_development' schema were completed before 2012?
|
SELECT name FROM rural_development.innovation_projects WHERE completion_date < '2012-01-01';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE JazzStreamUsers (UserID INT); INSERT INTO JazzStreamUsers (UserID) VALUES (1), (2), (3), (5), (6), (7); CREATE TABLE TotalStreamUsers (UserID INT); INSERT INTO TotalStreamUsers (UserID) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
Find the percentage of unique users who have streamed songs from the Jazz genre out of the total number of unique users.
|
SELECT 100.0 * COUNT(DISTINCT JazzStreamUsers.UserID) / COUNT(DISTINCT TotalStreamUsers.UserID) FROM JazzStreamUsers, TotalStreamUsers;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE SpaceMissions (id INT, name VARCHAR(255), launch_date DATE, duration INT);
|
What was the minimum duration of space missions launched after 2015?
|
SELECT MIN(duration) FROM SpaceMissions WHERE launch_date > '2015-01-01';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE grant (id INT, year INT, amount DECIMAL(10, 2)); INSERT INTO grant (id, year, amount) VALUES (1, 2019, 50000), (2, 2020, 75000), (3, 2019, 30000);
|
What is the number of grants awarded by year?
|
SELECT year, COUNT(id) as num_grants FROM grant GROUP BY year;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Employees (Employee_ID INT, First_Name VARCHAR(50), Last_Name VARCHAR(50), Department VARCHAR(50)); INSERT INTO Employees (Employee_ID, First_Name, Last_Name, Department) VALUES (1, 'John', 'Doe', 'Marketing'), (2, 'Jane', 'Smith', 'Marketing'), (3, 'Mike', 'Jameson', 'IT'), (4, 'Lucy', 'Brown', 'IT');
|
What is the combined list of employees from the 'Marketing' and 'IT' departments, excluding those who have the same last name as 'Jameson'?
|
SELECT * FROM Employees WHERE Department IN ('Marketing', 'IT') AND Last_Name != 'Jameson'
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE InfrastructureProjects (Id INT, Name VARCHAR(255), Type VARCHAR(255), ConstructionCost FLOAT); INSERT INTO InfrastructureProjects (Id, Name, Type, ConstructionCost) VALUES (1, 'Dam', 'Road', 5000000), (2, 'Bridge', 'Bridge', 2000000), (3, 'Road', 'Railway', 1500000), (4, 'Tunnel', 'Tunnel', 8000000), (5, 'Highway', 'Bridge', 3000000);
|
What is the average construction cost for bridges and tunnels?
|
SELECT AVG(ConstructionCost) as AverageCost FROM InfrastructureProjects WHERE Type IN ('Bridge', 'Tunnel');
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE mines (id INT, name TEXT, state TEXT, environmental_score INT); INSERT INTO mines (id, name, state, environmental_score) VALUES (1, 'Delta Mine', 'CA', 85), (2, 'Echo Mine', 'CA', 65), (3, 'Foxtrot Mine', 'CA', 78);
|
Which mines in California have an environmental impact score above 75?
|
SELECT name, environmental_score FROM mines WHERE state = 'CA' AND environmental_score > 75;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE ships (id INT, name VARCHAR(50)); CREATE TABLE ports (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE visits (ship_id INT, port_id INT, visit_date DATE); INSERT INTO ships (id, name) VALUES (1, 'Sealand Pride'), (2, 'Cosco Hope'), (3, 'MSC Anna'), (4, 'Ever Given'), (5, 'HMM Algeciras'); INSERT INTO ports (id, name, country) VALUES (1, 'Los Angeles', 'USA'), (2, 'Singapore', 'Singapore'), (3, 'Rotterdam', 'Netherlands'), (4, 'Busan', 'South Korea'), (5, 'Hamburg', 'Germany'); INSERT INTO visits (ship_id, port_id, visit_date) VALUES (1, 1, '2020-01-01'), (1, 2, '2020-02-01'), (2, 3, '2019-01-15'), (3, 1, '2020-03-01'), (4, 4, '2020-04-01'), (5, 5, '2020-05-01');
|
List all ships that have visited a port in the USA.
|
SELECT ships.name FROM ships INNER JOIN visits ON ships.id = visits.ship_id INNER JOIN ports ON visits.port_id = ports.id WHERE ports.country = 'USA';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE warehouses (id INT, item VARCHAR(10), quantity INT); INSERT INTO warehouses (id, item, quantity) VALUES (1, 'A101', 200), (2, 'A101', 300), (3, 'B203', 150);
|
What is the total quantity of item 'A101' in all warehouses?
|
SELECT SUM(quantity) FROM warehouses WHERE item = 'A101';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Name VARCHAR(50), Specialty VARCHAR(50)); INSERT INTO CommunityHealthWorkers (WorkerID, Name, Specialty) VALUES (1, 'John Doe', 'Mental Health'); INSERT INTO CommunityHealthWorkers (WorkerID, Name, Specialty) VALUES (2, 'Jane Smith', 'Physical Health');
|
What is the combined list of mental health conditions and physical health issues for community health workers?
|
SELECT Specialty FROM CommunityHealthWorkers WHERE Specialty = 'Mental Health' UNION SELECT Specialty FROM CommunityHealthWorkers WHERE Specialty = 'Physical Health';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE maritime_safety_violations (violation_id INT, region TEXT); INSERT INTO maritime_safety_violations (violation_id, region) VALUES (1, 'Atlantic'), (2, 'Pacific'), (3, 'Indian Ocean'); CREATE TABLE vessels_detained (violation_id INT, vessel_name TEXT); INSERT INTO vessels_detained (violation_id, vessel_name) VALUES (1, 'Vessel A'), (1, 'Vessel B'), (2, 'Vessel C');
|
What is the total number of vessels detained for maritime safety violations in each region?
|
SELECT region, COUNT(vessel_name) FROM vessels_detained INNER JOIN maritime_safety_violations ON vessels_detained.violation_id = maritime_safety_violations.violation_id GROUP BY region;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE biotech_startups (id INT, name VARCHAR(50), location VARCHAR(50), funding FLOAT); INSERT INTO biotech_startups (id, name, location, funding) VALUES (1, 'Genomic Inc', 'California', 1500000); INSERT INTO biotech_startups (id, name, location, funding) VALUES (2, 'BioSense', 'Texas', 1200000); INSERT INTO biotech_startups (id, name, location, funding) VALUES (3, 'BioMarker', 'California', 1000000);
|
Calculate the total funding received by biotech startups in each location.
|
SELECT location, SUM(funding) FROM biotech_startups GROUP BY location;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE city_budget (city VARCHAR(20), department VARCHAR(20), budget INT); INSERT INTO city_budget (city, department, budget) VALUES ('Los Angeles', 'Education', 5000000);
|
What is the total budget allocated for education in the city of Los Angeles, including all districts, for the fiscal year 2023?
|
SELECT SUM(budget) FROM city_budget WHERE city = 'Los Angeles' AND department = 'Education' AND fiscal_year = 2023;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE sustainable_practices (practice_id INT, description TEXT, category VARCHAR(20));
|
Add a new record to the "sustainable_practices" table with an ID of 5, a description of 'Reducing water usage in housekeeping', and a category of 'Water'
|
INSERT INTO sustainable_practices (practice_id, description, category) VALUES (5, 'Reducing water usage in housekeeping', 'Water');
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE hardware_data (model_id INT, model_name VARCHAR(50), platform VARCHAR(50), application VARCHAR(50));
|
What is the distribution of models trained on different hardware platforms for AI applications?
|
SELECT platform, COUNT(model_id) as num_models FROM hardware_data GROUP BY platform;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE MangroveForest (id INT, species VARCHAR(255), diameter FLOAT, height FLOAT, volume FLOAT); INSERT INTO MangroveForest (id, species, diameter, height, volume) VALUES (1, 'Mangrove', 4.8, 70, 42.0); INSERT INTO MangroveForest (id, species, diameter, height, volume) VALUES (2, 'BlackMangrove', 3.4, 50, 23.5);
|
What is the maximum volume of trees in the 'MangroveForest' table?
|
SELECT MAX(volume) FROM MangroveForest;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE intelligence_operations (id INT, operation_name VARCHAR(255), country VARCHAR(255), start_date DATE, end_date DATE);INSERT INTO intelligence_operations (id, operation_name, country, start_date, end_date) VALUES (1, 'Operation Joint', 'USA', '2011-01-01', '2011-12-31'), (2, 'Operation Coalition', 'USA', '2015-01-01', '2015-12-31');
|
Show the intelligence operations that were conducted by the USA in the last decade.
|
SELECT * FROM intelligence_operations WHERE country = 'USA' AND YEAR(start_date) >= 2010;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE defense_projects (id INT, project_name VARCHAR, start_date DATE, end_date DATE);
|
List defense projects with timelines exceeding 18 months
|
SELECT project_name FROM defense_projects WHERE DATEDIFF(end_date, start_date) > 18*30;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE sales (sale_id INT, genre VARCHAR(10), platform VARCHAR(10), sales FLOAT);
|
What is the difference in sales between the pop and rock genres, for each platform?
|
SELECT platform, SUM(CASE WHEN genre = 'pop' THEN sales ELSE -SUM(sales) END) AS difference FROM sales WHERE genre IN ('pop', 'rock') GROUP BY platform;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Donations (id INT, donation_amount DECIMAL(10,2), donation_date DATE, program VARCHAR(50), country VARCHAR(50)); CREATE TABLE Programs (id INT, program VARCHAR(50), country VARCHAR(50)); INSERT INTO Donations (id, donation_amount, donation_date, program, country) VALUES (1, 75.00, '2021-01-01', 'Agriculture', 'Kenya'); INSERT INTO Donations (id, donation_amount, donation_date, program, country) VALUES (2, 125.00, '2021-01-02', 'Education', 'Kenya'); INSERT INTO Programs (id, program, country) VALUES (1, 'Agriculture', 'Kenya'); INSERT INTO Programs (id, program, country) VALUES (2, 'Education', 'Kenya');
|
What is the total donation amount for each program in Kenya?
|
SELECT p.program, SUM(d.donation_amount) as total_donations FROM Donations d INNER JOIN Programs p ON d.program = p.program WHERE d.country = 'Kenya' GROUP BY p.program;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE farm (id INT, name VARCHAR(255)); CREATE TABLE fish_stock (farm_id INT, species_id INT, biomass DECIMAL(10,2)); INSERT INTO farm (id, name) VALUES (1, 'Farm A'), (2, 'Farm B'); INSERT INTO fish_stock (farm_id, species_id, biomass) VALUES (1, 1, 3000.0), (1, 2, 2000.0), (2, 1, 4000.0), (2, 2, 1000.0);
|
What is the total biomass for fish in each farm?
|
SELECT f.name, SUM(fs.biomass) AS total_biomass FROM farm f JOIN fish_stock fs ON f.id = fs.farm_id GROUP BY f.id, f.name;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE water_usage (id INT PRIMARY KEY, region VARCHAR(20), usage FLOAT); CREATE TABLE conservation_initiatives (id INT PRIMARY KEY, region VARCHAR(20), initiative TEXT);
|
Add a new view 'conservation_efforts' to show all water usage and conservation initiatives
|
CREATE VIEW conservation_efforts AS SELECT water_usage.region, water_usage.usage, conservation_initiatives.initiative FROM water_usage INNER JOIN conservation_initiatives ON water_usage.region = conservation_initiatives.region;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE city_temp (city VARCHAR(255), population INT, region VARCHAR(255), avg_temp FLOAT); INSERT INTO city_temp (city, population, region, avg_temp) VALUES ('CityX', 2500000, 'Europe', 12.5), ('CityY', 1800000, 'Europe', 13.2), ('CityZ', 3000000, 'Europe', 11.7);
|
What is the average temperature change in cities with a population over 2 million in Europe?
|
SELECT AVG(avg_temp) FROM city_temp WHERE population > 2000000 AND region = 'Europe';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Urban_Farms (id INT PRIMARY KEY, name VARCHAR(50), location VARCHAR(50)); INSERT INTO Urban_Farms (id, name, location) VALUES (1, 'Green Acres', 'USA'); INSERT INTO Urban_Farms (id, name, location) VALUES (2, 'City Farm', 'Canada'); CREATE TABLE Soil_Samples (id INT PRIMARY KEY, farm_id INT, ph VARCHAR(10), nitrogen_level INT, organic_matter_percentage DECIMAL(4,2)); INSERT INTO Soil_Samples (id, farm_id, ph, nitrogen_level, organic_matter_percentage) VALUES (1, 1, '6.5', 150, 3.50); INSERT INTO Soil_Samples (id, farm_id, ph, nitrogen_level, organic_matter_percentage) VALUES (2, 2, '7.0', 180, 5.00); CREATE TABLE Farm_Soil (farm_id INT, soil_sample_id INT); INSERT INTO Farm_Soil (farm_id, soil_sample_id) VALUES (1, 1); INSERT INTO Farm_Soil (farm_id, soil_sample_id) VALUES (2, 2);
|
Which urban farm in the US has the lowest organic matter percentage in soil samples?
|
SELECT name FROM Urban_Farms JOIN Farm_Soil ON Urban_Farms.id = Farm_Soil.farm_id JOIN Soil_Samples ON Farm_Soil.soil_sample_id = Soil_Samples.id ORDER BY organic_matter_percentage ASC LIMIT 1;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE ExhibitionDigitalEngagementTokyo (exhibition_id INT, city VARCHAR(50), digital_engagement INT); INSERT INTO ExhibitionDigitalEngagementTokyo (exhibition_id, city, digital_engagement) VALUES (1, 'Tokyo', 5000), (2, 'Tokyo', 7000), (3, 'Tokyo', 9000); CREATE TABLE ExhibitionDigitalEngagementParis (exhibition_id INT, city VARCHAR(50), digital_engagement INT); INSERT INTO ExhibitionDigitalEngagementParis (exhibition_id, city, digital_engagement) VALUES (4, 'Paris', 6000), (5, 'Paris', 8000), (6, 'Paris', 10000);
|
What is the total number of digital engagements in Tokyo?
|
SELECT SUM(digital_engagement) FROM ExhibitionDigitalEngagementTokyo;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE community_initiative_type (initiative_id INT, initiative_name VARCHAR(50), initiative_type VARCHAR(50), budget INT); INSERT INTO community_initiative_type (initiative_id, initiative_name, initiative_type, budget) VALUES (1, 'Community Health Center', 'Health', 100000);
|
List all community development initiatives and their budgets, grouped by initiative type in the 'rural_development' database.
|
SELECT initiative_type, SUM(budget) FROM community_initiative_type GROUP BY initiative_type;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE advisories (advisory_id INT, country TEXT, reason TEXT); CREATE TABLE countries (country_id INT, name TEXT, region TEXT);
|
List all destinations in Africa without any travel advisories.
|
SELECT c.name FROM countries c LEFT JOIN advisories a ON c.name = a.country WHERE a.country IS NULL AND c.region = 'Africa';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (1, 25, 'Male', 'Egypt'), (2, 30, 'Female', 'Nigeria'), (3, 22, 'Male', 'South Africa'), (4, 35, 'Non-binary', 'Morocco'), (5, 28, 'Female', 'Kenya');
|
What is the count of players from African countries?
|
SELECT COUNT(*) FROM Players WHERE Country IN ('Egypt', 'Nigeria', 'South Africa', 'Morocco', 'Kenya');
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE unions (id INT, industry VARCHAR(255), has_cba BOOLEAN); CREATE TABLE workers (id INT, union_id INT);
|
What is the total number of workers in unions that have collective bargaining agreements and are in the 'Technology' industry?
|
SELECT COUNT(*) FROM workers JOIN unions ON workers.union_id = unions.id WHERE unions.industry = 'Technology' AND unions.has_cba = TRUE;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE warehouses (id INT, name TEXT, region TEXT); INSERT INTO warehouses (id, name, region) VALUES (1, 'Miami Warehouse', 'south'), (2, 'New Orleans Warehouse', 'south'); CREATE TABLE packages (id INT, warehouse_id INT, weight FLOAT, state TEXT); INSERT INTO packages (id, warehouse_id, weight, state) VALUES (1, 1, 12.5, 'Florida'), (2, 1, 15.3, 'California'), (3, 2, 10.8, 'Louisiana');
|
What is the total number of packages shipped from the 'south' region warehouses to California?
|
SELECT COUNT(*) FROM packages p JOIN warehouses w ON p.warehouse_id = w.id WHERE w.region = 'south' AND p.state = 'California';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE public_defenders (defender_id INT, defender_name VARCHAR(50), defender_state VARCHAR(2), court_type_id INT); INSERT INTO public_defenders VALUES (1, 'John Smith', 'NY', 1), (2, 'Jane Doe', 'CA', 2), (3, 'Maria Garcia', 'IL', 3); CREATE TABLE court_types (court_type_id INT, court_type_name VARCHAR(20), community_type VARCHAR(20)); INSERT INTO court_types VALUES (1, 'Community', 'Indigenous'), (2, 'Juvenile', 'Immigrant'), (3, 'Traffic', 'Low-income'), (4, 'Civil', 'Minority'); CREATE TABLE defendant_data (defendant_id INT, defendant_state VARCHAR(2), defender_id INT); INSERT INTO defendant_data VALUES (1, 'NY', 1), (2, 'CA', 2), (3, 'IL', 3), (4, 'NY', 1), (5, 'CA', 2), (6, 'IL', 3);
|
Which public defenders have represented the most clients in indigenous communities?
|
SELECT pd.defender_name, COUNT(dd.defendant_id) FROM public_defenders pd INNER JOIN defendant_data dd ON pd.defender_id = dd.defender_id INNER JOIN court_types ct ON pd.court_type_id = ct.court_type_id WHERE ct.community_type = 'Indigenous' GROUP BY pd.defender_name ORDER BY COUNT(dd.defendant_id) DESC;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE dental_clinics (id INT, name TEXT, location TEXT); INSERT INTO dental_clinics (id, name, location) VALUES (1, 'Clinic A', 'City A'); INSERT INTO dental_clinics (id, name, location) VALUES (2, 'Clinic B', 'City B'); CREATE TABLE populations (city TEXT, size INT); INSERT INTO populations (city, size) VALUES ('City A', 500000); INSERT INTO populations (city, size) VALUES ('City B', 300000);
|
List the number of dental clinics in each city with a population over 250,000?
|
SELECT dental_clinics.location, COUNT(dental_clinics.id) FROM dental_clinics INNER JOIN populations ON dental_clinics.location = populations.city WHERE populations.size > 250000 GROUP BY dental_clinics.location;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE energy_prices (id INT PRIMARY KEY, source VARCHAR(50), price_per_mwh FLOAT, date DATE, country VARCHAR(50)); INSERT INTO energy_prices (id, source, price_per_mwh, date, country) VALUES (1, 'Wind', 35.5, '2022-01-01', 'Canada'), (2, 'Solar', 40.2, '2022-01-02', 'Canada'), (3, 'Wind', 32.0, '2022-01-03', 'Canada');
|
What is the minimum price per MWh for each energy source in Canada in the year 2022?
|
SELECT source, MIN(price_per_mwh) FROM energy_prices WHERE date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY source;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE RuralHospitals (HospitalID INT, Name VARCHAR(100), Location VARCHAR(100), NumberBeds INT); INSERT INTO RuralHospitals VALUES (1, 'Rural General Hospital', 'Springfield', 200);
|
What is the total number of hospital beds in the rural health database?
|
SELECT SUM(NumberBeds) FROM RuralHospitals;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE systems (system_id INT PRIMARY KEY, system_name VARCHAR(100), department VARCHAR(50), vulnerability_score INT); INSERT INTO systems (system_id, system_name, department, vulnerability_score) VALUES (1, 'Server01', 'Finance', 7), (2, 'Workstation01', 'Finance', 5), (3, 'Laptop01', 'Finance', 9);
|
What are the top 3 most vulnerable systems in the 'Finance' department based on their vulnerability scores?
|
SELECT system_name, vulnerability_score FROM systems WHERE department = 'Finance' ORDER BY vulnerability_score DESC LIMIT 3;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Grants (GrantID INT, GrantName VARCHAR(50), Recipient VARCHAR(50), Amount DECIMAL(10,2), Field VARCHAR(50)); INSERT INTO Grants (GrantID, GrantName, Recipient, Amount, Field) VALUES (1, 'Grant A', 'Org A', 100000, 'Education'), (2, 'Grant B', 'Org B', 200000, 'Education'), (3, 'Grant C', 'Org C', 150000, 'Climate Change'), (4, 'Grant D', 'Org D', 120000, 'Climate Change');
|
Identify the common recipients of grants in both the fields of education and climate change.
|
SELECT Recipient FROM Grants WHERE Field = 'Education' INTERSECT SELECT Recipient FROM Grants WHERE Field = 'Climate Change';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE menu_items(menu_item_id INT, name VARCHAR(255), category VARCHAR(255), vegan BOOLEAN, sustainable BOOLEAN); INSERT INTO menu_items(menu_item_id, name, category, vegan, sustainable) VALUES (1, 'Vegetable Spring Rolls', 'Chinese', true, true); INSERT INTO menu_items(menu_item_id, name, category, vegan, sustainable) VALUES (2, 'Tofu Stir Fry', 'Chinese', true, true);
|
Identify the number of 'Vegan' menu items in 'Chinese' restaurants with sustainable sourcing.
|
SELECT COUNT(*) FROM menu_items WHERE category = 'Chinese' AND vegan = true AND sustainable = true;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE cybersecurity_incidents (id INT, country VARCHAR(50), region VARCHAR(50), year INT, incidents INT); INSERT INTO cybersecurity_incidents (id, country, region, year, incidents) VALUES (1, 'Germany', 'Europe', 2021, 50);
|
Who are the top 5 countries with the highest number of cybersecurity incidents reported in Europe in the past 3 years?
|
SELECT country, SUM(incidents) as total_incidents FROM cybersecurity_incidents WHERE region = 'Europe' AND year BETWEEN 2019 AND 2021 GROUP BY country ORDER BY total_incidents DESC LIMIT 5;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE FoodborneIllnesses (illness_id INT, illness_date DATE, location VARCHAR(255)); INSERT INTO FoodborneIllnesses (illness_id, illness_date, location) VALUES (1, '2022-04-15', 'School'), (2, '2022-02-10', 'Restaurant'), (3, '2022-01-05', 'School');
|
How many instances of foodborne illnesses were reported in schools during the last quarter?
|
SELECT COUNT(*) FROM FoodborneIllnesses WHERE location = 'School' AND EXTRACT(QUARTER FROM illness_date) = 2;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE crimes (date DATE, neighborhood VARCHAR(255), num_crimes INT); INSERT INTO crimes (date, neighborhood, num_crimes) VALUES ('2021-01-01', 'Neighborhood A', 5), ('2021-01-02', 'Neighborhood B', 3), ('2021-01-03', 'Neighborhood C', 7), ('2021-01-04', 'Neighborhood D', 4);
|
What is the average number of crimes committed per day in each neighborhood of a city?
|
SELECT s1.neighborhood, AVG(s1.num_crimes) as avg_num_crimes FROM crimes s1 GROUP BY s1.neighborhood;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE property (id INT PRIMARY KEY, rating FLOAT, area VARCHAR(20));
|
What is the maximum sustainable urbanism rating in the downtown area?
|
SELECT MAX(rating) FROM property WHERE area = 'downtown';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE GameDesign (GameID INT, GameName VARCHAR(50), VR BIT); INSERT INTO GameDesign (GameID, GameName, VR) VALUES (1, 'Space Explorer', 1), (2, 'Racing Fever', 0), (3, 'VR Puzzle', 1); CREATE TABLE PlayerDemographics (PlayerID INT, Gender VARCHAR(10)); INSERT INTO PlayerDemographics (PlayerID, Gender) VALUES (1, 'Male'), (2, 'Female'), (3, 'Non-binary');
|
What is the number of virtual reality (VR) games designed for each gender, and what are their names?
|
SELECT PlayerDemographics.Gender, COUNT(GameDesign.GameID) AS VR_Games_Designed, MIN(GameDesign.GameName) AS First_VR_Game, MAX(GameDesign.GameName) AS Last_VR_Game FROM GameDesign INNER JOIN PlayerDemographics ON GameDesign.VR = 1 GROUP BY PlayerDemographics.Gender;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE safety_tests (id INT PRIMARY KEY, company VARCHAR(255), test_location VARCHAR(255), test_date DATE, safety_rating INT);
|
Show the number of safety tests performed in each location
|
SELECT test_location, COUNT(*) as total_tests FROM safety_tests GROUP BY test_location;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE urban_areas (id INT, area VARCHAR(20), inclusive BOOLEAN); INSERT INTO urban_areas (id, area, inclusive) VALUES (1, 'City D', true), (2, 'City E', false), (3, 'City F', true); CREATE TABLE properties (id INT, area VARCHAR(20), size INT); INSERT INTO properties (id, area, size) VALUES (1, 'City D', 1300), (2, 'City E', 2100), (3, 'City F', 1100);
|
What is the average property size in neighborhoods adhering to inclusive housing policies?
|
SELECT AVG(size) FROM properties JOIN urban_areas ON properties.area = urban_areas.area WHERE urban_areas.inclusive = true;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10)); CREATE TABLE ESportsEvents (EventID INT, PlayerID INT, EventName VARCHAR(20), EventWinner INT);
|
What is the total number of games played by players who have won an ESports event, and what is the average age of those players?
|
SELECT AVG(Players.Age), SUM(ESportsEvents.EventWinner) FROM Players INNER JOIN ESportsEvents ON Players.PlayerID = ESportsEvents.PlayerID WHERE ESportsEvents.EventWinner = 1;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE graduate_students (id INT, name VARCHAR(50), advisor VARCHAR(50), grant INT); INSERT INTO graduate_students (id, name, advisor, grant) VALUES (1, 'Bob Brown', 'John Doe', 1), (2, 'Sara Connor', 'Sam Smith', 1), (3, 'Mike White', 'Jane Smith', 1);
|
Delete all records from the graduate_students table.
|
DELETE FROM graduate_students;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE community_justice_centers (id INT, case_id INT, opening_date DATE, case_type TEXT);
|
How many cases were opened in the 'community_justice_centers' table by month?
|
SELECT EXTRACT(MONTH FROM opening_date), COUNT(*) FROM community_justice_centers GROUP BY EXTRACT(MONTH FROM opening_date);
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE users (id INT, username TEXT, email TEXT, country TEXT, created_at DATETIME); CREATE TABLE posts (id INT, user_id INT, content TEXT, likes INT, shares INT, created_at DATETIME); INSERT INTO users (id, username, email, country, created_at) VALUES (1, 'jane123', '[jane@gmail.com](mailto:jane@gmail.com)', 'United States', '2021-01-01 10:00:00'), (2, 'bob_the_builder', '[bob@yahoo.com](mailto:bob@yahoo.com)', 'Canada', '2021-02-01 11:00:00'); INSERT INTO posts (id, user_id, content, likes, shares, created_at) VALUES (1, 1, 'Clean beauty is the way to go!', 500, 200, '2022-01-01 10:00:00'), (2, 1, 'Trying out a new clean beauty product...', 800, 300, '2022-01-02 11:00:00');
|
Calculate the total number of shares for posts related to "clean beauty" in the "social_media" schema by users from the United States.
|
SELECT SUM(shares) FROM posts JOIN users ON posts.user_id = users.id WHERE posts.content LIKE '%clean beauty%' AND users.country = 'United States' AND schema='social_media';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE crops (id INT, name VARCHAR(20), growing_location VARCHAR(20), growing_year INT);
|
Find the total number of crops grown in 'urban agriculture' systems in 2021.
|
SELECT COUNT(*) FROM crops WHERE growing_location = 'urban agriculture' AND growing_year = 2021;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE talent_acquisition (id INT PRIMARY KEY, job_title VARCHAR(50), job_location VARCHAR(50), number_of_openings INT, source VARCHAR(50));
|
Delete a talent acquisition record from the 'talent_acquisition' table
|
DELETE FROM talent_acquisition WHERE id = 2001;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE ai_models (model_id INT PRIMARY KEY, model_name VARCHAR(50), model_type VARCHAR(50), explainability_score FLOAT); INSERT INTO ai_models (model_id, model_name, model_type, explainability_score) VALUES (1, 'ModelA', 'Deep Learning', 0.85), (2, 'ModelB', 'Tree Based', 0.92), (3, 'ModelC', 'Logistic Regression', 0.78);
|
What is the average explainability score for each AI model, grouped by model type?
|
SELECT model_type, AVG(explainability_score) FROM ai_models GROUP BY model_type;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE products (product_id INT, name VARCHAR(50), cruelty_free BOOLEAN, organic BOOLEAN, revenue INT); INSERT INTO products (product_id, name, cruelty_free, organic, revenue) VALUES (1, 'Lipstick A', true, true, 200), (2, 'Lipstick B', false, false, 300), (3, 'Eyeshadow C', true, false, 150);
|
What is the total revenue for products that are both cruelty-free and organic?
|
SELECT SUM(products.revenue) FROM products WHERE products.cruelty_free = true AND products.organic = true;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE waste_generation (id INT, region VARCHAR(20), amount INT); INSERT INTO waste_generation (id, region, amount) VALUES (1, 'Ontario', 2000), (2, 'Quebec', 3000);
|
Calculate the total waste generated in 'Ontario' and 'Quebec'
|
SELECT SUM(amount) FROM waste_generation WHERE region IN ('Ontario', 'Quebec');
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE ChemicalProduction (date DATE, chemical VARCHAR(10), mass FLOAT); INSERT INTO ChemicalProduction (date, chemical, mass) VALUES ('2021-01-01', 'A', 100), ('2021-01-01', 'B', 150), ('2021-01-02', 'A', 120), ('2021-01-02', 'B', 170);
|
What is the minimum mass of a single chemical production?
|
SELECT chemical, MIN(mass) as MinMass FROM ChemicalProduction;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Policies (PolicyID TEXT, PolicyHolder TEXT, Premium INT); INSERT INTO Policies (PolicyID, PolicyHolder, Premium) VALUES ('P123', 'John Doe', 1000); INSERT INTO Policies (PolicyID, PolicyHolder, Premium) VALUES ('Y456', 'Jane Smith', 2000);
|
Show the policy details of policies starting with 'P' and ending with 'Y'?
|
SELECT * FROM Policies WHERE PolicyID LIKE 'P%' AND PolicyID LIKE '%Y';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE humanitarian_assistance (country VARCHAR(50));
|
Identify the number of humanitarian assistance operations participated in by countries from the Asia-Pacific region, not including Australia.
|
SELECT country, COUNT(*) FROM (SELECT country FROM humanitarian_assistance WHERE country NOT IN ('Australia') AND country LIKE 'Asia%') GROUP BY country;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE HistoricalContexts(id INT, name TEXT, region TEXT); INSERT INTO HistoricalContexts (id, name, region) VALUES (1, 'Context 1', 'Asia'); INSERT INTO HistoricalContexts (id, name, region) VALUES (2, 'Context 2', 'Europe'); CREATE TABLE Artifacts(id INT, historical_context_id INT, name TEXT, type TEXT); INSERT INTO Artifacts (id, historical_context_id, name, type) VALUES (1, 1, 'Artifact 1', 'Bronze'); INSERT INTO Artifacts (id, historical_context_id, name, type) VALUES (2, 1, 'Artifact 2', 'Pottery');
|
What are the historical contexts associated with the discovered artifacts from the 'Asian' region?
|
SELECT Artifacts.name, HistoricalContexts.name AS context_name FROM Artifacts INNER JOIN HistoricalContexts ON Artifacts.historical_context_id = HistoricalContexts.id WHERE HistoricalContexts.region = 'Asia';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE food_justice_projects (id INT, name TEXT, location TEXT, area_ha FLOAT);
|
Add a new food justice project 'Project E' in 'Texas' with an area of 1.2 hectares to the 'food_justice_projects' table.
|
INSERT INTO food_justice_projects (id, name, location, area_ha) VALUES (4, 'Project E', 'Texas', 1.2);
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE SafetyResearchers (id INT, name VARCHAR(255), age INT, project VARCHAR(255), budget DECIMAL(10,2));
|
How many AI researchers are currently working on projects related to AI safety, and what is their combined budget?
|
SELECT COUNT(*), SUM(budget) FROM SafetyResearchers WHERE project LIKE '%AI safety%';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE transit_trips (id INT, disability TEXT, trip_date DATE, city TEXT); INSERT INTO transit_trips (id, disability, trip_date, city) VALUES (1, 'yes', '2023-02-01', 'NYC'), (2, 'no', '2023-02-02', 'NYC'), (3, 'yes', '2023-01-01', 'NYC');
|
How many public transportation trips were taken by people with disabilities in New York City in the last 3 months?
|
SELECT SUM(trip_count) FROM transit_trips WHERE disability = 'yes' AND city = 'NYC' AND trip_date >= DATEADD(month, -3, GETDATE());
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(50), NumOfSongs INT); INSERT INTO Artists VALUES (1, 'Artist A', 120), (2, 'Artist B', 150), (3, 'Artist C', 170), (4, 'Artist D', 200), (5, 'Artist E', 250), (6, 'Artist F', 100);
|
Find the total number of songs produced by the top 5 most productive artists.
|
SELECT ArtistName, SUM(NumOfSongs) FROM Artists WHERE ArtistID IN (SELECT ArtistID FROM Artists ORDER BY NumOfSongs DESC LIMIT 5) GROUP BY ArtistName;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE salaries (worker_id INT, job_role VARCHAR(255), location VARCHAR(255), salary FLOAT);
|
What is the average salary of workers in the manufacturing industry, grouped by their job role and location?
|
SELECT location, job_role, AVG(salary) FROM salaries GROUP BY location, job_role;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE manufacturers (manufacturer_id INT, manufacturer_name VARCHAR(255), industry VARCHAR(255), total_water_usage INT); CREATE TABLE denim_manufacturers AS SELECT * FROM manufacturers WHERE industry = 'denim';
|
Who are the top 5 manufacturers in terms of water usage in the denim industry?
|
SELECT manufacturer_name, total_water_usage FROM denim_manufacturers ORDER BY total_water_usage DESC LIMIT 5;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE forests (id INT, name VARCHAR(50), hectares DECIMAL(5,2), year_planted INT, country VARCHAR(50), PRIMARY KEY (id)); INSERT INTO forests (id, name, hectares, year_planted, country) VALUES (1, 'Forest A', 123.45, 1990, 'USA'), (2, 'Forest B', 654.32, 1985, 'Canada'), (3, 'Forest C', 456.78, 2010, 'USA'), (4, 'Forest D', 903.45, 1980, 'Mexico'); CREATE TABLE timber_sales (id INT, forest_id INT, year INT, volume DECIMAL(10,2), price DECIMAL(10,2), PRIMARY KEY (id)); INSERT INTO timber_sales (id, forest_id, year, volume, price) VALUES (1, 1, 2021, 120.50, 100.00), (2, 1, 2022, 150.75, 125.50), (3, 2, 2021, 450.23, 50.00), (4, 2, 2022, 520.89, 75.25), (5, 3, 2021, 300.56, 150.00), (6, 3, 2022, 345.98, 175.50);
|
Summarize timber sales revenue by year and country
|
SELECT f.country, t.year, SUM(t.volume * t.price) FROM forests f INNER JOIN timber_sales t ON f.id = t.forest_id GROUP BY f.country, t.year;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE CarbonSequestration (year INT, sequestration_rate FLOAT); INSERT INTO CarbonSequestration (year, sequestration_rate) VALUES (2018, 5.5), (2019, 6.0), (2020, 6.5), (2021, 7.0);
|
What is the average carbon sequestration rate for a given year?
|
SELECT year, AVG(sequestration_rate) as avg_sequestration_rate FROM CarbonSequestration GROUP BY year;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE members_without_unions (id INT, name TEXT, age INT); INSERT INTO members_without_unions (id, name, age) VALUES (1, 'John Doe', 30);
|
Delete records of members with no union affiliation.
|
DELETE FROM members_without_unions WHERE id NOT IN (SELECT member_id FROM union_memberships);
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE clinical_trials (drug_name VARCHAR(255), trial_cost FLOAT, approval_body VARCHAR(255)); INSERT INTO clinical_trials (drug_name, trial_cost, approval_body) VALUES ('DrugA', 12000000, 'FDA'), ('DrugB', 6000000, 'TGA'), ('DrugC', 9000000, 'FDA'), ('DrugD', 5000000, 'TGA');
|
What is the minimum clinical trial cost for drugs approved by the TGA?
|
SELECT MIN(trial_cost) FROM clinical_trials WHERE approval_body = 'TGA';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE speakers (id INT PRIMARY KEY, name VARCHAR(255), organization VARCHAR(255), country VARCHAR(255)); INSERT INTO speakers (id, name, organization, country) VALUES (1, 'Riya', 'AI for Good Foundation', 'India'); INSERT INTO speakers (id, name, organization, country) VALUES (2, 'Bob', 'Tech for Social Impact Inc.', 'Canada'); CREATE TABLE talks (id INT PRIMARY KEY, title VARCHAR(255), speaker_id INT, conference_id INT); INSERT INTO talks (id, title, speaker_id, conference_id) VALUES (1, 'Ethical AI in Healthcare', 1, 1); CREATE TABLE conferences (id INT PRIMARY KEY, name VARCHAR(255), city VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO conferences (id, name, city, start_date, end_date) VALUES (1, 'AI for Social Good Summit', 'San Francisco', '2022-06-01', '2022-06-03');
|
What is the name of the speaker from India who spoke at the AI for Social Good Summit?
|
SELECT speakers.name FROM speakers, talks WHERE speakers.id = talks.speaker_id AND talks.conference_id = (SELECT id FROM conferences WHERE name = 'AI for Social Good Summit') AND speakers.country = 'India';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE trainings (trainee_country VARCHAR(255), training_provider VARCHAR(255), training_date DATE);
|
Which countries have received military training from the US in the past 5 years?
|
SELECT DISTINCT trainee_country FROM trainings WHERE training_provider = 'US' AND training_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 5 YEAR) AND CURDATE();
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE ticket_sales (ticket_id INT, section VARCHAR(50), price DECIMAL(5,2), quantity INT); INSERT INTO ticket_sales (ticket_id, section, price, quantity) VALUES (1, 'Section A', 50.00, 25); INSERT INTO ticket_sales (ticket_id, section, price, quantity) VALUES (2, 'Section B', 40.00, 30); INSERT INTO ticket_sales (ticket_id, section, price, quantity) VALUES (3, 'Section C', 60.00, 15);
|
What is the maximum ticket price in 'Section C' in the 'ticket_sales' table?
|
SELECT MAX(price) FROM ticket_sales WHERE section = 'Section C';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE art_pieces (art_piece_id INT, title VARCHAR(50), year_made INT, value INT, artist_id INT); INSERT INTO art_pieces (art_piece_id, title, year_made, value, artist_id) VALUES (1, 'Mona Lisa', 1503, 600000000, 1);
|
Delete art pieces produced before 1800 and update the art_pieces table.
|
DELETE FROM art_pieces WHERE art_pieces.year_made < 1800; UPDATE art_pieces SET value = value * 1.1;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE properties (id INT, size FLOAT, city VARCHAR(20)); INSERT INTO properties (id, size, city) VALUES (1, 1500, 'Madrid'), (2, 2000, 'Madrid'), (3, 1000, 'Madrid');
|
What is the total number of properties in Madrid with a size greater than 1500 square feet?
|
SELECT COUNT(*) FROM properties WHERE city = 'Madrid' AND size > 1500;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE bus_routes (route_id INT, route_name VARCHAR(255), city VARCHAR(255), fare DECIMAL(5,2));
|
What is the average fare per trip for buses in the city of Los Angeles?
|
SELECT AVG(fare) FROM bus_routes WHERE city = 'Los Angeles';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE TravelAdvisories (id INT, country VARCHAR(50), advisory VARCHAR(50), start_date DATE); INSERT INTO TravelAdvisories (id, country, advisory, start_date) VALUES (1, 'Australia', 'Stay away from beaches', '2022-01-01');
|
Delete all travel advisories for Australia in the last 6 months.
|
DELETE FROM TravelAdvisories WHERE country = 'Australia' AND start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH);
|
gretelai_synthetic_text_to_sql
|
CULTURAL_EVENTS(event_id, name, location, date, attendance)
|
Delete the records of cultural events with attendance less than 50
|
DELETE FROM CULTURAL_EVENTS WHERE attendance < 50;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE defense_contracts(id INT, company VARCHAR(50), amount INT, award_date DATE);
|
Identify the defense contracts awarded to companies located in Virginia and Maryland with an amount greater than $500,000, and their respective award dates.
|
SELECT company, amount, award_date FROM defense_contracts WHERE state IN ('Virginia', 'Maryland') AND amount > 500000;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE event_tickets (id INT, event_name VARCHAR(50), event_type VARCHAR(50), ticket_price INT, tickets_sold INT, event_date DATE);
|
What is the total ticket revenue for dance events in the past 3 years?
|
SELECT SUM(ticket_price * tickets_sold) as total_revenue FROM event_tickets WHERE event_type = 'dance' AND event_date >= DATEADD(year, -3, GETDATE());
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Sites (site_id INT, site_name TEXT, num_artifacts INT); INSERT INTO Sites (site_id, site_name, num_artifacts) VALUES (1, 'SiteA', 60), (2, 'SiteB', 40), (3, 'SiteC', 55);
|
What is the name of the site with the most artifacts?
|
SELECT site_name FROM Sites WHERE num_artifacts = (SELECT MAX(num_artifacts) FROM Sites);
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE shariah_compliant_loans_2 (bank VARCHAR(255), amount DECIMAL(10,2)); INSERT INTO shariah_compliant_loans_2 (bank, amount) VALUES ('Bank X', 6000.00), ('Bank Y', 8000.00), ('Bank Z', 5000.00);
|
What is the maximum amount of Shariah-compliant loans issued by each bank?
|
SELECT bank, MAX(amount) FROM (SELECT * FROM shariah_compliant_loans UNION ALL SELECT * FROM shariah_compliant_loans_2) GROUP BY bank;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE rural_infrastructure (id INT, country VARCHAR(255), project VARCHAR(255), cost FLOAT, year INT); INSERT INTO rural_infrastructure (id, country, project, cost, year) VALUES (1, 'Bangladesh', 'Electrification', 2000000, 2021), (2, 'Bangladesh', 'Sanitation', 1500000, 2021), (3, 'Pakistan', 'Road Construction', 3000000, 2021);
|
What was the total cost of rural infrastructure projects in Pakistan in 2021?
|
SELECT SUM(cost) FROM rural_infrastructure WHERE country = 'Pakistan' AND year = 2021;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Contract_Negotiations (contractor VARCHAR(255), region VARCHAR(255), equipment VARCHAR(255), price DECIMAL(10,2), negotiation_date DATE);
|
What is the maximum sale price of naval equipment negotiated by VWX Corp with countries in the Asian region?
|
SELECT MAX(price) FROM Contract_Negotiations WHERE contractor = 'VWX Corp' AND region = 'Asia' AND equipment = 'naval';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Disability_Support_Programs (student_id INT, program VARCHAR(255), enrollment_year INT); INSERT INTO Disability_Support_Programs VALUES (1, 'Sign Language Interpretation', 2022);
|
What is the number of students enrolled in Sign Language Interpretation support program in 2022?
|
SELECT COUNT(DISTINCT student_id) FROM Disability_Support_Programs WHERE program = 'Sign Language Interpretation' AND enrollment_year = 2022;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE projects(id INT, project VARCHAR(50), start_date DATE, end_date DATE, completed BOOLEAN);
|
How many defense projects were completed in H1 2022?
|
SELECT COUNT(*) FROM projects WHERE start_date BETWEEN '2022-01-01' AND '2022-06-30' AND completed = TRUE;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE property (id INT, price FLOAT, neighborhood VARCHAR(20)); INSERT INTO property VALUES (1, 500000, 'urban');
|
What is the average property price in the 'urban' neighborhood?
|
SELECT AVG(price) FROM property WHERE neighborhood = 'urban';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE esports_teams (team_id INT, team_name TEXT, region TEXT); INSERT INTO esports_teams (team_id, team_name, region) VALUES (1, 'Team Liquid', 'North America'), (2, 'G2 Esports', 'Europe'), (3, 'T1', 'Asia');
|
Delete records from the 'esports_teams' table where the team is not from 'North America' or 'Europe'
|
WITH non_na_eu_teams AS (DELETE FROM esports_teams WHERE region NOT IN ('North America', 'Europe') RETURNING *) SELECT * FROM non_na_eu_teams;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE TourismRevenue (Country VARCHAR(255), Revenue INT, RevenueDate DATE);
|
What is the change in international tourism revenue for each country in the last 2 years?
|
SELECT Country, (Revenue - LAG(Revenue) OVER (PARTITION BY Country ORDER BY RevenueDate)) / ABS(LAG(Revenue) OVER (PARTITION BY Country ORDER BY RevenueDate)) AS Increase FROM TourismRevenue WHERE RevenueDate >= ADD_MONTHS(CURRENT_DATE, -24) AND RevenueDate < CURRENT_DATE GROUP BY Country;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE sales (product_category VARCHAR(255), sale_date DATE, sales DECIMAL(10, 2)); INSERT INTO sales (product_category, sale_date, sales) VALUES ('Category A', '2023-01-02', 3000), ('Category B', '2023-03-05', 4000), ('Category A', '2023-01-10', 2000), ('Category C', '2023-02-15', 3500);
|
What is the total sales revenue for each product category in Q1 2023, ranked by revenue?
|
SELECT product_category, SUM(sales) as total_sales FROM sales WHERE sale_date BETWEEN '2023-01-01' AND '2023-03-31' GROUP BY product_category ORDER BY total_sales DESC;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Organic_Farms (Farm_ID INT, Crop_Name VARCHAR(50), Production INT, Year INT, Region VARCHAR(50));
|
What is the total production of crops in organic farms in 2020, grouped by region?
|
SELECT Region, SUM(Production) FROM Organic_Farms WHERE Year = 2020 GROUP BY Region;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE production (year INT, element VARCHAR(10), quantity INT); INSERT INTO production (year, element, quantity) VALUES (2018, 'Neodymium', 5000), (2019, 'Neodymium', 5500), (2020, 'Neodymium', 6000), (2021, 'Neodymium', 6500), (2018, 'Dysprosium', 3000), (2019, 'Dysprosium', 3500), (2020, 'Dysprosium', 4000), (2021, 'Dysprosium', 4500);
|
What is the total production of all rare earth elements in 2020?
|
SELECT SUM(quantity) FROM production WHERE year = 2020;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE element_quantity (element VARCHAR(10), year INT, quantity INT); INSERT INTO element_quantity (element, year, quantity) VALUES ('Dy', 2017, 1200), ('Tm', 2017, 800), ('Er', 2017, 1000), ('Yb', 2017, 1500);
|
What is the total quantity of each element produced in 2017?
|
SELECT eq.element, SUM(eq.quantity) as total_quantity FROM element_quantity eq WHERE eq.year = 2017 GROUP BY eq.element;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Organic_Sales (order_id INT, item VARCHAR(50), price DECIMAL(10,2), is_organic BOOLEAN);
|
What is the total revenue generated from organic food sales?
|
SELECT SUM(price) FROM Organic_Sales WHERE is_organic = TRUE;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE product (product_id INT, name TEXT, price FLOAT, cruelty_free BOOLEAN, vegan BOOLEAN); CREATE TABLE sales (sale_id INT, product_id INT, quantity INT);
|
What is the total revenue for cosmetics products that are both cruelty-free and vegan?
|
SELECT SUM(price * quantity) FROM product INNER JOIN sales ON product.product_id = sales.product_id WHERE cruelty_free = TRUE AND vegan = TRUE;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Brands (id INT, brand VARCHAR(255)); INSERT INTO Brands (id, brand) VALUES (1, 'BrandA'), (2, 'BrandB'), (3, 'BrandC'); CREATE TABLE Products (id INT, product VARCHAR(255), category VARCHAR(255), brand_id INT, labor_practice_rating DECIMAL(3, 2)); INSERT INTO Products (id, product, category, brand_id, labor_practice_rating) VALUES (1, 'Product1', 'CategoryA', 1, 4.50), (2, 'Product2', 'CategoryA', 1, 4.75), (3, 'Product3', 'CategoryB', 2, 3.25), (4, 'Product4', 'CategoryB', 2, 3.50), (5, 'Product5', 'CategoryC', 3, 4.00), (6, 'Product6', 'CategoryC', 3, 4.25);
|
What is the maximum labor practice rating for products in each category, by brand?
|
SELECT b.brand, p.category, MAX(p.labor_practice_rating) AS max_rating FROM Products p JOIN Brands b ON p.brand_id = b.id GROUP BY b.brand, p.category;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE vessel_performance ( vessel_name VARCHAR(255), measurement_date DATE, measurement_value INT);
|
Delete records in the vessel_performance table where the vessel_name is 'Blue Horizon' and the measurement_value is greater than 80
|
DELETE FROM vessel_performance WHERE vessel_name = 'Blue Horizon' AND measurement_value > 80;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Labor_Statistics (labor_id INT, hourly_wage FLOAT, building_type VARCHAR(20)); INSERT INTO Labor_Statistics VALUES (1, 30.50, 'Residential'), (2, 35.00, 'Commercial'), (3, 28.75, 'Residential'), (4, 40.00, 'Industrial');
|
Find the top 3 construction labor statistics by hourly wage, partitioned by building type in descending order.
|
SELECT building_type, hourly_wage, RANK() OVER (PARTITION BY building_type ORDER BY hourly_wage DESC) as wage_rank FROM Labor_Statistics WHERE wage_rank <= 3;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE if not exists peace_operations (id INT, operation_name VARCHAR(100), location VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO peace_operations (id, operation_name, location, start_date, end_date) VALUES (1, 'UNTAC', 'Cambodia', '1992-11-15', '1993-09-30'); INSERT INTO peace_operations (id, operation_name, location, start_date, end_date) VALUES (2, 'MINUSCA', 'Central African Republic', '2014-04-10', '');
|
What are the peace operations in Colombia with their start dates?
|
SELECT operation_name, location, start_date FROM peace_operations WHERE location = 'Colombia';
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE application_data (id INT PRIMARY KEY, application_name VARCHAR(100), model_id INT, safety_score DECIMAL(5,4), application_type VARCHAR(50), launched_date DATE); INSERT INTO application_data (id, application_name, model_id, safety_score, application_type, launched_date) VALUES (1, 'App1', 1, 0.9123, 'Mobile', '2021-02-01'), (2, 'App2', 2, 0.7654, 'Web', '2021-03-01'), (3, 'App3', 3, 0.8888, 'Mobile', '2021-04-01');
|
Delete applications that have a safety score lower than 0.85.
|
DELETE FROM application_data WHERE safety_score < 0.85;
|
gretelai_synthetic_text_to_sql
|
CREATE TABLE Artists (ArtistID INT PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(100), Genre VARCHAR(50));
|
Update the artist 'Emma Johnson' genre to 'Pop'
|
UPDATE Artists SET Genre = 'Pop' WHERE Name = 'Emma Johnson';
|
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.