context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, TotalHours DECIMAL(5,2));CREATE TABLE VolunteerHours (VolunteerHoursID INT, VolunteerID INT, Program TEXT, Hours DECIMAL(5,2), Partial BOOLEAN); | What is the total number of volunteer hours contributed by each volunteer for the 'Environment' program? | SELECT V.VolunteerName, SUM(VH.Hours) as TotalHours FROM VolunteerHours VH JOIN Volunteers V ON VH.VolunteerID = V.VolunteerID WHERE VH.Program = 'Environment' GROUP BY VH.VolunteerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE ship_updates (update_id INT, ship_name VARCHAR(50), capacity INT, update_date DATE); INSERT INTO ship_updates VALUES (1, 'MSC Maya', 19224, '2022-03-15'); INSERT INTO ship_updates VALUES (2, 'OOCL Hong Kong', 21413, '2022-02-20'); INSERT INTO ship_updates VALUES (3, 'Ever Given', 20000, '2022-03-08'); | Which container ships have had their capacity updated in the last month? | SELECT ship_name, update_date FROM ship_updates WHERE update_date > DATEADD(MONTH, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_capacity (province VARCHAR(30), capacity FLOAT); INSERT INTO solar_capacity (province, capacity) VALUES ('Jiangsu', 12000), ('Jiangsu', 14000), ('Zhejiang', 9000), ('Zhejiang', 11000), ('Anhui', 15000), ('Anhui', 17000); | Which province in China has the highest installed solar capacity? | SELECT province, MAX(capacity) FROM solar_capacity GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, equipment_type TEXT, last_maintenance_date DATE, state TEXT); INSERT INTO military_equipment (equipment_id, equipment_type, last_maintenance_date, state) VALUES (1, 'Tank', '2022-01-01', 'Texas'); | How many military vehicles were maintained in Texas in the last 6 months? | SELECT COUNT(*) FROM military_equipment WHERE last_maintenance_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND state = 'Texas' AND equipment_type = 'Tank'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE, altitude FLOAT, orbit VARCHAR(50)); | What are the average and maximum altitudes of satellites in geostationary orbit? | SELECT AVG(satellites.altitude) as average_altitude, MAX(satellites.altitude) as max_altitude FROM satellites WHERE satellites.orbit = 'geostationary'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attendees_Programs (program_name VARCHAR(255), attendee_age INT); INSERT INTO Attendees_Programs (program_name, attendee_age) VALUES ('Art Education', 30, 35, 40, 45), ('Music Education', 20, 22, 25), ('Theater Education', 50, 55, 60); | What is the average age of attendees at 'Music Education' programs? | SELECT AVG(attendee_age) FROM Attendees_Programs WHERE program_name = 'Music Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE founders (id INT, name VARCHAR(50), ethnicity VARCHAR(20), company_id INT, founding_year INT); CREATE TABLE funding (id INT, company_id INT, amount INT); | What is the minimum funding received by a company founded by a Pacific Islander? | SELECT MIN(funding.amount) FROM funding JOIN founders ON funding.company_id = founders.company_id WHERE founders.ethnicity = 'Pacific Islander'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellite_Deployments (satellite_deployment_id INT, satellite_model VARCHAR(50), deploying_org VARCHAR(50), deployment_date DATE); INSERT INTO Satellite_Deployments (satellite_deployment_id, satellite_model, deploying_org, deployment_date) VALUES (1, 'Sat-A', 'NASA', '2020-05-30'), (2, 'Sat-B', 'CNSA', '20... | How many satellites were deployed by each organization in the last 3 years? | SELECT deploying_org, COUNT(*) as total_deployments FROM Satellite_Deployments WHERE deployment_date >= DATEADD(year, -3, GETDATE()) GROUP BY deploying_org; | gretelai_synthetic_text_to_sql |
CREATE TABLE SupplierSafetyRecords (SupplierName VARCHAR(50), Year INT, SafetyViolations INT); INSERT INTO SupplierSafetyRecords (SupplierName, Year, SafetyViolations) VALUES ('ABC Foods', 2021, 5), ('XYZ Foods', 2021, 8), ('123 Foods', 2021, 3), ('FoodCo', 2021, 7), ('EcoFoods', 2021, 4); | Which food supplier had the most safety violations in 2021? | SELECT SupplierName, MAX(SafetyViolations) FROM SupplierSafetyRecords WHERE Year = 2021 GROUP BY SupplierName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, PlayerName, Country) VALUES (1, 'John Smith', 'Canada'); INSERT INTO Players (PlayerID, PlayerName, Country) VALUES (2, 'Jane Doe', 'USA'); CREATE TABLE VRAdoption (PlayerID INT, VRAdopted DATE); INSERT INTO... | Display the PlayerName and VRAdopted date for players who adopted VR technology in 2021 | SELECT p.PlayerName, va.VRAdopted FROM Players p INNER JOIN VRAdoption va ON p.PlayerID = va.PlayerID WHERE YEAR(va.VRAdopted) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (id INT, farm_id INT, temperature FLOAT, measurement_date DATE); | Insert new temperature data for farm_id 345 | INSERT INTO temperature_data (id, farm_id, temperature, measurement_date) VALUES (6, 345, 22.2, '2022-06-02'); | gretelai_synthetic_text_to_sql |
CREATE TABLE diplomacy_events (event_id INT, name VARCHAR(255), country VARCHAR(255), date DATE, description TEXT); | Create a table named 'diplomacy_events' | CREATE TABLE diplomacy_events (event_id INT, name VARCHAR(255), country VARCHAR(255), date DATE, description TEXT); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), manufacturer VARCHAR(255), year INT, country VARCHAR(255)); INSERT INTO military_equipment (id, name, type, manufacturer, year, country) VALUES (1, 'M1 Abrams', 'Tank', 'General Dynamics', 1980, 'USA'), (2, 'F-15 Eagle', 'Fighter... | Alter 'military_equipment' table to add a column 'country' | ALTER TABLE military_equipment ADD COLUMN country VARCHAR(255); | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_id INT, country VARCHAR(20), type VARCHAR(20)); INSERT INTO cultural_sites (site_id, country, type) VALUES (1, 'France', 'heritage'), (2, 'Spain', 'heritage'), (3, 'France', 'heritage'), (4, 'France', 'virtual'), (5, 'Spain', 'virtual'); | Identify the number of cultural heritage sites and virtual tours offered in France and Spain, and find the difference between the two numbers. | SELECT COUNT(*) FROM cultural_sites WHERE country = 'France' AND type = 'heritage' UNION ALL SELECT COUNT(*) FROM cultural_sites WHERE country = 'Spain' AND type = 'heritage' UNION ALL SELECT COUNT(*) FROM cultural_sites WHERE country = 'France' AND type = 'virtual' UNION ALL SELECT COUNT(*) FROM cultural_sites WHERE c... | gretelai_synthetic_text_to_sql |
CREATE TABLE Licenses (id INT, type TEXT, issue_date DATE, revoke_date DATE); | How many cultivation licenses have been issued in Washington in the past year? | SELECT COUNT(*) FROM Licenses WHERE type = 'cultivation' AND issue_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) AND issue_date < DATE_SUB(CURDATE(), INTERVAL 0 DAY) AND revoke_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE billing (customer_id INT, bill_amount DECIMAL(5,2), payment_date DATE); | Delete records of customers who have not paid their bills in the last 60 days from the billing table | DELETE FROM billing WHERE payment_date < (CURRENT_DATE - INTERVAL '60' DAY); | gretelai_synthetic_text_to_sql |
CREATE TABLE AstronautMedicalData (AstronautName VARCHAR(255), MedicalIssue VARCHAR(255), MedicalDate DATE); INSERT INTO AstronautMedicalData (AstronautName, MedicalIssue, MedicalDate) VALUES ('Neil Armstrong', 'Allergies', '1968-12-12'), ('Buzz Aldrin', 'Anxiety', '1968-11-11'); | Update the medical data of astronaut 'John Glenn' to include a new medical record with a medical issue of 'High Blood Pressure' and a medical date of '1999-01-01'. | INSERT INTO AstronautMedicalData (AstronautName, MedicalIssue, MedicalDate) SELECT 'John Glenn', 'High Blood Pressure', '1999-01-01' FROM AstronautMedicalData WHERE AstronautName = 'John Glenn' LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (country VARCHAR(255), waste_generation_kg_per_capita DECIMAL(5,2), region VARCHAR(255)); INSERT INTO WasteGeneration (country, waste_generation_kg_per_capita, region) VALUES ('Japan', 3.2, 'Asia'), ('China', 5.1, 'Asia'), ('India', 1.7, 'Asia'); | What is the average waste generation per capita in the Asian region? | SELECT AVG(waste_generation_kg_per_capita) FROM WasteGeneration WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, first_half_points INT, second_half_points INT); | What is the difference in total points scored between the first and second halves of each NBA game? | SELECT game_id, first_half_points - second_half_points AS point_difference FROM games; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), region VARCHAR(50));INSERT INTO clients (client_id, name, region) VALUES (1, 'John Doe', 'North America'), (2, 'Barbara Black', 'Asia'); | For all clients with a last name starting with 'B', update the region to 'EU'. | UPDATE clients c SET c.region = 'EU' WHERE SUBSTRING(c.name, 1, 1) = 'B'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_research_funding (id INT PRIMARY KEY, project_name VARCHAR(255), organization VARCHAR(255), start_date DATE, end_date DATE, budget FLOAT); INSERT INTO marine_research_funding (id, project_name, organization, start_date, end_date, budget) VALUES (2, 'Coral Reef Restoration', 'National Marine Fisherie... | What is the funding amount for the 'Coral Reef Restoration' project? | SELECT budget FROM marine_research_funding WHERE project_name = 'Coral Reef Restoration'; | gretelai_synthetic_text_to_sql |
CREATE TABLE producer (id INT, name TEXT, total_production FLOAT); INSERT INTO producer (id, name, total_production) VALUES (1, 'China', 140000), (2, 'Australia', 20000), (3, 'United States', 15000); | What are the top 3 rare earth element producers in terms of total production quantity? | SELECT name, total_production FROM producer ORDER BY total_production DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_accommodations (student_id INT, disability_type VARCHAR(255), country VARCHAR(255), date DATE, cost INT); INSERT INTO student_accommodations (student_id, disability_type, country, date, cost) VALUES (1, 'Mobility Impairment', 'USA', '2021-03-22', 500); INSERT INTO student_accommodations (student_id... | What is the total cost of accommodations for students with mobility impairments in the last 3 months? | SELECT SUM(cost) as total_cost FROM student_accommodations WHERE disability_type = 'Mobility Impairment' AND date BETWEEN DATE_SUB(NOW(), INTERVAL 3 MONTH) AND NOW(); | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (country VARCHAR(255), project_name VARCHAR(255), type VARCHAR(255), count INT); | What's the total number of renewable energy projects in Sweden? | SELECT SUM(count) FROM renewable_energy WHERE country = 'Sweden' AND type = 'renewable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(255)); INSERT INTO Programs (ProgramID, ProgramName) VALUES (1, 'Education'), (2, 'Health'), (3, 'Environment'), (4, 'Arts'), (5, 'Sports'); CREATE TABLE Volunteers (VolunteerID INT, ProgramID INT); INSERT INTO Volunteers (VolunteerID, ProgramID) VALUES (1, 1), ... | What are the names of the programs that have more than 5 volunteers? | SELECT Programs.ProgramName FROM Programs INNER JOIN Volunteers ON Programs.ProgramID = Volunteers.ProgramID GROUP BY Programs.ProgramName HAVING COUNT(DISTINCT Volunteers.VolunteerID) > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT, sector VARCHAR(20), year INT, waste_generated FLOAT); INSERT INTO waste_generation (id, sector, year, waste_generated) VALUES (1, 'commercial', 2020, 200.2), (2, 'commercial', 2019, 190.1), (3, 'residential', 2020, 150.5); | What is the total amount of waste generated in the commercial sector in the year 2020? | SELECT SUM(waste_generated) FROM waste_generation WHERE sector = 'commercial' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(50), Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (1, 'IT', 75000.00); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (2, 'IT', 80000.00); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (3, '... | What is the average salary for employees in the IT department? | SELECT AVG(Salary) FROM Employees WHERE Department = 'IT' | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet_management (id INT, name VARCHAR(50), type VARCHAR(50), capacity INT); | What is the average capacity of vessels in the 'fleet_management' table? | SELECT AVG(capacity) FROM fleet_management; | gretelai_synthetic_text_to_sql |
CREATE TABLE CollectiveBargaining (agreement_id INT, union_id INT, terms TEXT); CREATE TABLE Unions (union_id INT, name TEXT); | List all collective bargaining agreements and their respective union names. | SELECT CollectiveBargaining.terms, Unions.name FROM CollectiveBargaining INNER JOIN Unions ON CollectiveBargaining.union_id = Unions.union_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE stores (store_id INT, store_name VARCHAR(255), store_state VARCHAR(255), co2_emissions INT); | Find the CO2 emissions for each store in the state of New York. | SELECT store_name, co2_emissions FROM stores WHERE store_state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE arts_accommodations (student_id INT, semester VARCHAR(10));CREATE TABLE pe_accommodations (student_id INT, semester VARCHAR(10)); INSERT INTO arts_accommodations VALUES (4, 'fall 2021'), (5, 'fall 2021'), (6, 'fall 2021'); INSERT INTO pe_accommodations VALUES (5, 'fall 2021'), (6, 'fall 2021'), (7, 'fall 2... | What is the total number of students who received accommodations in the arts department and the physical education department, for the fall 2021 semester? | SELECT COUNT(*) FROM arts_accommodations WHERE semester = 'fall 2021' UNION ALL SELECT COUNT(*) FROM pe_accommodations WHERE semester = 'fall 2021'; | gretelai_synthetic_text_to_sql |
CREATE TABLE spending_stats (year INT, continent TEXT, spending DECIMAL(10,2)); INSERT INTO spending_stats (year, continent, spending) VALUES (2019, 'Africa', 800), (2020, 'Africa', 600), (2021, 'Africa', 900); | Calculate the year-over-year change in visitor spending in Africa. | SELECT t1.year, t1.continent, (t1.spending - LAG(t1.spending) OVER (PARTITION BY t1.continent ORDER BY t1.year)) / ABS(LAG(t1.spending) OVER (PARTITION BY t1.continent ORDER BY t1.year)) as change_percentage FROM spending_stats t1; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, site_id INT, species_name TEXT); INSERT INTO marine_species (species_id, site_id, species_name) VALUES (1, 1, 'Anglerfish'), (2, 3, 'Giant Squid'), (3, 1, 'Oceanic Trench Snailfish'); | Which sites have no recorded marine life observations? | SELECT site_id FROM marine_sites WHERE site_id NOT IN (SELECT site_id FROM marine_species); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INT, registration_date DATE, region TEXT); INSERT INTO vessels VALUES (1, '2020-01-15', 'Caribbean'), (2, '2020-03-07', 'Caribbean'), (3, '2019-12-28', 'Caribbean'), (4, '2020-02-04', 'Caribbean'), (5, '2019-11-10', 'Caribbean'), (6, '2020-01-02', 'Caribbean'); | How many vessels were registered in the first quarter of 2020 in the Caribbean region? | SELECT COUNT(*) FROM vessels WHERE registration_date BETWEEN '2020-01-01' AND '2020-03-31' AND region = 'Caribbean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (trial_id INT, therapeutic_area VARCHAR(50), start_year INT, end_year INT); INSERT INTO clinical_trials (trial_id, therapeutic_area, start_year, end_year) VALUES (1, 'Oncology', 2015, 2017), (2, 'Oncology', 2016, 2018), (3, 'Cardiology', 2017, 2019), (4, 'Oncology', 2018, 2020); | How many clinical trials were conducted for a specific therapeutic area, 'Oncology', between 2015 and 2020? | SELECT COUNT(*) as total_trials FROM clinical_trials WHERE therapeutic_area = 'Oncology' AND start_year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE funding_sources (funding_id INT, funding_amount INT, funding_date DATE, department_id INT); INSERT INTO funding_sources (funding_id, funding_amount, funding_date, department_id) VALUES (1, 5000, '2023-01-01', 101); INSERT INTO funding_sources (funding_id, funding_amount, funding_date, department_id) VALUES... | What was the total funding received by each department in H1 2023? | SELECT department_id, SUM(funding_amount) as total_funding FROM funding_sources WHERE MONTH(funding_date) <= 6 AND YEAR(funding_date) = 2023 GROUP BY department_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE obesity_data (community_center TEXT, year INT, obesity_rate INT); INSERT INTO obesity_data (community_center, year, obesity_rate) VALUES ('Center A', 2018, 20), ('Center A', 2019, 22), ('Center A', 2020, 24), ('Center B', 2018, 18), ('Center B', 2019, 19), ('Center B', 2020, 21); | What is the change in obesity rates for each community center between 2018 and 2020? | SELECT community_center, (obesity_rate_2020 - obesity_rate_2018) AS obesity_change FROM (SELECT community_center, obesity_rate AS obesity_rate_2018, LEAD(obesity_rate, 2) OVER (PARTITION BY community_center ORDER BY year) AS obesity_rate_2020 FROM obesity_data) WHERE obesity_rate_2020 IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Protected_Habitats (id INT, habitat_id INT, animal_count INT); | How many animals are there in each protected habitat? | SELECT habitat_id, COUNT(*) FROM Protected_Habitats GROUP BY habitat_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, first_name VARCHAR(50), last_name VARCHAR(50), job_title VARCHAR(100)); INSERT INTO employees (id, first_name, last_name, job_title) VALUES (1, 'John', 'Doe', 'Software Engineer'), (2, 'Jane', 'Doe', NULL); | List all employees who do not have a job title | SELECT id, first_name, last_name FROM employees WHERE job_title IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Meals(id INT, name TEXT, country TEXT, calories INT); INSERT INTO Meals(id, name, country, calories) VALUES (1, 'Organic Salad', 'Canada', 350), (2, 'Vegan Burger', 'Canada', 600); | What is the average calorie intake for organic meals in Canada? | SELECT AVG(calories) FROM Meals WHERE name LIKE '%Organic%' AND country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inclusive_housing_prices (property_id INT, price DECIMAL(10,2)); INSERT INTO inclusive_housing_prices (property_id, price) VALUES (1, 300000.00), (2, 350000.00), (3, 400000.00); | What is the minimum and maximum property price in the inclusive housing program? | SELECT MIN(price), MAX(price) FROM inclusive_housing_prices; | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (station_id INT, station_name VARCHAR(255), line VARCHAR(255));CREATE TABLE trips (trip_id INT, station_id INT, entry_time TIMESTAMP, fare FLOAT); INSERT INTO stations (station_id, station_name, line) VALUES (1, 'Bowdoin', 'Blue Line'), (2, 'Aquarium', 'Blue Line'), (3, 'Maverick', 'Blue Line'); I... | Calculate the total fare collected at each station on the Blue Line on 2022-07-01 | SELECT s.station_name, SUM(t.fare) as total_fare FROM trips t JOIN stations s ON t.station_id = s.station_id WHERE s.line = 'Blue Line' AND t.entry_time::date = '2022-07-01' GROUP BY s.station_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, state VARCHAR(50), year INT, weight INT); INSERT INTO sales (id, state, year, weight) VALUES (1, 'Nevada', 2021, 50000); | What was the total weight of cannabis sold in the state of Nevada in the year 2021? | SELECT SUM(weight) FROM sales WHERE state = 'Nevada' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE housing_affordability (index FLOAT, city VARCHAR(20)); | What is the maximum housing affordability index in Berlin? | SELECT MAX(index) FROM housing_affordability WHERE city = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_companies_2 (company_name TEXT, location TEXT); INSERT INTO mining_companies_2 (company_name, location) VALUES ('VWX Mining', 'South Africa'), ('YZA Mining', 'Morocco'), ('BCD Mining', 'Egypt'); CREATE TABLE europium_production (year INT, company_name TEXT, quantity INT); INSERT INTO europium_produc... | What is the maximum production quantity (in metric tons) of Europium in 2021, grouped by mining company locations in Africa? | SELECT location, MAX(quantity) as max_quantity FROM europium_production JOIN mining_companies_2 ON europium_production.company_name = mining_companies_2.company_name WHERE year = 2021 AND location LIKE 'Africa%' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (teacher_id INT, teacher_name TEXT, subject_area TEXT, last_pd_program_date DATE); INSERT INTO teachers (teacher_id, teacher_name, subject_area, last_pd_program_date) VALUES (1, 'John Doe', 'Math', '2020-04-01'), (2, 'Jane Smith', 'Science', '2019-08-15'), (3, 'Mary Johnson', 'English', '2021-03-2... | How many teachers have participated in professional development programs in the last 3 years, broken down by subject area? | SELECT subject_area, COUNT(*) FROM teachers WHERE last_pd_program_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY subject_area; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (sector VARCHAR(20), region VARCHAR(20), usage INT); INSERT INTO water_usage (sector, region, usage) VALUES ('Agriculture', 'North', 300), ('Domestic', 'North', 200), ('Industrial', 'North', 500), ('Agriculture', 'South', 400), ('Domestic', 'South', 250), ('Industrial', 'South', 600); | Which regions have a higher industrial water usage compared to domestic water usage? | SELECT region FROM water_usage WHERE industrial > domestic | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO Exhibitions (exhibition_id, name, start_date, end_date) VALUES (1, 'Impressionist', '2020-05-01', '2021-01-01'), (2, 'Cubism', '2019-08-15', '2020-03-30'); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT... | How many visitors identified as non-binary attended each exhibition? | SELECT exhibition_id, COUNT(*) FROM Visitors WHERE gender = 'non-binary' GROUP BY exhibition_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (id INT, country VARCHAR(255), artifacts_count INT); | Find excavation sites in France and Germany with more than 50 artifacts. | SELECT country, COUNT(*) as artifacts_count FROM excavation_sites WHERE country IN ('France', 'Germany') GROUP BY country HAVING artifacts_count > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE TemperatureData (date DATE, temperature FLOAT, sensor_id INT, FOREIGN KEY (sensor_id) REFERENCES SensorData(sensor_id)); | Update temperature records for sensor 003 on 2023-03-02 to 30°C | UPDATE TemperatureData SET temperature = 30 WHERE sensor_id = 3 AND date = '2023-03-02'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (school_id INT, school_name TEXT); INSERT INTO schools VALUES (1, 'Lincoln High'), (2, 'Washington Middle'), (3, 'Jefferson Elementary'); CREATE TABLE student_mental_health (student_id INT, school_id INT, hours_spent INT); INSERT INTO student_mental_health VALUES (1, 1, 10), (2, 1, 8), (3, 2, 5), (... | What is the average number of hours spent on mental health resources per student in each school? | SELECT s.school_name, AVG(smh.hours_spent) as avg_hours_spent FROM student_mental_health smh JOIN schools s ON smh.school_id = s.school_id GROUP BY smh.school_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_accommodations (student_id INT, disability_type VARCHAR(255), accommodation_year INT); | Delete all records with disability_type 'learning' from student_accommodations | DELETE FROM student_accommodations WHERE disability_type = 'learning'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtForms (id INT, name VARCHAR(255), origin VARCHAR(255), description TEXT); INSERT INTO ArtForms (id, name, origin, description) VALUES (1, 'Kabuki', 'Japan', 'A classical Japanese dance-drama known for its elaborate make-up and costumes.'); | What are the names of traditional art forms from Japan with a description? | SELECT name FROM ArtForms WHERE origin = 'Japan' INTERSECT SELECT name FROM ArtForms WHERE description IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user VARCHAR(50), content TEXT, likes INT, shares INT, timestamp DATETIME); | Find the total number of shares for posts containing the hashtag "#sustainableliving" in the past week. | SELECT SUM(shares) FROM posts WHERE content LIKE '%#sustainableliving%' AND timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 WEEK) AND NOW(); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (Id INT, Name VARCHAR(50)); CREATE TABLE Accidents (VesselId INT); INSERT INTO Vessels (Id, Name) VALUES (1, 'Vessel1'), (2, 'Vessel2'), (3, 'Vessel3'); INSERT INTO Accidents (VesselId) VALUES (1), (3); | List the names of vessels that have had an accident | SELECT Vessels.Name FROM Vessels JOIN Accidents ON Vessels.Id = Accidents.VesselId; | gretelai_synthetic_text_to_sql |
CREATE TABLE violations (id INT, workplace TEXT, country TEXT, violation_count INT); INSERT INTO violations (id, workplace, country, violation_count) VALUES (1, 'Workplace A', 'Spain', 5), (2, 'Workplace B', 'Spain', 3), (3, 'Workplace C', 'Spain', 7); | What is the average number of labor rights violations per workplace in Spain? | SELECT AVG(violation_count) as avg_violations_per_workplace FROM violations WHERE country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_policing (id INT, date DATE, outreach_hours INT, PRIMARY KEY(id)); | Insert new record '2022-06-01' for 'community_policing' table | INSERT INTO community_policing (id, date, outreach_hours) VALUES (4, '2022-06-01', 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS destinations (id INT PRIMARY KEY, name TEXT, region TEXT, sustainability_score FLOAT); INSERT INTO destinations (id, name, region, sustainability_score) VALUES (1, 'EcoPark', 'Africa', 9.2), (2, 'GreenVillage', 'Africa', 8.8), (3, 'SustainableCity', 'Asia', 8.9); | List the top 3 destinations with the highest sustainable tourism scores in Africa. | SELECT name, sustainability_score FROM destinations WHERE region = 'Africa' ORDER BY sustainability_score DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Auto_Shows (year INT, country VARCHAR(50), quantity INT); INSERT INTO Auto_Shows (year, country, quantity) VALUES (2019, 'India', 10); | How many auto shows took place in India in 2019? | SELECT SUM(quantity) FROM Auto_Shows WHERE year = 2019 AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_year INT, founding_location TEXT); INSERT INTO company (id, name, founding_year, founding_location) VALUES (1, 'Acme Inc', 2010, 'San Francisco'); INSERT INTO company (id, name, founding_year, founding_location) VALUES (2, 'Beta Corp', 2015, 'Mountain View'); | How many startups were founded in the Bay Area each year? | SELECT founding_location, COUNT(*) FROM company GROUP BY founding_year, founding_location HAVING founding_location = 'Bay Area'; | gretelai_synthetic_text_to_sql |
CREATE TABLE brackish_farms (farm_id INT, species VARCHAR(20), biomass FLOAT); INSERT INTO brackish_farms (farm_id, species, biomass) VALUES (1, 'Tilapia', 1200.5), (2, 'Barramundi', 800.3), (3, 'Catfish', 1500.2); | Rank the species in descending order based on total biomass in brackish water farms. | SELECT species, SUM(biomass) total_biomass, ROW_NUMBER() OVER (ORDER BY SUM(biomass) DESC) rank FROM brackish_farms GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species_name VARCHAR(255), ocean VARCHAR(255), depth INT); INSERT INTO marine_species (id, species_name, ocean, depth) VALUES (1, 'Mariana Snailfish', 'Pacific', 8178); INSERT INTO marine_species (id, species_name, ocean, depth) VALUES (2, 'Hadal Snailfish', 'Atlantic', 7500); INSER... | How many marine species were observed in each ocean? | SELECT ocean, COUNT(*) FROM marine_species GROUP BY ocean; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (Library text, Visitors int, VisitDate date); INSERT INTO Visitors (Library, Visitors, VisitDate) VALUES ('LibraryA', 100, '2022-04-01'), ('LibraryB', 150, '2022-04-02'); | Which libraries had the most and least visitors in the last month? | SELECT Library, Visitors FROM (SELECT Library, Visitors, ROW_NUMBER() OVER (ORDER BY Visitors) as Rank FROM Visitors WHERE VisitDate >= DATEADD(month, -1, CURRENT_DATE)) as Subquery WHERE Rank IN (1, (SELECT COUNT(*) FROM Visitors WHERE VisitDate >= DATEADD(month, -1, CURRENT_DATE)) * 0.01); | gretelai_synthetic_text_to_sql |
CREATE TABLE innovation_projects (id INT, region VARCHAR(50), status VARCHAR(50)); INSERT INTO innovation_projects (id, region, status) VALUES (1, 'Region A', 'Active'); | How many agricultural innovation projects are currently active in each region? | SELECT region, COUNT(*) FROM rural_development.innovation_projects WHERE status = 'Active' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory(id INT, material VARCHAR(255), quantity INT); CREATE TABLE products(id INT, material VARCHAR(255), quantity INT); CREATE TABLE production(id INT, country VARCHAR(255), material VARCHAR(255), usage INT); INSERT INTO inventory(id, material, quantity) VALUES (1, 'organic cotton', 75), (2, 'conventio... | Which materials in the 'inventory' table have a quantity of at least 100 and are used in the production of at least one product in the 'products' table, but are not produced in 'China'? | SELECT i.material FROM inventory i INNER JOIN products p ON i.material = p.material WHERE i.quantity >= 100 AND NOT EXISTS (SELECT * FROM production WHERE production.material = i.material AND production.country = 'China'); | gretelai_synthetic_text_to_sql |
CREATE TABLE market_share (market_share_id INT, drug_id INT, region TEXT, market_share FLOAT); INSERT INTO market_share (market_share_id, drug_id, region, market_share) VALUES (1, 1002, 'Asia', 0.30), (2, 1003, 'Asia', 0.40), (3, 1002, 'Asia', 0.50), (4, 1001, 'Asia', 0.25), (5, 1003, 'Asia', 0.35), (6, 1001, 'Asia', 0... | What is the market share of a different drug compared to its competitors in a different region? | SELECT drug_id, region, AVG(market_share) as average_market_share FROM market_share WHERE drug_id = 1003 GROUP BY drug_id, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Bridges (id INT, name VARCHAR(50), inspection_date DATE); INSERT INTO Bridges (id, name, inspection_date) VALUES (1, 'Golden Gate', '2020-05-01'), (2, 'Brooklyn', '2019-12-20'); | List all bridges with their respective inspection dates. | SELECT * FROM Bridges; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hotels (hotel_id INT, hotel_name VARCHAR(50), chain_name VARCHAR(50), country VARCHAR(50)); CREATE TABLE Bookings (booking_id INT, hotel_id INT, booking_amt FLOAT, ota_source BOOLEAN); INSERT INTO Hotels (hotel_id, hotel_name, chain_name, country) VALUES (1, 'Hotel1', 'ChainX', 'CountryA'), (2, 'Hotel2', '... | Which hotel chains have the most OTA bookings in 'CountryA'? | SELECT h.chain_name, SUM(b.booking_amt) as total_ota_bookings FROM Hotels h JOIN Bookings b ON h.hotel_id = b.hotel_id WHERE h.country = 'CountryA' AND b.ota_source = TRUE GROUP BY h.chain_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, team VARCHAR(50), position VARCHAR(50), goals_conceded INT, game_date DATE); | List the teams that have conceded less than 10 goals in their last 5 games. | SELECT team FROM (SELECT team, SUM(goals_conceded) AS goals_conceded FROM games WHERE game_date > DATE_SUB(CURRENT_DATE, INTERVAL 5 DAY) GROUP BY team) AS subquery WHERE goals_conceded < 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (id INT PRIMARY KEY, program_name VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO Programs (id, program_name, budget) VALUES (1, 'Education', 10000.00), (2, 'Health', 15000.00); | Delete all records from the 'Programs' table where the program name is 'Education' | DELETE FROM Programs WHERE program_name = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(50), museum VARCHAR(20)); INSERT INTO Artists (id, name, museum) VALUES (1, 'Van Gogh', 'NY'), (2, 'Monet', 'NY'), (3, 'Picasso', 'LA'); CREATE TABLE Artworks (id INT, artist_id INT, title VARCHAR(50)); INSERT INTO Artworks (id, artist_id, title) VALUES (1, 1, 'Starry Night'),... | List all artists who have more than 50 works in the NY museum. | SELECT Artists.name FROM Artists JOIN Artworks ON Artists.id = Artworks.artist_id WHERE Museums.name = 'NY' GROUP BY Artists.name HAVING COUNT(Artworks.id) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_name TEXT, year INT, revenue INT); INSERT INTO Events (event_name, year, revenue) VALUES ('Dance Performance', 2019, 8000), ('Dance Festival', 2020, 9000), ('Dance Recital', 2021, 11000); | What is the total revenue generated by dance performances in the past three years? | SELECT SUM(revenue) FROM Events WHERE event_name LIKE '%Dance%' AND year IN (2019, 2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE Growers (id INT, name TEXT, state TEXT); CREATE TABLE Strains (growerid INT, name TEXT); INSERT INTO Growers (id, name, state) VALUES (1, 'Grower A', 'Washington'); INSERT INTO Strains (growerid, name) VALUES (1, 'Strain X'); INSERT INTO Strains (growerid, name) VALUES (1, 'Strain Y'); | How many unique strains were produced by each grower in Washington in 2021? | SELECT g.name, COUNT(DISTINCT s.name) as unique_strains FROM Growers g JOIN Strains s ON g.id = s.growerid WHERE g.state = 'Washington' AND YEAR(s.name) = 2021 GROUP BY g.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE clean_energy_policies (policy_id INT, policy_name VARCHAR(255), policy_description TEXT, implementation_year INT); INSERT INTO clean_energy_policies (policy_id, policy_name, policy_description, implementation_year) VALUES (1, 'Renewable Portfolio Standard', 'Requires electricity providers to generate a cer... | Which clean energy policies were implemented in the year 2020? | SELECT policy_name, policy_description FROM clean_energy_policies WHERE implementation_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (article_id INT PRIMARY KEY, title VARCHAR(255), content TEXT, publish_date DATE); | Delete all articles published before 2010 from the 'news_articles' table | DELETE FROM news_articles WHERE publish_date < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Streaming (song VARCHAR(50), artist VARCHAR(50), streams INT, revenue FLOAT); INSERT INTO Streaming (song, artist, streams, revenue) VALUES ('Heat Waves', 'Glass Animals', 500, 5000.0), ('Drivers License', 'Olivia Rodrigo', 700, 7000.0), ('Good 4 U', 'Olivia Rodrigo', 600, 6000.0); | What was the total revenue for a specific artist in the music streaming data? | SELECT SUM(revenue) FROM Streaming WHERE artist = 'Olivia Rodrigo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEngagements (Id INT, Event TEXT, Year INT, Location TEXT); | Insert new community engagement records for 'Festival of Colors' and 'Pow Wow' | INSERT INTO CommunityEngagements (Id, Event, Year, Location) VALUES (1, 'Festival of Colors', 2022, 'India'), (2, 'Pow Wow', 2022, 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (id INT, name VARCHAR(50), total_billing_amount DECIMAL(10,2)); INSERT INTO clients (id, name, total_billing_amount) VALUES (1, 'Davi Silva', 25000.00), (2, 'Alexei Ivanov', 45000.00), (3, 'Aaliyah Patel', 15000.00); | List the names of clients who have a total billing amount less than $30,000 | SELECT name FROM clients WHERE total_billing_amount < 30000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(id INT, equipment_name VARCHAR(50), sale_date DATE, country VARCHAR(50), government_agency VARCHAR(50), sale_value INT); CREATE TABLE manufacturer(id INT, name VARCHAR(50)); INSERT INTO sales VALUES (1, 'Fighter Jet', '2017-01-01', 'China', 'Ministry of Defense', 50000000); INSERT INTO manufacturer V... | What is the total value of military equipment sold to the Chinese government by Lockheed Martin from 2017 to 2020? | SELECT SUM(sales.sale_value) FROM sales INNER JOIN manufacturer ON sales.id = manufacturer.id WHERE sales.country = 'China' AND sales.government_agency = 'Ministry of Defense' AND YEAR(sale_date) BETWEEN 2017 AND 2020 AND manufacturer.name = 'Lockheed Martin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (project_id INT, country_id INT, completion_year INT, FOREIGN KEY (country_id) REFERENCES country(id)); | Which military innovation projects were completed before 2015? | SELECT project_id, country_id, completion_year FROM military_innovation WHERE completion_year < 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_sales (id INT, garment_type VARCHAR(50), sustainability_rating INT, country VARCHAR(50), price DECIMAL(5,2)); INSERT INTO garment_sales (id, garment_type, sustainability_rating, country, price) VALUES (1, 'winter coat', 5, 'UK', 350.99), (2, 'winter coat', 3, 'UK', 299.99); | What is the maximum retail price of eco-friendly winter coats sold in the United Kingdom? | SELECT MAX(price) FROM garment_sales WHERE garment_type = 'winter coat' AND country = 'UK' AND sustainability_rating >= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, age INT, donation FLOAT); INSERT INTO donors (id, name, age, donation) VALUES (1, 'John Doe', 35, 500.00); INSERT INTO donors (id, name, age, donation) VALUES (2, 'Jane Smith', 45, 750.00); INSERT INTO donors (id, name, age, donation) VALUES (3, 'Bob Johnson', 25, 600.00); | What is the maximum donation amount in the 'donors' table? | SELECT MAX(donation) FROM donors; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_costs (id INT, country VARCHAR(255), building_type VARCHAR(255), avg_construction_cost FLOAT); INSERT INTO construction_costs (id, country, building_type, avg_construction_cost) VALUES (1, 'Australia', 'Residential', 250000), (2, 'Australia', 'Commercial', 500000), (3, 'Japan', 'Residential', ... | What are the average construction costs for buildings in Australia, Japan, and the United States? | SELECT country, AVG(avg_construction_cost) FROM construction_costs WHERE country IN ('Australia', 'Japan', 'United States') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, artist VARCHAR(100), genre VARCHAR(50)); CREATE VIEW streams_view AS SELECT artist_id, SUM(streams) AS total_streams FROM stream_data GROUP BY artist_id; | Which artists have the highest number of streams on Spotify, by genre? | SELECT g.genre, a.artist, s.total_streams FROM artists a JOIN genres g ON a.genre = g.genre JOIN streams_view s ON a.artist_id = s.artist_id ORDER BY total_streams DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLOAT); INSERT INTO wind_farms (id, name, region, capacity, efficiency) VALUES (1, 'Windfarm C', 'West', 160.3, 0.31); CREATE TABLE solar_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLOA... | How many renewable energy farms (wind and solar) are there in total in the 'West' region? | SELECT COUNT(*) AS total_farms FROM wind_farms WHERE region = 'West' UNION SELECT COUNT(*) AS total_farms FROM solar_farms WHERE region = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_data (id INT, sample_id VARCHAR(20), gene_sequence TEXT); CREATE TABLE bioprocess_data (id INT, sample_id VARCHAR(20), pressure FLOAT); INSERT INTO genetic_data (id, sample_id, gene_sequence) VALUES (1, 'GD001', 'ATGCGA...'), (2, 'GD002', 'ATGCGC...'); INSERT INTO bioprocess_data (id, sample_id, pr... | Delete genetic data with no related bioprocess engineering data. | DELETE gd FROM genetic_data gd LEFT JOIN bioprocess_data bd ON gd.sample_id = bd.sample_id WHERE bd.sample_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_panels (id INT, country VARCHAR(50), energy_efficiency FLOAT); | What is the average energy_efficiency of the solar_panels installed in the US, ordered by the id in descending order? | SELECT AVG(energy_efficiency) AS avg_efficiency FROM solar_panels WHERE country = 'US' GROUP BY country ORDER BY id DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (concert_id INT, concert_date DATE); INSERT INTO concerts (concert_id, concert_date) VALUES (1, '2020-01-01'); INSERT INTO concerts (concert_id, concert_date) VALUES (2, '2020-02-01'); INSERT INTO concerts (concert_id, concert_date) VALUES (3, '2020-03-01'); | Find the number of concerts that took place in each month of the year 2020. | SELECT DATEPART(MONTH, concert_date) as month, COUNT(*) as concerts_per_month FROM concerts WHERE YEAR(concert_date) = 2020 GROUP BY DATEPART(MONTH, concert_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE AgencyYearBudget (AgencyId INT, Year INT, Budget INT, PRIMARY KEY (AgencyId, Year)); INSERT INTO AgencyYearBudget (AgencyId, Year, Budget) VALUES (1, 2019, 5000000); INSERT INTO AgencyYearBudget (AgencyId, Year, Budget) VALUES (1, 2020, 5600000); INSERT INTO AgencyYearBudget (AgencyId, Year, Budget) VALUES... | Which agencies have experienced the highest budget increase between 2019 and 2020? | SELECT AgencyId, MAX(BudgetChange) as HighestBudgetIncrease FROM (SELECT AgencyId, Year, (Budget - LAG(Budget, 1) OVER (PARTITION BY AgencyId ORDER BY Year)) as BudgetChange FROM AgencyYearBudget WHERE Year IN (2019, 2020)) AS BudgetChanges GROUP BY AgencyId; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INTEGER, name TEXT);CREATE TABLE region (id INTEGER, country_id INTEGER, name TEXT);CREATE TABLE iot_sensor (id INTEGER, region_id INTEGER, installed_date DATE); | How many IoT sensors were installed in each country in the past quarter? | SELECT co.name as country, r.name as region, COUNT(s.id) as num_sensors FROM country co INNER JOIN region r ON co.id = r.country_id INNER JOIN iot_sensor s ON r.id = s.region_id WHERE s.installed_date >= DATEADD(quarter, -1, CURRENT_DATE) GROUP BY co.name, r.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Library(Year INT, Number INT); INSERT INTO Library VALUES (2016, 10), (2017, 12), (2018, 14); | How many public libraries were there in 2017 and 2018? | SELECT SUM(Number) FROM Library WHERE Year IN (2017, 2018); | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, post_text VARCHAR(255)); INSERT INTO posts (id, user_id, post_text) VALUES (1, 1, 'I love my friends'), (2, 2, 'I met new people'), (3, 3, 'My best friend is awesome'), (4, 4, 'Nice to meet you'); | What is the total number of posts with the word 'friends' in the text? | SELECT COUNT(*) FROM posts WHERE post_text LIKE '%friends%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE condition_treatment (patient_id INT, condition VARCHAR(50), treatment VARCHAR(50)); INSERT INTO condition_treatment (patient_id, condition, treatment) VALUES (1, 'Anxiety', 'Medication'), (2, 'Depression', 'Medication'), (3, 'PTSD', 'Therapy'), (4, 'Anxiety', 'Therapy'), (5, 'Bipolar Disorder', 'Medication... | List the total number of mental health conditions treated with medication in each state. | SELECT state, COUNT(DISTINCT patient_id) FROM condition_treatment JOIN patient_state ON condition_treatment.patient_id = patient_state.patient_id WHERE treatment = 'Medication' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (id INT, project_name VARCHAR(50), location VARCHAR(50), size_acres DECIMAL(10,2), budget_USD DECIMAL(10,2), start_date DATE, end_date DATE); | Add data to 'habitat_preservation' table | INSERT INTO habitat_preservation (id, project_name, location, size_acres, budget_USD, start_date, end_date) VALUES (1, 'Wildlife Corridor', 'Borneo', 500.00, 250000.00, '2025-01-01', '2027-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (city VARCHAR(20), material VARCHAR(20), year INT, quantity FLOAT); INSERT INTO waste_generation (city, material, year, quantity) VALUES ('Seattle', 'Plastic', 2021, 1500.5); INSERT INTO waste_generation (city, material, year, quantity) VALUES ('Seattle', 'Paper', 2021, 2000.3); INSERT INT... | What is the total waste generation by material type in the city of Seattle in 2021?' | SELECT wg.material, SUM(wg.quantity) as total_quantity FROM waste_generation wg WHERE wg.city = 'Seattle' AND wg.year = 2021 GROUP BY wg.material; | gretelai_synthetic_text_to_sql |
CREATE TABLE TheaterGrants (grantID INT, grantDate DATE, grantAmount DECIMAL(10,2), grantSource VARCHAR(20)); INSERT INTO TheaterGrants (grantID, grantDate, grantAmount, grantSource) VALUES (10, '2022-01-10', 5000.00, 'Government'), (11, '2022-02-12', 7000.00, 'Private'), (12, '2022-03-20', 6000.00, 'Government'); | How many total grants has the local theater received from government sources in the last year? | SELECT SUM(grantAmount) FROM TheaterGrants WHERE grantSource = 'Government' AND grantDate >= '2022-01-01' AND grantDate <= '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_data (project_number INT, state VARCHAR(20), year INT, is_sustainable BOOLEAN); INSERT INTO project_data (project_number, state, year, is_sustainable) VALUES (1, 'Texas', 2019, TRUE); INSERT INTO project_data (project_number, state, year, is_sustainable) VALUES (2, 'Texas', 2018, FALSE); | How many sustainable construction projects were completed in Texas in 2019? | SELECT COUNT(*) FROM project_data WHERE state = 'Texas' AND is_sustainable = TRUE AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA CityData; CREATE TABLE CityParks (Name varchar(255), Size int, Location varchar(255)); | Insert new records for a public park named 'ParkF' with a 'Size' value of 50 and 'Location' value of 'North', in the 'CityData' schema's 'CityParks' table. | INSERT INTO CityData.CityParks (Name, Size, Location) VALUES ('ParkF', 50, 'North'); | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_tour (id INT, name VARCHAR(255), type VARCHAR(255), city VARCHAR(255), price INT, is_eco_friendly BOOLEAN); INSERT INTO eco_tour (id, name, type, city, price, is_eco_friendly) VALUES (1, 'Bike City Tour', 'Tour', 'Berlin', 50, true); | What is the average price of eco-friendly tours in each city? | SELECT city, AVG(price) FROM eco_tour WHERE is_eco_friendly = true GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (strain_type VARCHAR(10), production_quantity INT, state VARCHAR(20)); INSERT INTO production (strain_type, production_quantity, state) VALUES ('indica', 1200, 'California'); INSERT INTO production (strain_type, production_quantity, state) VALUES ('sativa', 800, 'California'); | What is the total production quantity for indica strains in California? | SELECT SUM(production_quantity) FROM production WHERE strain_type = 'indica' AND state = 'California'; | 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.