context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE vessels(id INT, name TEXT, speed FLOAT, longitude FLOAT, latitude FLOAT); INSERT INTO vessels VALUES (1, 'VesselA', 20.5, 139.6917, 35.6895), (5, 'VesselE', 15.3, 131.0414, -33.8568); | What is the average speed of all vessels near the coast of Australia? | SELECT AVG(speed) FROM vessels WHERE longitude BETWEEN 112.9093 AND 153.6381 AND latitude BETWEEN -43.8337 AND -9.1552; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID int, ProjectName varchar(50), ProjectType varchar(50), StartDate date, EndDate date); INSERT INTO Projects (ProjectID, ProjectName, ProjectType, StartDate, EndDate) VALUES (1, 'Food Distribution', 'Food Assistance', '2021-01-01', '2022-06-30'), (2, 'School Meals', 'Food Assistance', '20... | What is the total number of food assistance projects completed in the last 18 months in Latin America? | SELECT COUNT(ProjectID) as CompletedProjects FROM Projects WHERE ProjectType = 'Food Assistance' AND EndDate >= DATE_SUB(CURRENT_DATE, INTERVAL 18 MONTH) AND EndDate IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, Department varchar(50), Manager varchar(50), Salary decimal(10,2)); INSERT INTO Employees (EmployeeID, Department, Manager, Salary) VALUES (1, 'Engineering', 'John Doe', 80000.00), (2, 'Marketing', 'Jane Smith', 70000.00), (3, 'Sales', 'Bob Johnson', 75000.00); | What is the total salary expense for each department, grouped by the manager of each department? | SELECT e.Manager, e.Department, SUM(e.Salary) as SalaryExpense FROM Employees e GROUP BY e.Manager, e.Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_id INTEGER, area_name TEXT, ocean_basin TEXT); | Identify the top 5 ocean basins with the most marine protected areas. | SELECT ocean_basin, COUNT(area_id) FROM marine_protected_areas GROUP BY ocean_basin ORDER BY COUNT(area_id) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (CHWId INT, City VARCHAR(255), Language VARCHAR(255)); INSERT INTO CommunityHealthWorkers (CHWId, City, Language) VALUES (1, 'Los Angeles', 'Spanish'); INSERT INTO CommunityHealthWorkers (CHWId, City, Language) VALUES (2, 'New York', 'English'); INSERT INTO CommunityHealthWorkers (CH... | Show the number of community health workers who speak each language by city. | SELECT City, Language, COUNT(*) FROM CommunityHealthWorkers GROUP BY City, Language; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (id INT, strain VARCHAR(255), added_date DATE); | Insert a new record into the Inventory table for the 'OG Kush' strain with an added date of 2021-07-01. | INSERT INTO Inventory (strain, added_date) VALUES ('OG Kush', '2021-07-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_categories (category_id INT, category_name TEXT); INSERT INTO artifact_categories (category_id, category_name) VALUES (1, 'Pottery'), (2, 'Stone Tools'), (3, 'Jewelry'); CREATE TABLE artifacts (artifact_id INT, site_id INT, category_id INT, length FLOAT, width FLOAT, height FLOAT); INSERT INTO art... | What are the average dimensions of each artifact category in the 'Mexico' excavation sites? | SELECT category_name, AVG(length) as avg_length, AVG(width) as avg_width, AVG(height) as avg_height FROM artifacts a JOIN excavation_sites s ON a.site_id = s.site_id WHERE s.country = 'Mexico' GROUP BY category_name; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA PrecisionFarming; CREATE TABLE IoT_Sensors (sensor_id INT, sensor_name VARCHAR(50), measurement VARCHAR(50)); INSERT INTO PrecisionFarming.IoT_Sensors (sensor_id, sensor_name, measurement) VALUES (1, 'Sensor1', 'temperature'), (2, 'Sensor2', 'humidity'), (4, 'Sensor4', 'moisture'); | List the number of IoT sensors in the 'PrecisionFarming' schema that have a 'moisture' measurement. | SELECT COUNT(*) FROM PrecisionFarming.IoT_Sensors WHERE measurement = 'moisture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_tracking (cargo_id INT, cargo_type VARCHAR(255), weight INT); | List the total cargo weight for each cargo type in the 'cargo_tracking' table | SELECT cargo_type, SUM(weight) FROM cargo_tracking GROUP BY cargo_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_stats (union_name TEXT, region TEXT, members INTEGER); INSERT INTO union_stats (union_name, region, members) VALUES ('Union A', 'north_region', 4000), ('Union B', 'south_region', 2000), ('Union C', 'north_region', 6000); | List the union membership statistics for unions in the 'north_region' that have more than 3000 members? | SELECT union_name, members FROM union_stats WHERE region = 'north_region' AND members > 3000; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_record (product_id INT, report_date DATE, report_status TEXT); | Delete all records from the 'safety_record' table that have a 'report_date' before 2020-01-01 | DELETE FROM safety_record WHERE report_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MaterialProduction (item_id INT, country VARCHAR(255), material VARCHAR(255), weight DECIMAL(5,2)); INSERT INTO MaterialProduction (item_id, country, material, weight) VALUES (1, 'Spain', 'Cotton', 2.5), (1, 'Italy', 'Polyester', 1.5), (2, 'France', 'Wool', 3.0), (3, 'Spain', 'Silk', 4.0), (4, 'Italy', 'Co... | What is the total weight of materials used in each country's production? | SELECT country, SUM(weight) FROM MaterialProduction GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, country VARCHAR(50)); INSERT INTO wells (well_id, country) VALUES (1, 'Saudi Arabia'), (2, 'Iran'), (3, 'Iraq'); | Compare the number of wells drilled in Saudi Arabia and Iran. | SELECT 'Saudi Arabia' as country, COUNT(*) as num_wells FROM wells WHERE country = 'Saudi Arabia' UNION ALL SELECT 'Iran' as country, COUNT(*) as num_wells FROM wells WHERE country = 'Iran'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendor_contracts (vendor_id INT, vendor_name VARCHAR(50), contract_id INT, contract_value DECIMAL(10,2)); | Update the vendor_contracts table to set the 'contract_value' to NULL for any contract with 'vendor_name' = 'ABC Defense' | UPDATE vendor_contracts SET contract_value = NULL WHERE vendor_name = 'ABC Defense'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name TEXT, country TEXT); INSERT INTO suppliers (id, name, country) VALUES (1, 'Green Garden', 'France'); INSERT INTO suppliers (id, name, country) VALUES (2, 'SunRise', 'Italy'); INSERT INTO suppliers (id, name, country) VALUES (3, 'Local Farms', 'USA'); | Which suppliers in the suppliers table are not from the USA? | SELECT name FROM suppliers WHERE country != 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections (location VARCHAR(255), inspection_date DATE, critical_violations INT); INSERT INTO food_safety_inspections (location, inspection_date, critical_violations) VALUES ('Location A', '2022-01-01', 1), ('Location B', '2022-01-02', 0), ('Location A', '2022-01-03', 1), ('Location C', '2022... | What is the percentage of food safety inspections with critical violations for each location in the past year? | SELECT location, (SUM(critical_violations) * 100.00 / COUNT(*)) as percentage_critical_violations FROM food_safety_inspections WHERE inspection_date BETWEEN DATEADD(year, -1, GETDATE()) AND GETDATE() GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation(region VARCHAR(20), year INT, waste_gram INT); INSERT INTO waste_generation(region, year, waste_gram) VALUES('North', 2021, 50000),('North', 2022, 60000),('South', 2021, 40000),('South', 2022, 70000); | Update the waste generation for region 'South' in the year 2022 to 75000 gram. | UPDATE waste_generation SET waste_gram = 75000 WHERE region = 'South' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, project_name VARCHAR(255), budget INT, country VARCHAR(255)); | Delete records with a budget under 50000 in the 'community_development' table | DELETE FROM community_development WHERE budget < 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerVR (PlayerID INT, Region VARCHAR(50)); INSERT INTO PlayerVR (PlayerID, Region) VALUES (1, 'North America'), (2, 'Europe'), (3, 'Asia'), (4, 'South America'), (5, 'Europe'), (6, 'North America'), (7, 'Asia'), (8, 'North America'), (9, 'Europe'), (10, 'Asia'); CREATE TABLE PlayerActivity (PlayerID IN... | What is the percentage of players who have played a VR game in each region? | SELECT Region, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM PlayerVR) as Percentage FROM PlayerVR INNER JOIN PlayerActivity ON PlayerVR.PlayerID = PlayerActivity.PlayerID WHERE VRGame = 1 GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), size FLOAT); | Update the location of the Giant Panda habitat | UPDATE habitats SET location = 'China' WHERE name = 'Giant Panda Habitat'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(255), founder VARCHAR(255), founder_gender VARCHAR(10)); INSERT INTO company (id, name, founder, founder_gender) VALUES (1, 'Acme Inc', 'Alex', 'male'), (2, 'Beta Corp', 'Jasmine', 'female'); | How many female and male founders are there in total? | SELECT founder_gender, COUNT(*) FROM company GROUP BY founder_gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_records (record_id INT, vessel_name VARCHAR(50), incidents INT); INSERT INTO safety_records (record_id, vessel_name, incidents) VALUES (1, 'VesselA', 2), (2, 'VesselB', 1), (3, 'VesselC', 3); | What is the total number of safety incidents in the 'safety_records' table? | SELECT SUM(incidents) FROM safety_records; | gretelai_synthetic_text_to_sql |
CREATE TABLE Funding (FundingID INT, Initiative VARCHAR(255), Country VARCHAR(255), FundingAmount INT, PRIMARY KEY (FundingID)); | Rank the language preservation initiatives in Europe by their total funding, with the highest funded initiative first. | SELECT Initiative, FundingAmount FROM (SELECT Initiative, Country, FundingAmount, ROW_NUMBER() OVER (ORDER BY FundingAmount DESC) AS Rank FROM Funding WHERE Country = 'Europe') AS FundingRanks WHERE Rank = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE album_sales (artist_id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(2), sales INT); INSERT INTO album_sales (artist_id, name, country, sales) VALUES (1, 'Talyor Swift', 'USA', 3000000), (2, 'Adele', 'UK', 2500000), (3, 'Post Malone', 'USA', 2200000); | Who are the top 3 music artists by album sales in the US? | SELECT * FROM album_sales WHERE country = 'USA' ORDER BY sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); INSERT INTO mines (id, name, location) VALUES (1, 'Bakcharskoye', 'Russia'); INSERT INTO mines (id, name, location) VALUES (2, 'Maly Alluai', 'Russia'); CREATE TABLE environmental_impact (id INT PRIMARY KEY, mine_id INT, pollution_level ... | Which mines in the Ural Mountains have a cleanup cost greater than 15000? | SELECT m.name, e.cleanup_cost FROM mines m JOIN environmental_impact e ON m.id = e.mine_id WHERE m.location = 'Ural Mountains' GROUP BY m.name HAVING e.cleanup_cost > 15000; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouses (warehouse_id INT, warehouse_name VARCHAR(255)); INSERT INTO warehouses (warehouse_id, warehouse_name) VALUES (1, 'Warehouse A'); CREATE TABLE shipments (shipment_id INT, warehouse_id INT, country VARCHAR(255)); INSERT INTO shipments (shipment_id, warehouse_id, country) VALUES (1, 1, 'Mexico'); | What is the total number of packages shipped from warehouse A to country Mexico? | SELECT COUNT(*) FROM shipments s JOIN warehouses w ON s.warehouse_id = w.warehouse_id WHERE w.warehouse_name = 'Warehouse A' AND s.country = 'Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (activity VARCHAR(50), co2_emission INT); INSERT INTO co2_emissions (activity, co2_emission) VALUES ('Gold mining', 120000), ('Silver mining', 85000), ('Iron ore mining', 300000), ('Coal mining', 520000), ('Copper mining', 155000), ('Zinc mining', 75000); | Calculate the total CO2 emissions from all mining activities in 2020. | SELECT SUM(co2_emission) FROM co2_emissions WHERE activity IN ('Gold mining', 'Silver mining', 'Iron ore mining', 'Coal mining', 'Copper mining', 'Zinc mining'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, organization_id INT, donation_amount FLOAT); CREATE TABLE organizations (id INT, name TEXT, cause_area TEXT); | What's the average donation amount for each cause area, excluding any donations less than $100? | SELECT o.cause_area, AVG(donations.donation_amount) as avg_donation_amount FROM donations INNER JOIN organizations o ON donations.organization_id = o.id WHERE donations.donation_amount >= 100 GROUP BY o.cause_area; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_libraries (library_name TEXT, state TEXT, budget INTEGER); INSERT INTO public_libraries (library_name, state, budget) VALUES ('Library A', 'NY', 500000), ('Library B', 'NY', 600000), ('Library C', 'CA', 400000); | What is the average budget allocated to public libraries in the state of New York? | SELECT AVG(budget) FROM public_libraries WHERE state = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor (location TEXT, depth INT); INSERT INTO ocean_floor (location, depth) VALUES ('Arctic Ocean - A', 3500), ('Arctic Ocean - B', 2000), ('Arctic Ocean - C', 4500), ('Arctic Ocean - D', 3000); | What is the average depth of the ocean floor in the Arctic Ocean, excluding areas deeper than 4000 meters? | SELECT AVG(depth) FROM ocean_floor WHERE ocean = 'Arctic Ocean' AND depth < 4000; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_demographics (player_id INT, age INT, gender VARCHAR(50)); INSERT INTO player_demographics (player_id, age, gender) VALUES (1, 25, 'Male'), (2, 35, 'Female'), (3, 17, 'Female'); | Insert a new record into the "player_demographics" table with player_id 4, age 22, and gender "Non-binary" | INSERT INTO player_demographics (player_id, age, gender) VALUES (4, 22, 'Non-binary'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (policy_id INT, policyholder_state VARCHAR(20)); | Update policy records for policyholders with policy_id 101, 102, and 103 in the 'Policy' table. | UPDATE Policy SET policyholder_state = 'NY' WHERE policy_id IN (101, 102, 103); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donation_amount DECIMAL(10,2), program_id INT, donation_date DATE); INSERT INTO donations (donation_id, donation_amount, program_id, donation_date) VALUES (1, 50.00, 1, '2021-01-01'), (2, 100.00, 2, '2021-02-01'), (3, 75.00, 1, '2021-03-01'); | What is the average donation amount by program in Q1 2021? | SELECT program_id, AVG(donation_amount) as avg_donation FROM donations WHERE QUARTER(donation_date) = 1 AND YEAR(donation_date) = 2021 GROUP BY program_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellite_Table (id INT, launch_date DATE, satellite_name VARCHAR(100)); | How many satellites were launched in each year from the Satellite_Table? | SELECT YEAR(LAUNCH_DATE), COUNT(*) FROM Satellite_Table GROUP BY YEAR(LAUNCH_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_accommodations_australia (id INT, country VARCHAR(50), rating DECIMAL(2,1)); INSERT INTO eco_accommodations_australia (id, country, rating) VALUES (1, 'Australia', 4.2), (2, 'Australia', 4.5), (3, 'Australia', 4.8); | What is the minimum rating of eco-friendly accommodations in Australia? | SELECT MIN(rating) FROM eco_accommodations_australia WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (item_id INT, item_name VARCHAR(50), quantity INT, warehouse_id INT); | Show the average quantity of all items in the Inventory table | SELECT AVG(quantity) FROM Inventory; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, contract_value FLOAT, contract_description TEXT, vendor_name TEXT, agency_name TEXT); INSERT INTO defense_contracts (contract_id, contract_value, contract_description, vendor_name, agency_name) VALUES (1, 75000000, 'Aircraft maintenance services', 'ABC Aerospace', 'US Ai... | Which defense contracts have a total value greater than $50,000,000? | SELECT contract_id, contract_value, contract_description, vendor_name, agency_name FROM defense_contracts WHERE contract_value > 50000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE justice_data.court_cases (id INT, case_number INT, filing_date DATE, charge_count INT, offense VARCHAR(50)); | How many distinct offenses are present in the justice_data schema's court_cases table, and what is the maximum number of charges filed in a single case? | SELECT COUNT(DISTINCT offense), MAX(charge_count) FROM justice_data.court_cases; | gretelai_synthetic_text_to_sql |
CREATE TABLE fare_collection (id INT, trip_id INT, mode VARCHAR(10), fare DECIMAL(5,2)); INSERT INTO fare_collection (id, trip_id, mode, fare) VALUES (1, 1, 'bus', 2.50), (2, 2, 'metro', 3.00), (3, 1, 'train', 5.00); | What is the total fare collected for each mode of transportation, for the last year, ordered by the least profitable mode? | SELECT SUM(fare) OVER (PARTITION BY mode ORDER BY SUM(fare) ASC) as total_fare, mode FROM fare_collection WHERE trip_date >= DATEADD(year, -1, GETDATE()) GROUP BY mode; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_representatives (rep_id INT, rep_name TEXT, region TEXT, quarter INT, total_sales FLOAT); INSERT INTO sales_representatives (rep_id, rep_name, region, quarter, total_sales) VALUES (2001, 'RepA', 'Asia-Pacific', 1, 1500000), (2002, 'RepB', 'Asia-Pacific', 1, 1800000), (2003, 'RepC', 'US', 1, 1200000),... | Who are the top 2 sales representatives by total sales in the Asia-Pacific region in Q1 2021? | SELECT rep_name, SUM(total_sales) AS total_sales FROM sales_representatives WHERE region = 'Asia-Pacific' AND quarter = 1 GROUP BY rep_name ORDER BY total_sales DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE DonorAge (DonorID INT, DonationYear INT, DonorAge INT, DonationAmount DECIMAL(10,2), DonationCause VARCHAR(50)); INSERT INTO DonorAge (DonorID, DonationYear, DonorAge, DonationAmount, DonationCause) VALUES (1, 2022, 35, 100.00, 'Education'), (2, 2022, 45, 200.00, 'Health'), (3, 2022, 32, 150.00, 'Environme... | Which causes received the most funding from donors aged 30-40 in 2022? | SELECT DonationCause, SUM(DonationAmount) as TotalDonations FROM DonorAge WHERE DonationYear = 2022 AND DonorAge BETWEEN 30 AND 40 GROUP BY DonationCause ORDER BY TotalDonations DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, country TEXT); INSERT INTO countries (country_id, country) VALUES (1, 'Canada'); CREATE TABLE cultural_events (event_id INT, country_id INT, economic_impact FLOAT); INSERT INTO cultural_events (event_id, country_id, economic_impact) VALUES (1, 1, 200.0), (2, 1, 250.0), (3, 1, 300... | What is the average economic impact of cultural events in Canada? | SELECT AVG(economic_impact) FROM cultural_events WHERE country_id = (SELECT country_id FROM countries WHERE country = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE editors (id INT, name VARCHAR(50), gender VARCHAR(10), age INT, experience INT); INSERT INTO editors (id, name, gender, age, experience) VALUES (1, 'John Doe', 'Male', 55, 15); INSERT INTO editors (id, name, gender, age, experience) VALUES (2, 'Jim Brown', 'Male', 50, 12); INSERT INTO editors (id, name, ge... | What is the name and age of the oldest editor in the 'editors' table? | SELECT name, age FROM editors ORDER BY age DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE RepresentationIssues (ID INT, Issue TEXT, Date DATE); INSERT INTO RepresentationIssues (ID, Issue, Date) VALUES (1, 'Gender', '2022-01-01'), (2, 'Race', '2022-01-05'), (3, 'Gender', '2022-01-07'); | Identify the most common media representation issue in the past month. | SELECT Issue, COUNT(*) as Count FROM RepresentationIssues WHERE Date >= DATEADD(month, -1, CURRENT_DATE) GROUP BY Issue ORDER BY Count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Smoking (Country TEXT, Smokers INT, Total INT); INSERT INTO Smoking (Country, Smokers, Total) VALUES ('Australia', 1500, 5000), ('Australia', 2000, 5000); | What is the percentage of smokers in Australia? | SELECT (Smokers / Total) * 100 FROM Smoking WHERE Country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Incidents (id INT PRIMARY KEY, incident_type VARCHAR(50), response_time TIME); INSERT INTO Incidents (id, incident_type, response_time) VALUES (1, 'Theft', '00:15:00'), (2, 'Burglary', '00:20:00'); | What is the average response time for theft incidents? | SELECT AVG(response_time) FROM Incidents WHERE incident_type = 'Theft'; | gretelai_synthetic_text_to_sql |
CREATE TABLE f1_wins (driver VARCHAR(100), races_won INT); INSERT INTO f1_wins (driver, races_won) VALUES ('Lewis Hamilton', 103), ('Michael Schumacher', 91); | What is the total number of races won by Lewis Hamilton in Formula 1? | SELECT SUM(races_won) FROM f1_wins WHERE driver = 'Lewis Hamilton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_investments (id INT, city VARCHAR(255), investment FLOAT); CREATE VIEW city_populations AS SELECT city, population FROM city_data; | What is the maximum smart city technology investment for cities with a population greater than 1 million? | SELECT city, MAX(investment) FROM smart_city_investments JOIN city_populations ON smart_city_investments.city = city_populations.city WHERE population > 1000000 GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, location TEXT, founder_disability BOOLEAN); INSERT INTO startups (id, name, location, founder_disability) VALUES (1, 'Startup A', 'USA', true); INSERT INTO startups (id, name, location, founder_disability) VALUES (2, 'Startup B', 'Canada', false); INSERT INTO startups (id, name... | How many startups were founded by people with disabilities? | SELECT COUNT(*) FROM startups WHERE founder_disability = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Movies (title VARCHAR(255), release_year INT, genre VARCHAR(50), budget INT); | What's the average budget of Bollywood movies released in 2020? | SELECT AVG(budget) FROM Movies WHERE genre = 'Bollywood' AND release_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE MobileSubscribers (SubscriberID int, Country varchar(10), BillingIssue bit); INSERT INTO MobileSubscribers (SubscriberID, Country, BillingIssue) VALUES (1, 'USA', 0), (2, 'Canada', 1), (3, 'Mexico', 0), (4, 'Brazil', 1), (5, 'Argentina', 0); | Display the number of mobile subscribers in each country, excluding those who have had billing issues in the past year. | SELECT Country, COUNT(*) FROM MobileSubscribers WHERE BillingIssue = 0 GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (id INT, country VARCHAR(20), visitor_count INT); INSERT INTO Visitors (id, country, visitor_count) VALUES (1, 'Egypt', 100), (2, 'Nigeria', 200), (3, 'South Africa', 150), (4, 'USA', 250); | Determine the total number of visitors from African countries. | SELECT SUM(visitor_count) FROM Visitors WHERE country IN ('Egypt', 'Nigeria', 'South Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name VARCHAR(100), location VARCHAR(100), renewable_energy_focus BOOLEAN); CREATE TABLE workers (worker_id INT, factory_id INT, name VARCHAR(100), position VARCHAR(100)); INSERT INTO factories (factory_id, name, location, renewable_energy_focus) VALUES (1, 'Eco-Friendly Factory',... | What is the total number of workers employed in factories with a focus on renewable energy? | SELECT COUNT(workers.worker_id) FROM factories INNER JOIN workers ON factories.factory_id = workers.factory_id WHERE factories.renewable_energy_focus = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE PollutionSources (id INT, source_name VARCHAR(255), emission_type VARCHAR(255), emission_quantity INT, last_inspection DATE); | What is the maximum emission quantity for each emission type in pollution sources that have not been inspected in the last 6 months? | SELECT emission_type, MAX(emission_quantity) FROM PollutionSources WHERE last_inspection <= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) GROUP BY emission_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicWorks (ProjectID int, Name varchar(50)); CREATE TABLE DesignStandards (StandardID int, ProjectID int, Description varchar(50)); INSERT INTO PublicWorks (ProjectID, Name) VALUES (1, 'Road Reconstruction'), (2, 'Bridge Building'); INSERT INTO DesignStandards (StandardID, ProjectID, Description) VALUES ... | List all public works projects with their respective design standards. | SELECT PublicWorks.Name, DesignStandards.Description FROM PublicWorks INNER JOIN DesignStandards ON PublicWorks.ProjectID = DesignStandards.ProjectID; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiplomacyEvents(Country NVARCHAR(50), EventType VARCHAR(50), Year INT);INSERT INTO DiplomacyEvents(Country, EventType, Year) VALUES ('United States', 'Military Exercise', 2010), ('China', 'Military Exercise', 2010), ('United States', 'Military Exercise', 2011), ('China', 'Military Exercise', 2011), ('Unite... | What is the rank of defense diplomacy events by country based on frequency? | SELECT Country, RANK() OVER(ORDER BY COUNT(*) DESC) AS Event_Rank FROM DiplomacyEvents WHERE EventType = 'Military Exercise' OR EventType = 'Defense Talks' OR EventType = 'Joint Military Training' GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_manufacturing (id INT, manufacturer VARCHAR, spacecraft VARCHAR, launch_date DATE); | What is the earliest launch date for each spacecraft manufacturer? | SELECT manufacturer, MIN(launch_date) as earliest_launch_date FROM spacecraft_manufacturing GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE discoveries (id INT, name VARCHAR(255), company VARCHAR(255), year INT); INSERT INTO discoveries (id, name, company, year) VALUES (1, 'Discovery1', 'SpaceX', 2021); INSERT INTO discoveries (id, name, company, year) VALUES (2, 'Discovery2', 'Blue Origin', 2022); | What is the total number of scientific discoveries made by private space companies? | SELECT COUNT(*) FROM discoveries WHERE company IN ('SpaceX', 'Blue Origin'); | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (song_id INT, title VARCHAR(255), release_year INT, genre VARCHAR(50), length FLOAT); INSERT INTO songs (song_id, title, release_year, genre, length) VALUES (1, 'Song1', 1985, 'classical', 120.5), (2, 'Song2', 1988, 'jazz', 210.3), (3, 'Song3', 1975, 'rock', 180.7), (4, 'Song4', 1989, 'classical', 20... | How many unique genres of songs were released before 1990? | SELECT COUNT(DISTINCT genre) FROM songs WHERE release_year < 1990; | gretelai_synthetic_text_to_sql |
CREATE TABLE conditions (condition_id INT, condition VARCHAR(50)); INSERT INTO conditions (condition_id, condition) VALUES (1, 'Depression'), (2, 'Anxiety'), (3, 'Bipolar Disorder'); CREATE TABLE patients (patient_id INT, condition_id INT); INSERT INTO patients (patient_id, condition_id) VALUES (1, 1), (2, 2), (3, 2), ... | Rank the mental health conditions by the number of patients treated. | SELECT conditions.condition, ROW_NUMBER() OVER(ORDER BY COUNT(patients.condition_id) DESC) AS rank FROM conditions INNER JOIN patients ON conditions.condition_id = patients.condition_id GROUP BY conditions.condition; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductInventory (product_id INT, product_name TEXT, category TEXT, is_natural BOOLEAN, country TEXT); CREATE VIEW CanadianNaturalCosmetics AS SELECT * FROM ProductInventory WHERE category = 'cosmetics' AND is_natural = TRUE AND country = 'Canada'; | What is the market share of natural cosmetics in the Canadian market? | SELECT 100.0 * COUNT(*) / (SELECT COUNT(*) FROM ProductInventory WHERE country = 'Canada') as market_share FROM CanadianNaturalCosmetics; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, state VARCHAR(20), name VARCHAR(30)); INSERT INTO hospitals (id, state, name) VALUES (1, 'California', 'Hospital A'), (2, 'California', 'Hospital B'), (3, 'Texas', 'Hospital C'); | How many hospitals are there in each state of the United States? | SELECT state, COUNT(*) FROM hospitals GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, mine_id INT, year INT, product TEXT, production_volume INT); INSERT INTO production (id, mine_id, year, product, production_volume) VALUES (1, 1, 2019, 'Uranium', 5000); | What is the total production volume of uranium in Canada for the year 2019? | SELECT SUM(production_volume) FROM production WHERE year = 2019 AND product = 'Uranium' AND mine_id IN (SELECT id FROM mines WHERE location = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE miners (id INT, gender TEXT, is_full_time BOOLEAN, salary FLOAT); INSERT INTO miners (id, gender, is_full_time, salary) VALUES (1, 'Male', TRUE, 75000.0), (2, 'Female', TRUE, 72000.0); | What is the average salary of full-time employees by gender in the mining industry? | SELECT gender, AVG(salary) FROM miners WHERE is_full_time = TRUE GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, field VARCHAR(50), region VARCHAR(50), drill_year INT, production_oil FLOAT, production_gas FLOAT); INSERT INTO wells (well_id, field, region, drill_year, production_oil, production_gas) VALUES (1, 'Snøhvit', 'Barents Sea', 2016, 15000.0, 5000.0), (2, 'Goliat', 'Barents Sea', 2017, 8000... | How many wells were drilled in the 'Barents Sea' from 2015 to 2019? | SELECT COUNT(*) FROM wells WHERE region = 'Barents Sea' AND drill_year BETWEEN 2015 AND 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE department (id INT, name TEXT); CREATE TABLE graduate_students (id INT, department_id INT, is_international_student BOOLEAN); | What is the number of graduate students in each department who are international students? | SELECT d.name, COUNT(gs.id) FROM department d JOIN graduate_students gs ON d.id = gs.department_id WHERE gs.is_international_student = TRUE GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_sensor_data (sensor_id INT, temperature FLOAT, timestamp TIMESTAMP); INSERT INTO temperature_sensor_data (sensor_id, temperature, timestamp) VALUES (4, 27.3, '2021-01-01 10:00:00'), (5, 26.2, '2021-01-01 10:00:00'), (6, 28.1, '2021-01-01 10:00:00'); | Increase the temperature sensor readings by 2 degrees Celsius where the sensor_id is 5 | WITH updated_data AS (UPDATE temperature_sensor_data SET temperature = temperature + 2 WHERE sensor_id = 5 RETURNING *) SELECT * FROM updated_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE communities (community VARCHAR(255), eco_friendly BOOLEAN, inclusive_policy BOOLEAN); INSERT INTO communities (community, eco_friendly, inclusive_policy) VALUES ('CommunityA', true, true), ('CommunityB', false, true), ('CommunityC', true, false); | List all communities that have both eco-friendly and inclusive housing policies. | SELECT community FROM communities WHERE eco_friendly = true AND inclusive_policy = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_ethics (id INT PRIMARY KEY, principle VARCHAR(255), description TEXT, example TEXT); | Insert a new record into the "media_ethics" table with "principle" as "Independence", "description" as "Journalists should maintain independence from those they cover" | INSERT INTO media_ethics (principle, description) VALUES ('Independence', 'Journalists should maintain independence from those they cover'); | gretelai_synthetic_text_to_sql |
CREATE TABLE appliance_efficiency (id INT, country VARCHAR(255), year INT, efficiency_rating INT); INSERT INTO appliance_efficiency (id, country, year, efficiency_rating) VALUES (1, 'India', 2021, 5), (2, 'China', 2021, 6); | What was the maximum energy efficiency rating of appliances sold in India and China in 2021? | SELECT MAX(efficiency_rating) FROM appliance_efficiency WHERE country IN ('India', 'China') AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_experiences (experience_id INT, experience_name TEXT, country TEXT, occupancy_rate FLOAT); INSERT INTO virtual_experiences (experience_id, experience_name, country, occupancy_rate) VALUES (1, 'Virtual Hobbiton Tour', 'New Zealand', 0.75); INSERT INTO virtual_experiences (experience_id, experience_n... | What is the average occupancy rate of virtual tourism experiences in New Zealand? | SELECT AVG(occupancy_rate) FROM virtual_experiences WHERE country = 'New Zealand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id int, sale_region varchar(50), sale_date date, revenue int); | What is the total revenue generated from sales in each region in the last quarter? | SELECT sale_region, SUM(revenue) as total_revenue FROM sales WHERE sale_date >= DATEADD(quarter, -1, GETDATE()) GROUP BY sale_region; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_influencers (id INT, username TEXT, posts TEXT, followers INT); | Find the total number of followers for users who have posted at least once about "renewable_energy" in the "eco_influencers" table. | SELECT SUM(followers) FROM eco_influencers WHERE posts LIKE '%renewable_energy%' HAVING COUNT(*) >= 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vendors (VendorID INT, Name VARCHAR(50), Type VARCHAR(50)); INSERT INTO Vendors (VendorID, Name, Type) VALUES (1, 'GreenTruck', 'Local'); CREATE TABLE Menu (MenuID INT, Name VARCHAR(50), Type VARCHAR(50), Price DECIMAL(5,2)); INSERT INTO Menu (MenuID, Name, Type, Price) VALUES (1, 'Veggie Burger', 'Vegetar... | What is the average price of vegetarian dishes offered by local vendors? | SELECT AVG(Price) FROM Menu INNER JOIN Vendors ON Menu.VendorID = Vendors.VendorID WHERE Menu.Type = 'Vegetarian' AND Vendors.Type = 'Local'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Labor_Violations (violation_id INT, country VARCHAR(50), violation_date DATE); | How many labor violations have been reported in each country for the past year? | SELECT Labor_Violations.country, COUNT(*) as total_violations FROM Labor_Violations WHERE violation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY Labor_Violations.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE wildlife_habitat(type VARCHAR(255), count INT); INSERT INTO wildlife_habitat(type, count) VALUES ('Forest', 300), ('Wetland', 200), ('Grassland', 150), ('Desert', 50); | What is the total number of wildlife habitats for the entire dataset? | SELECT SUM(count) FROM wildlife_habitat; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, name VARCHAR(50), ocean VARCHAR(50), population INT); | What is the total number of marine species found in the Arctic ocean?' | SELECT SUM(population) AS total_species FROM marine_species WHERE ocean = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (id INT, name VARCHAR(255), cuisine_type VARCHAR(255)); INSERT INTO Restaurants (id, name, cuisine_type) VALUES (1, 'Restaurant A', 'Cuisine Type A'), (2, 'Restaurant B', 'Cuisine Type B'); | What is the total revenue for 'Cuisine Type A' dishes? | SELECT SUM(revenue) FROM Sales WHERE dish_type = (SELECT id FROM Restaurants WHERE cuisine_type = 'Cuisine Type A'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_listings (hotel_id INT, location VARCHAR(20)); INSERT INTO hotel_listings (hotel_id, location) VALUES (1, 'Paris'), (2, 'Berlin'), (3, 'Tokyo'); | Find the total number of hotel listings in Europe and Asia, excluding duplicates. | SELECT location, COUNT(DISTINCT hotel_id) as total_hotels FROM hotel_listings WHERE location IN ('Europe', 'Asia') GROUP BY location | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, division VARCHAR(50), resolution_time INT); INSERT INTO cases (case_id, division, resolution_time) VALUES (1, 'civil', 60), (2, 'criminal', 90), (3, 'civil', 45), (4, 'criminal', 75); | Calculate the average time to resolution for cases in the civil division | SELECT AVG(resolution_time) FROM cases WHERE division = 'civil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID int, ProjectName varchar(255), State varchar(255), StartDate date, EndDate date, IsSustainable bit); CREATE TABLE Companies (CompanyID int, CompanyName varchar(255), State varchar(255)); CREATE TABLE LaborCosts (CostID int, ProjectID int, LaborCost money, Date date); | What is the total number of construction projects in Colorado that were completed in the past year? | SELECT COUNT(ProjectID) as TotalProjects FROM Projects JOIN Companies ON Projects.State = Companies.State WHERE Companies.State = 'Colorado' AND Projects.EndDate >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE grad_students (student_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); CREATE TABLE research_grants (student_id INT, grant_date DATE, grant_amount FLOAT); INSERT INTO grad_students (student_id, name, gender, department) VALUES (1, 'John Doe', 'Male', 'Computer Science'), (2, 'Jane Sm... | Determine the total amount of research grants awarded to graduate students in the 'grad_students' and 'research_grants' tables | SELECT SUM(rg.grant_amount) FROM grad_students gs INNER JOIN research_grants rg ON gs.student_id = rg.student_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_adoption (hotel_id INT, num_ai_technologies INT); INSERT INTO ai_adoption (hotel_id, num_ai_technologies) VALUES (1, 3), (2, 2), (3, 4), (4, 1), (5, 5); CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT); INSERT INTO hotels (hotel_id, hotel_name, country) VALUES (1, 'Hotel A', 'UAE'), (2,... | Which hotels in the Middle East have adopted the most AI technologies? | SELECT hotel_name, num_ai_technologies FROM ai_adoption INNER JOIN hotels ON ai_adoption.hotel_id = hotels.hotel_id WHERE country IN ('UAE', 'Saudi Arabia', 'Qatar', 'Oman', 'Bahrain') ORDER BY num_ai_technologies DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE event_days (event_day ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'), event_id INT); | What is the total number of tickets sold for each event by day of the week? | SELECT e.event_name, e.event_day, COUNT(t.ticket_id) FROM event_days ed JOIN events e ON ed.event_id = e.event_id JOIN tickets t ON ed.event_day = DAYOFWEEK(t.event_date) JOIN events e ON t.event_id = e.event_id GROUP BY e.event_name, e.event_day; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(100), department VARCHAR(50), publications INT); INSERT INTO graduate_students (id, name, department, publications) VALUES (1, 'Bob', 'Mathematics', 20); | List the top 5 graduate students with the highest number of research publications in the Mathematics department. | SELECT name, department, publications FROM graduate_students WHERE department = 'Mathematics' ORDER BY publications DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INT, name TEXT, production DECIMAL(15,2)); INSERT INTO country (id, name, production) VALUES (1, 'China', 55000); | List the top 3 countries with the highest seafood production? | SELECT name, production FROM country ORDER BY production DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE crime_categories (id INT, name TEXT);CREATE TABLE crimes (id INT, category_id INT, date DATE); | What is the total number of crimes committed in each category in the last year? | SELECT c.name, COUNT(cr.id) FROM crime_categories c JOIN crimes cr ON c.id = cr.category_id WHERE cr.date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY c.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contractors (ContractorID INT, ContractorName TEXT); INSERT INTO Contractors (ContractorID, ContractorName) VALUES (1, 'ABC Builders'), (2, 'Green Construction'); CREATE TABLE SustainableProjects (ProjectID INT, ContractorID INT); INSERT INTO SustainableProjects (ProjectID, ContractorID) VALUES (101, 1), (... | What are the names of the contractors who have completed at least one sustainable building project? | SELECT ContractorName FROM Contractors C INNER JOIN SustainableProjects SP ON C.ContractorID = SP.ContractorID GROUP BY ContractorName; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety_incidents (incident_id INT, incident_date DATE, ai_subfield TEXT, incident_description TEXT); INSERT INTO ai_safety_incidents (incident_id, incident_date, ai_subfield, incident_description) VALUES (1, '2020-01-01', 'Explainable AI', 'Model failed to provide clear explanations'); INSERT INTO ai_sa... | What is the total number of AI safety incidents reported in 2020 and 2021, grouped by the quarter in which they occurred? | SELECT DATE_PART('quarter', incident_date) as quarter, COUNT(*) as incidents FROM ai_safety_incidents WHERE incident_date BETWEEN '2020-01-01' AND '2021-12-31' GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_sources (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO pollution_sources (id, name, region) VALUES (1, 'Oceanic Chemical Pollution', 'Pacific Ocean'); | Update the region for the record with id 1 in the pollution_sources table to 'Atlantic Ocean'. | UPDATE pollution_sources SET region = 'Atlantic Ocean' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback (City VARCHAR(20), Category VARCHAR(20), Rating INT); INSERT INTO Feedback (City, Category, Rating) VALUES ('CityX', 'Public Safety', 7); INSERT INTO Feedback (City, Category, Rating) VALUES ('CityX', 'Waste Management', 8); | What is the average rating for public safety and waste management in CityX? | SELECT City, AVG(CASE WHEN Category = 'Public Safety' THEN Rating ELSE 0 END) AS 'Public Safety Avg Rating', AVG(CASE WHEN Category = 'Waste Management' THEN Rating ELSE 0 END) AS 'Waste Management Avg Rating' FROM Feedback WHERE City = 'CityX' GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_id INT, name TEXT, city TEXT); INSERT INTO cultural_sites (site_id, name, city) VALUES (1, 'Tsukiji Fish Market', 'Tokyo'), (2, 'Sensoji Temple', 'Tokyo'), (3, 'Osaka Castle', 'Osaka'); | How many cultural heritage sites are registered in Tokyo and Osaka? | SELECT COUNT(*) FROM cultural_sites WHERE city IN ('Tokyo', 'Osaka'); | gretelai_synthetic_text_to_sql |
CREATE TABLE caspian_sea_platforms (year INT, region VARCHAR(20), num_platforms INT); INSERT INTO caspian_sea_platforms (year, region, num_platforms) VALUES (2015, 'Caspian Sea', 1200), (2016, 'Caspian Sea', 1250), (2017, 'Caspian Sea', 1300), (2018, 'Caspian Sea', 1350), (2019, 'Caspian Sea', 1400), (2020, 'Caspian Se... | How many offshore drilling platforms were there in the Caspian Sea as of 2019? | SELECT num_platforms FROM caspian_sea_platforms WHERE year = 2019 AND region = 'Caspian Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astrophysicists (id INT, name TEXT, team TEXT); CREATE TABLE Asteroids (id INT, astrophysicist_id INT, name TEXT, mass FLOAT); | What is the total mass of all asteroids researched by a specific team of astrophysicists? | SELECT SUM(mass) FROM Asteroids WHERE astrophysicist_id IN (SELECT id FROM Astrophysicists WHERE team = 'TeamX'); | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (satellite_id INT, name VARCHAR(100), owner_country VARCHAR(50)); INSERT INTO satellites (satellite_id, name, owner_country) VALUES (1, 'Japanese Earth Resource Satellite', 'Japan'), (2, 'South Korean Communication Satellite', 'South Korea'); | List the unique names of all satellites owned by Japan and South Korea? | SELECT DISTINCT name FROM satellites WHERE owner_country IN ('Japan', 'South Korea'); | gretelai_synthetic_text_to_sql |
CREATE TABLE budgets(id INT, project TEXT, year INT, amount FLOAT); INSERT INTO budgets(id, project, year, amount) VALUES (1, 'Accessible Tech', 2021, 100000.0); INSERT INTO budgets(id, project, year, amount) VALUES (2, 'Accessible Tech', 2022, 120000.0); INSERT INTO budgets(id, project, year, amount) VALUES (3, 'Digit... | What is the average budget allocated for accessible technology projects per year? | SELECT AVG(amount) FROM budgets WHERE project = 'Accessible Tech' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_education (program_id INT, program_name VARCHAR(50), target_audience VARCHAR(50), instructor_name VARCHAR(50)); | Add a new community education program to the database | INSERT INTO community_education (program_id, program_name, target_audience, instructor_name) VALUES (4, 'Wildlife Art', 'Children (8-12)', 'Jamila Thompson'); | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (drug_name TEXT, approval_date DATE); INSERT INTO drug_approval (drug_name, approval_date) VALUES ('DrugA', '2018-01-01'), ('DrugB', '2017-05-15'), ('DrugC', '2020-09-27'), ('DrugD', '2016-08-04'); | What is the minimum approval date for drugs approved for pediatric use? | SELECT MIN(approval_date) FROM drug_approval WHERE drug_name IN (SELECT drug_name FROM drug_approval WHERE approval_date >= DATE('now', '-5 year')); | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_details (id INT, artifact_id INT, artifact_type VARCHAR(50), weight INT); | How many artifacts were made of metal, per site? | SELECT site_name, SUM(CASE WHEN artifact_type = 'metal' THEN 1 ELSE 0 END) as metal_artifacts FROM excavation_sites | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id varchar(10), field varchar(10), production int, datetime date); INSERT INTO wells (well_id, field, production, datetime) VALUES ('W007', 'FieldG', 1500, '2019-01-01'), ('W008', 'FieldG', 1600, '2019-01-15'); | What is the minimum production in 'FieldG' for each month of 2019? | SELECT field, YEAR(datetime) AS year, MONTH(datetime) AS month, MIN(production) AS min_production FROM wells WHERE field = 'FieldG' GROUP BY field, year, month; | 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.