context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE CybersecurityIncidents (IncidentID INT, IncidentType VARCHAR(20), IncidentDate DATE); INSERT INTO CybersecurityIncidents (IncidentID, IncidentType, IncidentDate) VALUES (1, 'Malware', '2021-01-01'), (2, 'Phishing', '2021-02-15'), (3, 'Data Breach', '2021-03-28'), (4, 'Malware', '2022-04-05'), (5, 'Phishing... | What is the total number of cybersecurity incidents and their types for each year? | SELECT YEAR(IncidentDate) as Year, IncidentType, COUNT(*) as Total FROM CybersecurityIncidents GROUP BY YEAR(IncidentDate), IncidentType; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodations (accommodation_id INT, student_id INT, accommodation_type VARCHAR(255), accommodation_date DATE); CREATE TABLE Students (student_id INT, department VARCHAR(255)); | What is the number of students who received accommodations for the first time each month? | SELECT MONTH(accommodation_date) as month, COUNT(DISTINCT student_id) as number_of_students FROM Accommodations WHERE student_id NOT IN ( SELECT student_id FROM Accommodations WHERE accommodation_date < ( SELECT MIN(accommodation_date) FROM Accommodations )) GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE wnba_players (player_id INT, name VARCHAR(50), team VARCHAR(50), position VARCHAR(20), points_per_game FLOAT); INSERT INTO wnba_players (player_id, name, team, position, points_per_game) VALUES (1, 'Breanna Stewart', 'Seattle Storm', 'Power Forward', 20.3); INSERT INTO wnba_players (player_id, name, team, ... | What is the average points per game for a WNBA player? | SELECT AVG(points_per_game) FROM wnba_players; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (Employee_ID INT, Mine_ID INT, Age INT, Gender VARCHAR(10), Department VARCHAR(20), Hire_Date DATE); INSERT INTO Employees (Employee_ID, Mine_ID, Age, Gender, Department, Hire_Date) VALUES (101, 1, 32, 'Male', 'Mining', '2018-05-23'), (102, 1, 45, 'Female', 'Mining', '2017-08-11'), (103, 2, 42, '... | Count the number of employees in each mine, categorized by gender. | SELECT Mine_ID, Gender, COUNT(*) FROM Employees GROUP BY Mine_ID, Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE MusicHall (concert_id INT, concert_name VARCHAR(50), date DATE, ticket_price DECIMAL(5,2), fan_age INT); | What is the average age and ticket price for concerts in the 'MusicHall' venue? | SELECT AVG(fan_age) AS avg_age, AVG(ticket_price) AS avg_ticket_price FROM MusicHall; | gretelai_synthetic_text_to_sql |
CREATE TABLE submarines (id INT, name VARCHAR(20), max_depth FLOAT); INSERT INTO submarines (id, name, max_depth) VALUES (1, 'Nautilus', 5000), (2, 'Alvin', 4500), (3, 'Mir', 6170); | What is the maximum depth explored by each submarine? | SELECT name, max_depth FROM submarines; | gretelai_synthetic_text_to_sql |
CREATE TABLE power_plants (name TEXT, country TEXT, technology TEXT, capacity INTEGER, year_built INTEGER); INSERT INTO power_plants (name, country, technology, capacity, year_built) VALUES ('Solana', 'United States', 'Solar', 280, 2013); INSERT INTO power_plants (name, country, technology, capacity, year_built) VALUES... | Which renewable energy power plants were built after 2016 and have a higher installed capacity than any power plant in France? | SELECT * FROM power_plants WHERE country != 'France' AND year_built > 2016 AND capacity > (SELECT MAX(capacity) FROM power_plants WHERE country = 'France'); | gretelai_synthetic_text_to_sql |
CREATE TABLE releases (artist_id INT, release_date DATE); | Find the number of unique artists who have not released any music in the last 5 years, across all genres. | SELECT COUNT(DISTINCT artist_id) FROM releases WHERE release_date < DATE_SUB(CURDATE(), INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (city_id INT, name VARCHAR(255), country VARCHAR(255)); CREATE TABLE virtual_tours (tour_id INT, city_id INT, type VARCHAR(255)); | Identify the top 5 cities with the highest number of virtual tours. | SELECT c.name, COUNT(vt.tour_id) as tour_count FROM cities c JOIN virtual_tours vt ON c.city_id = vt.city_id GROUP BY c.name ORDER BY tour_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Founders (id INT, name TEXT, gender TEXT); INSERT INTO Founders (id, name, gender) VALUES (1, 'Acme Corp', 'Female'); INSERT INTO Founders (id, name, gender) VALUES (2, 'Brick Co', 'Male'); CREATE TABLE Investors (id INT, tier TEXT, name TEXT); INSERT INTO Investors (id, tier, name) VALUES (1, 'Tier 1', 'S... | Which companies have female founders and have received funding from Tier 1 investors? | SELECT Founders.name FROM Founders JOIN Investments ON Founders.name = Investments.company_name JOIN Investors ON Investments.investor_id = Investors.id WHERE Founders.gender = 'Female' AND Investors.tier = 'Tier 1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_data_1 (id INT, data TEXT); INSERT INTO genetic_data_1 (id, data) VALUES (1, 'ATGC'), (2, 'CGTA'), (3, 'TGAC'); CREATE TABLE genetic_data_2 (id INT, data TEXT); INSERT INTO genetic_data_2 (id, data) VALUES (1, 'ATGC'), (2, 'CGTA'), (3, 'TGAC'); | Which genetic research data tables have more than 1000 records? | SELECT name FROM (SELECT COUNT(*) as count, 'genetic_data_1' as name FROM genetic_data_1 UNION ALL SELECT COUNT(*), 'genetic_data_2' FROM genetic_data_2) as subquery WHERE count > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE MonthlyVisitors (Destination VARCHAR(50), VisitorCount INT, VisitDate DATE); INSERT INTO MonthlyVisitors VALUES ('Berlin', 800, '2022-01-01'), ('Berlin', 900, '2022-01-31'), ('London', 1000, '2022-01-01'), ('London', 1100, '2022-01-31'); | Determine the percentage change in visitors for each destination between the first and last days of the month. | SELECT Destination, (VisitorCountEnd - VisitorCountStart) * 100.0 / VisitorCountStart as PercentageChange FROM (SELECT Destination, FIRST_VALUE(VisitorCount) OVER (PARTITION BY Destination ORDER BY VisitDate ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as VisitorCountStart, LAST_VALUE(VisitorCount) OVER (P... | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyIncidents (IncidentID INT, PlantID INT, IncidentDate DATE); INSERT INTO SafetyIncidents (IncidentID, PlantID, IncidentDate) VALUES (1, 101, '2020-06-15'), (2, 102, '2020-07-22'), (3, 101, '2021-02-03'), (4, 103, '2021-04-10'), (5, 104, '2021-05-05'), (6, 105, '2021-05-20'); CREATE TABLE Manufacturing... | What are the top 5 manufacturing plants with the highest safety incident rate in the Asia region in the past 12 months? | SELECT PlantLocation, COUNT(DISTINCT PlantID) AS SafetyIncidentCount FROM SafetyIncidents JOIN ManufacturingPlants ON SafetyIncidents.PlantID = ManufacturingPlants.PlantID WHERE IncidentDate >= DATE_SUB(CURRENT_DATE, INTERVAL 12 MONTH) AND Region = 'Asia' GROUP BY PlantLocation ORDER BY SafetyIncidentCount DESC LIMIT 5... | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (project_id INT, project_name VARCHAR(255), region VARCHAR(255), focus_area VARCHAR(255), PRIMARY KEY(project_id)); INSERT INTO research_projects (project_id, project_name, region, focus_area) VALUES (1, 'Coral Conservation Research', 'Indian Ocean', 'Deep-sea Coral'); | Find total number of scientific research projects in the Indian Ocean on deep-sea coral conservation. | SELECT COUNT(*) FROM research_projects WHERE region = 'Indian Ocean' AND focus_area = 'Deep-sea Coral'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, donor_name VARCHAR(50), donation_amount DECIMAL(10,2), donation_date DATE, country VARCHAR(50)); INSERT INTO Donations (id, donor_name, donation_amount, donation_date, country) VALUES (1, 'John Doe', 50.00, '2021-01-01', 'USA'); INSERT INTO Donations (id, donor_name, donation_amount, don... | Which countries have the highest total donation amounts? | SELECT country, SUM(donation_amount) as total_donations FROM Donations GROUP BY country ORDER BY total_donations DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, category TEXT, is_circular_supply_chain BOOLEAN); INSERT INTO products (product_id, product_name, category, is_circular_supply_chain) VALUES (1, 'Refurbished Smartphone', 'Electronics', FALSE), (2, 'Upcycled Furniture', 'Home Decor', TRUE), (3, 'Vintage Clothing... | How many products are there in each category that are not produced using circular supply chains? | SELECT category, COUNT(*) FROM products WHERE is_circular_supply_chain = FALSE GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_expenses (expense_id INT, program_name VARCHAR(50), expense_date DATE, amount DECIMAL(10,2)); INSERT INTO program_expenses VALUES (1, 'Education', '2022-01-15', 5000.00), (2, 'Health', '2022-03-01', 7000.00), (3, 'Education', '2022-02-28', 4000.00); | Which program had the highest expense in Q1 2022? | SELECT program_name, MAX(amount) as max_expense FROM program_expenses WHERE expense_date BETWEEN '2022-01-01' AND '2022-03-31' GROUP BY program_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_data_usage (id INT PRIMARY KEY, customer_id INT, usage_bytes BIGINT, usage_date DATE); CREATE TABLE customer_demographics (id INT PRIMARY KEY, customer_id INT, age INT, gender VARCHAR(255), income FLOAT); | What is the total data usage for customers in a specific postal code, grouped by week and joined with the customer demographics table to show age, gender, and income? | SELECT WEEK(du.usage_date) as week, c.age, c.gender, c.income, SUM(du.usage_bytes) as total_usage FROM customer_data_usage du INNER JOIN customer_demographics c ON du.customer_id = c.customer_id WHERE c.postal_code = '12345' GROUP BY week, c.age, c.gender, c.income; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, name VARCHAR(50), habitat VARCHAR(50), population INT); | What is the total number of marine species found in deep-sea hydrothermal vents?' | SELECT SUM(population) AS total_species FROM marine_species WHERE habitat = 'deep-sea hydrothermal vents'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Garments (id INT, name VARCHAR(255), category VARCHAR(255), color VARCHAR(255), size VARCHAR(10), price DECIMAL(5, 2)); | Delete all garments in the 'Dresses' category with a price above $100.00 | DELETE FROM Garments WHERE category = 'Dresses' AND price > 100.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE WastewaterTreatment (Id INT, Plant VARCHAR(50), Wastewater DECIMAL(5,2), Date DATE); INSERT INTO WastewaterTreatment (Id, Plant, Wastewater, Date) VALUES (1, 'Denver Plant', 1600.5, '2021-07-15'); INSERT INTO WastewaterTreatment (Id, Plant, Wastewater, Date) VALUES (2, 'Colorado Springs Plant', 1300.3, '20... | Which wastewater treatment plants treated more than 1500 m³ of wastewater on July 15, 2021? | SELECT Plant, SUM(Wastewater) FROM WastewaterTreatment WHERE Date = '2021-07-15' GROUP BY Plant HAVING SUM(Wastewater) > 1500; | gretelai_synthetic_text_to_sql |
CREATE TABLE AI_Safety_Papers3 (id INT, title TEXT, authors INT); INSERT INTO AI_Safety_Papers3 (id, title, authors) VALUES (1, 'Paper1', 15), (2, 'Paper2', 5), (3, 'Paper3', 35), (4, 'Paper4', 20); | Delete AI safety research papers with less than 10 authors. | DELETE FROM AI_Safety_Papers3 WHERE authors < 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment (state VARCHAR(2), unemployment_rate DECIMAL(4,2), snapshot_date DATE); INSERT INTO veteran_employment VALUES ('CA', 3.2, '2021-07-15'), ('TX', 4.1, '2021-07-15'), ('NY', 5.0, '2021-07-15'); | List veteran unemployment rates by state for the most recent month. | SELECT state, unemployment_rate FROM veteran_employment WHERE snapshot_date = (SELECT MAX(snapshot_date) FROM veteran_employment); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition (exhibition_id INT, exhibition_name VARCHAR(30), genre VARCHAR(20), duration INT); | What is the total duration of all exhibitions in the 'Cubism' genre, in minutes? | SELECT SUM(Exhibition.duration) FROM Exhibition WHERE Exhibition.genre = 'Cubism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (operation_id INT, name VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO peacekeeping_operations (operation_id, name, location, start_date, end_date) VALUES (1, 'MINUSMA', 'Mali', '2013-07-25', '2024-12-31'); | Insert data into the 'peacekeeping_operations' table | INSERT INTO peacekeeping_operations (operation_id, name, location, start_date, end_date) VALUES (2, 'MONUSCO', 'Democratic Republic of the Congo', '1999-11-30', '2024-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE WorkoutDuration (MemberId INT, TotalDuration INT); INSERT INTO WorkoutDuration (MemberId, TotalDuration) VALUES (1, 120), (2, 150), (3, 90); | Find the total time spent on workouts for each member? | SELECT MemberId, SUM(Duration) FROM Workouts GROUP BY MemberId; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerStats (PlayerID INT, Kills INT, Deaths INT, Assists INT); | Determine the average KDA ratio for each player in 'PlayerStats' table | SELECT PlayerID, AVG(Kills/Deaths + Assists) as AverageKDA FROM PlayerStats GROUP BY PlayerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_properties (id INT, name VARCHAR(50), min_temperature FLOAT); | What is the minimum temperature required to safely store chemical Y? | SELECT min_temperature FROM chemical_properties WHERE name = 'chemical Y'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Disasters (disaster_id INT, name VARCHAR(255), type VARCHAR(255), affected_people INT, region VARCHAR(255), date DATE); INSERT INTO Disasters (disaster_id, name, type, affected_people, region, date) VALUES (1, 'Floods', 'Hydrological', 800, 'Asia', '2018-01-01'); | What are the names and types of disasters that have impacted more than 100 people in the 'Africa' region in the year 2020, with no limitation on the date? | SELECT name, type FROM Disasters WHERE region = 'Africa' AND affected_people > 100 AND date >= '2020-01-01' AND date < '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE resolved_complaints (id INT PRIMARY KEY, complaint TEXT, date DATE); | Create a table to archive resolved complaints | CREATE TABLE resolved_complaints AS SELECT id, complaint, date FROM customer_complaints WHERE resolved = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_vessels (vessel_id INT, name VARCHAR(50), type VARCHAR(50), last_visit_date DATE); INSERT INTO research_vessels (vessel_id, name, type, last_visit_date) VALUES (1, 'RRS Discovery', 'Oceanographic Research Vessel', '2018-03-21'), (2, 'MV Alucia', 'Oceanographic Research Vessel', '2015-06-02'), (3, ... | Which oceanographic research vessels have visited the Galapagos Islands since 2010? | SELECT name FROM research_vessels WHERE type = 'Oceanographic Research Vessel' AND last_visit_date >= '2010-01-01' AND last_visit_date <= '2022-12-31' AND location = 'Galapagos Islands'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(255), birth_date DATE, nationality VARCHAR(50)); | What is the total number of visual artists represented in the database, and what is the distribution by their country of origin? | SELECT COUNT(*) as total_artists, nationality FROM artists GROUP BY nationality; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT, name TEXT, state TEXT); CREATE TABLE sales (dispensary_id INT, strain_id INT, quantity INT, price DECIMAL(10,2), sale_date DATE); INSERT INTO dispensaries (id, name, state) VALUES (1, 'Dispensary A', 'Washington'); INSERT INTO sales (dispensary_id, strain_id, quantity, price, sale_dat... | Calculate the total revenue for each dispensary in Washington in Q1 2023 and sort by revenue in descending order | SELECT d.name, SUM(s.quantity * s.price) as total_revenue FROM dispensaries d JOIN sales s ON d.id = s.dispensary_id WHERE s.sale_date BETWEEN '2023-01-01' AND '2023-03-31' GROUP BY d.name ORDER BY total_revenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (Mission VARCHAR(50), LaunchSite VARCHAR(50), Satellites INT); INSERT INTO SpaceMissions (Mission, LaunchSite, Satellites) VALUES ('STS-1', 'Kennedy Space Center', 2), ('STS-2', 'Kennedy Space Center', 0), ('Spacelab-1', 'Kennedy Space Center', 7); | List the space missions and their launch sites, along with the number of satellites deployed in each mission. | SELECT Mission, LaunchSite, Satellites FROM SpaceMissions; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_revenue_quarterly (hotel_id INT, category TEXT, revenue FLOAT, quarter INT, year INT); INSERT INTO hotel_revenue_quarterly (hotel_id, category, revenue, quarter, year) VALUES (1, 'business', 5000, 1, 2022), (2, 'leisure', 3000, 3, 2022), (3, 'business', 7000, 2, 2022); | What is the total revenue for the 'leisure' category in Q3 of 2022? | SELECT SUM(revenue) FROM hotel_revenue_quarterly WHERE category = 'leisure' AND quarter = 3 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselPerformance(PerformanceID INT, VesselID INT, Speed FLOAT, PerformanceDate DATETIME); INSERT INTO VesselPerformance(PerformanceID, VesselID, Speed, PerformanceDate) VALUES (1, 1, 16.5, '2021-02-03 11:00:00'), (2, 2, 17.3, '2021-02-05 16:30:00'), (3, 3, 18.1, '2021-02-07 10:00:00'); | Who was the top performing vessel in terms of speed in the month of February 2021? | SELECT VesselID, MAX(Speed) FROM VesselPerformance WHERE PerformanceDate BETWEEN '2021-02-01' AND '2021-02-28' GROUP BY VesselID; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (production_id INT, fabric_type VARCHAR(50), units INT, production_date DATE); | What is the total number of units produced for each fabric type in Q2 of 2022? | SELECT fabric_type, SUM(units) as q2_production FROM production WHERE production_date BETWEEN '2022-04-01' AND '2022-06-30' GROUP BY fabric_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT PRIMARY KEY, year INT, location VARCHAR(50), usage FLOAT); INSERT INTO water_usage (id, year, location, usage) VALUES (1, 2019, 'Miami', 1234.56), (2, 2019, 'Honolulu', 897.45), (3, 2019, 'Anchorage', 987.65), (4, 2019, 'Santa Fe', 789.12), (5, 2019, 'Boise', 567.89); | Calculate the average water usage in cubic meters for each location in the year 2019 | SELECT location, AVG(usage) FROM water_usage WHERE year = 2019 GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT PRIMARY KEY, name TEXT, location TEXT); | Insert a new heritage site in 'Japan' named 'Meiji Shrine' | INSERT INTO heritage_sites (id, name, location) VALUES (1, 'Meiji Shrine', 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, total_employees INT, female_employees INT, male_employees INT); INSERT INTO mines (id, name, location, total_employees, female_employees, male_employees) VALUES (1, 'Golden Mine', 'Colorado, USA', 300, 150, 150), (2, 'Silver Ridge', 'Nevada, USA', 400, 200, 200), (3... | Which mines have a higher proportion of female employees compared to male employees? | SELECT name FROM mines WHERE female_employees > (male_employees * 1.0) * (SELECT AVG(female_employees / male_employees) FROM mines) | gretelai_synthetic_text_to_sql |
CREATE TABLE tugboats (id INT PRIMARY KEY, name VARCHAR(50), year_built INT, type VARCHAR(50)); | What are the names and types of all tugboats in the 'tugboats' table that were built before 1990? | SELECT name, type FROM tugboats WHERE year_built < 1990; | gretelai_synthetic_text_to_sql |
CREATE TABLE container_ships (id INT, name VARCHAR(100), ports_of_call INT, region VARCHAR(50)); | List the names and number of ports of call for container ships in the Southern Ocean. | SELECT name, ports_of_call FROM container_ships WHERE region = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE judges (id INT, first_name VARCHAR(20), last_name VARCHAR(20), court_id INT); INSERT INTO judges (id, first_name, last_name, court_id) VALUES (1, 'Maria', 'Garcia', 1); INSERT INTO judges (id, first_name, last_name, court_id) VALUES (2, 'Juan', 'Rodriguez', 2); | Delete all records in the "judges" table where the judge's last name is "Garcia" | DELETE FROM judges WHERE last_name = 'Garcia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapy_info (patient_id INT, therapy VARCHAR(50), frequency INT); INSERT INTO therapy_info (patient_id, therapy, frequency) VALUES (1, 'Therapy', 10), (2, 'Therapy', 15), (3, 'CBT', 20), (4, 'Therapy', 5), (5, 'Family Therapy', 8); CREATE TABLE patient_address (patient_id INT, address VARCHAR(50)); INSERT... | Count the number of patients who received therapy in Florida. | SELECT COUNT(patient_id) FROM therapy_info JOIN patient_address ON therapy_info.patient_id = patient_address.patient_id WHERE therapy = 'Therapy' AND address = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_depths (location TEXT, depth INT); INSERT INTO ocean_depths (location, depth) VALUES ('Atlantic Ocean Shallows', '100'), ('Pacific Ocean Depths', '8000'); | Identify the shallowest point in the Atlantic Ocean. | SELECT location, depth FROM ocean_depths WHERE depth = (SELECT MIN(depth) FROM ocean_depths WHERE location = 'Atlantic Ocean') AND location = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE svalbard_temperature(month INT, year INT, temperature FLOAT); INSERT INTO svalbard_temperature(month, year, temperature) VALUES (1, 2000, 2.5), (2, 2000, 3.2), (1, 2001, 1.8); | Which month has the highest temperature in Svalbard? | SELECT month, MAX(temperature) max_temp FROM svalbard_temperature GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects(id INT, project_name VARCHAR(50), start_date DATE, end_date DATE, status VARCHAR(20), country VARCHAR(20)); | What is the total number of defense projects in each country and their average duration? | SELECT country, AVG(DATEDIFF(end_date, start_date)) AS avg_duration, COUNT(*) AS total_projects FROM defense_projects GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicMeetings (ID INT, Date DATE, Status VARCHAR(255)); | Add a new record to the "PublicMeetings" table with the ID of 4, a date of '2022-09-15', and a status of 'Scheduled' | INSERT INTO PublicMeetings (ID, Date, Status) VALUES (4, '2022-09-15', 'Scheduled'); | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, course_id INT, pd_date DATE); INSERT INTO teacher_pd (teacher_id, course_id, pd_date) VALUES (1, 1, '2021-01-01'), (2, 2, '2021-02-15'), (3, 1, '2021-03-10'), (4, 3, '2021-12-31'); CREATE TABLE courses (course_id INT, course_name TEXT); INSERT INTO courses (course_id, course_nam... | Which professional development courses were most popular among teachers in 2021? | SELECT c.course_name, COUNT(pd.teacher_id) AS num_teachers FROM teacher_pd pd JOIN courses c ON pd.course_id = c.course_id WHERE pd.pd_date >= '2021-01-01' AND pd.pd_date <= '2021-12-31' GROUP BY pd.course_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (id INT, name VARCHAR(50), location VARCHAR(50));CREATE TABLE gold_mine (mine_id INT, amount INT);CREATE TABLE silver_mine (mine_id INT, amount INT); | List the names and locations of mines that have mined either gold or silver, but not both. | SELECT m.name, m.location FROM mine m LEFT JOIN gold_mine g ON m.id = g.mine_id LEFT JOIN silver_mine s ON m.id = s.mine_id WHERE g.mine_id IS NOT NULL AND s.mine_id IS NULL OR s.mine_id IS NOT NULL AND g.mine_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodations (StudentID INT, DisabilityType VARCHAR(50), Gender VARCHAR(50), Region VARCHAR(50), AccommodationYear INT); INSERT INTO Accommodations (StudentID, DisabilityType, Gender, Region, AccommodationYear) VALUES (1, 'Visual Impairment', 'Male', 'Midwest', 2020), (2, 'Hearing Impairment', 'Female', ... | What is the total number of students who received accommodations by disability type and gender in the Midwest region for the year 2020? | SELECT DisabilityType, Gender, COUNT(StudentID) FROM Accommodations WHERE Region = 'Midwest' AND AccommodationYear = 2020 GROUP BY DisabilityType, Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT, num_virtual_tours INT, ai_customer_service BOOLEAN); INSERT INTO hotels (hotel_id, hotel_name, country, num_virtual_tours, ai_customer_service) VALUES (1, 'Hotel Y', 'Canada', 100, TRUE), (2, 'Hotel Z', 'Canada', 75, FALSE), (3, 'Hotel AA', 'Canada', 125... | What is the average number of virtual tours per hotel in Canada for hotels that have adopted AI-based customer service? | SELECT AVG(num_virtual_tours) FROM hotels WHERE country = 'Canada' AND ai_customer_service = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT); CREATE TABLE Budgets (BudgetID INT, ProgramID INT, BudgetAmount DECIMAL(10,2)); INSERT INTO Programs (ProgramID, ProgramName) VALUES (1, 'Education'), (2, 'Health'); INSERT INTO Budgets (BudgetID, ProgramID, BudgetAmount) VALUES (1, 1, 1000.00), (2, 1, 500.00), (... | List the programs with their associated outcomes and total budget from the 'Programs' and 'Budgets' tables. | SELECT Programs.ProgramName, SUM(Budgets.BudgetAmount) as TotalBudget FROM Programs INNER JOIN Budgets ON Programs.ProgramID = Budgets.ProgramID GROUP BY Programs.ProgramName; | gretelai_synthetic_text_to_sql |
CREATE TABLE CitizenFeedback (District VARCHAR(10), Year INT, FeedbackCount INT); INSERT INTO CitizenFeedback VALUES ('District E', 2022, 800), ('District E', 2022, 900), ('District F', 2022, 700), ('District F', 2022, 600); | How many citizens provided feedback in District E and F in 2022? | SELECT SUM(FeedbackCount) FROM CitizenFeedback WHERE District IN ('District E', 'District F') AND Year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (grant_id INT, title VARCHAR(50), budget INT); INSERT INTO grants VALUES (1, 'Research Grant 1', 50000); INSERT INTO grants VALUES (2, 'Research Grant 2', 120000); | Update the budget of a research grant with a given grant_id. | UPDATE grants SET budget = 75000 WHERE grant_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Household_Types (name VARCHAR(50), median_income INT); INSERT INTO Household_Types (name, median_income) VALUES ('Single', 50000), ('Family', 75000), ('Senior', 40000); | What is the median income for each household type? | SELECT name, MEDIAN(median_income) FROM Household_Types GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT PRIMARY KEY, location TEXT, minority_owner BOOLEAN); INSERT INTO dispensaries (id, location, minority_owner) VALUES (1, 'Colorado', TRUE); INSERT INTO dispensaries (id, location, minority_owner) VALUES (2, 'Colorado', FALSE); CREATE TABLE inventory (id INT PRIMARY KEY, dispensary_id IN... | For dispensaries located in Colorado with a minority owner, what is the average price of their products, and how many consumers have made a purchase from each of these dispensaries? | SELECT d.location, AVG(i.price) as avg_price, COUNT(t.sale_id) as num_consumers FROM dispensaries d INNER JOIN inventory i ON d.id = i.dispensary_id INNER JOIN transactions t ON i.id = t.sale_id WHERE d.location = 'Colorado' AND d.minority_owner = TRUE GROUP BY d.location; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicleAdoptionStatistics (Id INT, Country VARCHAR(50), AdoptionRate DECIMAL(5,2), Year INT); INSERT INTO ElectricVehicleAdoptionStatistics (Id, Country, AdoptionRate, Year) VALUES (1, 'USA', 0.12, 2018); INSERT INTO ElectricVehicleAdoptionStatistics (Id, Country, AdoptionRate, Year) VALUES (2, 'Ch... | Update the adoption rate of electric vehicles in South Korea to 0.15 for the year 2021. | UPDATE ElectricVehicleAdoptionStatistics SET AdoptionRate = 0.15 WHERE Country = 'South Korea' AND Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name VARCHAR(20)); INSERT INTO mines (id, name) VALUES (1, 'Golden Mine'), (2, 'Silver Mine'); CREATE TABLE mine_production (mine_id INT, volume INT); INSERT INTO mine_production (mine_id, volume) VALUES (1, 1000), (1, 1200), (2, 1500); | Show the total production volume for each mine in the "mine_production" and "mines" tables | SELECT m.name, SUM(mp.volume) as total_volume FROM mines m JOIN mine_production mp ON m.id = mp.mine_id GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Items (item_id INT, item_name TEXT); | Update the item_name for item_id 123 to 'First Aid Kit'. | UPDATE Items SET Items.item_name = 'First Aid Kit' WHERE Items.item_id = 123; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_interests (user_id INT, interest VARCHAR(50)); INSERT INTO user_interests (user_id, interest) VALUES (1, 'climate change'), (1, 'veganism'), (2, 'climate change'), (3, 'veganism'), (3, 'animal rights'), (4, 'climate change'), (5, 'veganism'), (6, 'climate change'), (6, 'renewable energy'); | What are the unique interests of users who have engaged with both posts about climate change and posts about veganism? | SELECT interest FROM user_interests WHERE user_id IN (SELECT user_id FROM user_interests WHERE interest = 'climate change' INTERSECT SELECT user_id FROM user_interests WHERE interest = 'veganism'); | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_id INT PRIMARY KEY, state_name VARCHAR(255)); INSERT INTO states (state_id, state_name) VALUES (1, 'Alabama'), (2, 'Alaska'), (3, 'Arizona'); CREATE TABLE vaccinations (state_id INT, vaccine_count INT); INSERT INTO vaccinations (state_id, vaccine_count) VALUES (1, 2000), (2, 3000), (3, 4000); | What is the number of vaccines administered per state? | SELECT s.state_name, v.vaccine_count FROM states s JOIN vaccinations v ON s.state_id = v.state_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (org_id int, num_employees int, country varchar(50), donation_date date); INSERT INTO organizations (org_id, num_employees, country, donation_date) VALUES (1, 150, 'Canada', '2021-01-01'), (2, 50, 'Canada', '2021-02-01'), (3, 200, 'Canada', '2021-03-01'); | What is the total amount donated by organizations with more than 100 employees in Canada, in the year 2021? | SELECT SUM(donation_amount) FROM donations INNER JOIN organizations ON donations.org_id = organizations.org_id WHERE organizations.country = 'Canada' AND YEAR(donation_date) = 2021 GROUP BY organizations.org_id HAVING num_employees > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_aid_organizations (org_id INT, name VARCHAR(50), cases_handled INT, cases_type VARCHAR(50), state VARCHAR(2)); INSERT INTO legal_aid_organizations (org_id, name, cases_handled, cases_type, state) VALUES (1, 'California Legal Aid', 200, 'access to justice, criminal justice reform', 'CA'), (2, 'New Yor... | Find the number of criminal justice reform cases handled by legal aid organizations in New York | SELECT SUM(cases_handled) FROM legal_aid_organizations WHERE cases_type LIKE '%criminal justice reform%' AND state = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, country TEXT); INSERT INTO companies (id, name, country) VALUES (1, 'Acme Inc', 'USA'), (2, 'Beta Corp', 'USA'); CREATE TABLE funding (company_id INT, amount INT); INSERT INTO funding (company_id, amount) VALUES (1, 5000000), (2, 7000000); | What is the average funding amount per company founded in the US? | SELECT AVG(funding.amount) FROM funding JOIN companies ON funding.company_id = companies.id WHERE companies.country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, timestamp TIMESTAMP, region VARCHAR(255), incident_type VARCHAR(255)); INSERT INTO security_incidents (id, timestamp, region, incident_type) VALUES (1, '2022-06-01 10:00:00', 'North America', 'Phishing'), (2, '2022-06-01 10:00:00', 'Asia', 'Malware'); | What is the distribution of security incidents by geographical region for the last month? | SELECT region, incident_type, COUNT(*) as incident_count FROM security_incidents WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 MONTH) GROUP BY region, incident_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings (id INT, name TEXT, city TEXT, energy_efficiency FLOAT); INSERT INTO buildings (id, name, city, energy_efficiency) VALUES (1, 'The Shard', 'London', 0.20), (2, '20 Fenchurch Street', 'London', 0.25); | What is the minimum energy efficiency (in kWh/m^2) of buildings in the city 'London'? | SELECT MIN(energy_efficiency) FROM buildings WHERE city = 'London'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EconomicDiversification (id INT, program VARCHAR(20), score FLOAT, year INT); INSERT INTO EconomicDiversification (id, program, score, year) VALUES (1, 'Agriculture', 75.0, 2020), (2, 'Industry', 77.5, 2021), (3, 'Services', 80.0, 2019), (4, 'Tourism', 82.5, 2018), (5, 'Agriculture', 70.0, 2020); | Which economic diversification programs had the lowest score in 2020? | SELECT program, MIN(score) FROM EconomicDiversification WHERE year = 2020 GROUP BY program; | gretelai_synthetic_text_to_sql |
CREATE TABLE attack_vectors (id INT, attack_vector VARCHAR(255), region VARCHAR(255), incident_count INT); INSERT INTO attack_vectors (id, attack_vector, region, incident_count) VALUES (1, 'Phishing', 'APAC', 50), (2, 'Malware', 'APAC', 75), (3, 'SQL Injection', 'APAC', 30), (4, 'Cross-site Scripting', 'APAC', 40), (5,... | What are the top 5 attack vectors by total count of incidents in the APAC region? | SELECT attack_vector, SUM(incident_count) as total_incidents FROM attack_vectors WHERE region = 'APAC' GROUP BY attack_vector ORDER BY total_incidents DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_data (building_id INT, building_type VARCHAR(255), square_footage INT, construction_year INT); | What is the total square footage of commercial buildings that were constructed in 2020 in the 'building_data' table? | select sum(square_footage) as total_square_footage from building_data where building_type = 'commercial' and construction_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA CleanEnergy; CREATE TABLE Projects (project_id INT, name VARCHAR(100), type VARCHAR(50), installed_capacity INT, carbon_offset INT); INSERT INTO CleanEnergy.Projects (project_id, name, type, installed_capacity, carbon_offset) VALUES (1, 'SolarFarm 1', 'Solar', 150000, 5000), (2, 'WindFarm 2', 'Wind', 1200... | What are the carbon offsets and renewable energy types for projects with installed capacities greater than 100000 in the 'CleanEnergy' schema? | SELECT type, carbon_offset FROM CleanEnergy.Projects WHERE installed_capacity > 100000; | gretelai_synthetic_text_to_sql |
CREATE TABLE RetailerC (item VARCHAR(20), stock INT); INSERT INTO RetailerC VALUES ('Pants', 400); | How many 'Pants' are in stock with 'Retailer C'? | SELECT SUM(stock) FROM RetailerC WHERE item = 'Pants' AND retailer = 'Retailer C'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (drug_name VARCHAR(255), approval_region VARCHAR(255), approval_date DATE); INSERT INTO drug_approval (drug_name, approval_region, approval_date) VALUES ('DrugX', 'Asia-Pacific', '2017-01-01'); | What is the number of drugs approved in the 'Asia-Pacific' region for each year? | SELECT approval_region, YEAR(approval_date) AS year, COUNT(*) FROM drug_approval WHERE approval_region = 'Asia-Pacific' GROUP BY approval_region, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_price (drug_name TEXT, quarter TEXT, year INTEGER, sale_price NUMERIC(10, 2)); INSERT INTO sales_price (drug_name, quarter, year, sale_price) VALUES ('DrugA', 'Q1', 2021, 120.50), ('DrugA', 'Q2', 2021, 125.00), ('DrugB', 'Q1', 2021, 150.75), ('DrugB', 'Q2', 2021, 155.00); | What was the average sales price for each drug by quarter in 2021? | SELECT drug_name, quarter, AVG(sale_price) as avg_sales_price FROM sales_price WHERE year = 2021 GROUP BY drug_name, quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, property_price FLOAT, size INT); INSERT INTO green_buildings (id, property_price, size) VALUES (1, 600000, 200), (2, 700000, 250), (3, 800000, 300); | What is the minimum property price per square meter for properties larger than 150 square meters in the green_buildings table? | SELECT MIN(property_price/size) FROM green_buildings WHERE size > 150; | gretelai_synthetic_text_to_sql |
CREATE TABLE city (id INT, name VARCHAR(255)); INSERT INTO city (id, name) VALUES (1, 'Mumbai'); CREATE TABLE restaurant (id INT, name VARCHAR(255), city_id INT); INSERT INTO restaurant (id, name, city_id) VALUES (1, 'Spice Kitchen', 1), (2, 'Pizza Palace', 1), (3, 'Sushi House', 1); CREATE TABLE menu (id INT, item VAR... | Show the total daily sales for each restaurant in 'Mumbai' | SELECT r.name, SUM(m.daily_sales) as total_sales FROM menu m JOIN restaurant r ON m.restaurant_id = r.id JOIN city c ON r.city_id = c.id WHERE c.name = 'Mumbai' GROUP BY r.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (permit_id INT, building_type VARCHAR(20), city VARCHAR(20), issue_date DATE); INSERT INTO building_permits (permit_id, building_type, city, issue_date) VALUES (4, 'Commercial', 'Los Angeles', '2018-04-01'), (5, 'Residential', 'Los Angeles', '2019-07-15'), (6, 'Commercial', 'Los Angeles', ... | How many permits were issued for commercial buildings in Los Angeles between 2018 and 2020? | SELECT COUNT(*) FROM building_permits WHERE building_type = 'Commercial' AND city = 'Los Angeles' AND issue_date BETWEEN '2018-01-01' AND '2020-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, name VARCHAR(50), age INT, gender VARCHAR(10)); | Who is the oldest female artist in the 'artists' table? | SELECT name FROM artists WHERE gender = 'female' ORDER BY age DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_region (union_id INT, region_id INT, total_members INT); CREATE TABLE regions (region_id INT, region_name TEXT); INSERT INTO union_region (union_id, region_id, total_members) VALUES (1, 1, 100), (2, 1, 200), (3, 2, 300), (4, 2, 400), (5, 3, 500); INSERT INTO regions (region_id, region_name) VALUES (1... | Calculate the average number of members per union in each region. | SELECT regions.region_name, AVG(union_region.total_members) FROM union_region INNER JOIN regions ON union_region.region_id = regions.region_id GROUP BY regions.region_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ratings (rating_id INT, product_id INT, brand_name VARCHAR(100), rating DECIMAL(3,2)); | Which beauty brands have a high consumer satisfaction rating in the North American region? | SELECT brand_name, AVG(rating) as avg_rating FROM ratings WHERE sale_date >= '2022-01-01' AND country LIKE 'North America%' GROUP BY brand_name ORDER BY avg_rating DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetics (product_id INT, product_name VARCHAR(100), rating DECIMAL(2,1), is_recyclable BOOLEAN); | What is the average rating of cosmetic products with a recyclable packaging label? | SELECT AVG(rating) FROM cosmetics WHERE is_recyclable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, country VARCHAR(255), sales_volume FLOAT); INSERT INTO regions (id, country, sales_volume) VALUES (3, 'Germany', 7000.00); INSERT INTO regions (id, country, sales_volume) VALUES (4, 'Spain', 4000.00); | What is the total revenue for stores in each country, with a 10% discount applied? | SELECT r.country, SUM(s.revenue * 0.9) as total_revenue FROM sales s JOIN regions r ON s.store LIKE CONCAT('%', r.country, '%') GROUP BY r.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste (ingredient VARCHAR(255), quantity INT, waste_date DATE); INSERT INTO waste VALUES ('Garlic', 50, '2022-01-01'); INSERT INTO waste VALUES ('Tomatoes', 200, '2022-01-02'); | What is the total waste generated for each ingredient in a given time period? | SELECT i.ingredient, SUM(w.quantity) AS total_waste, w.waste_date FROM waste w INNER JOIN inventory i ON w.ingredient = i.ingredient GROUP BY i.ingredient, w.waste_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (id INT, department VARCHAR(255), year INT, amount DECIMAL(10,2)); INSERT INTO grants (id, department, year, amount) VALUES (1, 'Engineering', 2020, 100000), (2, 'Engineering', 2019, 120000), (3, 'Biology', 2020, 80000); | What is the maximum grant amount awarded to the Engineering department? | SELECT MAX(amount) FROM grants WHERE department = 'Engineering'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, region VARCHAR(255)); INSERT INTO marine_species (id, region) VALUES (1, 'Arctic'), (2, 'Antarctic'), (3, 'Indian'); | Identify the number of marine species in the Arctic and Antarctic regions. | SELECT region, COUNT(id) FROM marine_species WHERE region IN ('Arctic', 'Antarctic') GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE actors (id INT, title TEXT, actor TEXT); | What is the name of the actor who has acted in the most movies in the actors table? | SELECT actor FROM actors GROUP BY actor ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donation_amount DECIMAL(10,2), donation_date DATE, donor_name VARCHAR(50)); | What is the maximum and minimum donation amount made by a single donor in 2021? | SELECT donor_id, MAX(donation_amount) FROM donors WHERE donation_date >= '2021-01-01' AND donation_date < '2022-01-01' GROUP BY donor_id; SELECT donor_id, MIN(donation_amount) FROM donors WHERE donation_date >= '2021-01-01' AND donation_date < '2022-01-01' GROUP BY donor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_year INT, founder_gender TEXT); INSERT INTO company (id, name, founding_year, founder_gender) VALUES (1, 'Delta Inc', 2016, 'female'); INSERT INTO company (id, name, founding_year, founder_gender) VALUES (2, 'Epsilon Corp', 2019, 'male'); INSERT INTO company (id, name, ... | What is the total funding amount for companies founded by women in the last 5 years? | SELECT SUM(funding_amount) FROM investment_rounds ir INNER JOIN company c ON ir.company_id = c.id WHERE c.founder_gender = 'female' AND c.founding_year >= YEAR(CURRENT_DATE) - 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (id INT, name VARCHAR(50), category VARCHAR(50), cost FLOAT, year INT, status VARCHAR(20)); INSERT INTO Projects (id, name, category, cost, year, status) VALUES (1, 'Wind Farm', 'Renewable Energy', 1000000, 2018, 'Completed'), (2, 'Solar Farm', 'Renewable Energy', 1200000, 2019, 'Completed'), (3, ... | How many projects were completed in 'Renewable Energy' category each year? | SELECT category, year, COUNT(*) FROM Projects WHERE category = 'Renewable Energy' AND status = 'Completed' GROUP BY category, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName VARCHAR(50), DonationAmount DECIMAL(10,2), CauseID INT, Age INT);CREATE TABLE Causes (CauseID INT, CauseName VARCHAR(50)); | Which causes received the most donations from donors aged 30-40? | SELECT C.CauseName, SUM(D.DonationAmount) FROM Donors D JOIN Causes C ON D.CauseID = C.CauseID WHERE D.Age BETWEEN 30 AND 40 GROUP BY C.CauseName ORDER BY SUM(D.DonationAmount) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE art_forms_2 (id INT, name TEXT, type TEXT, num_practitioners INT, location TEXT); INSERT INTO art_forms_2 (id, name, type, num_practitioners, location) VALUES (1, 'Ukiyo-e', 'Printmaking', 400, 'Asia'), (2, 'Kabuki', 'Theater', 600, 'Asia'), (3, 'Ikebana', 'Flower Arrangement', 700, 'Asia'); | Which traditional arts have the highest number of active practitioners in Asia? | SELECT name FROM art_forms_2 WHERE location = 'Asia' AND num_practitioners = (SELECT MAX(num_practitioners) FROM art_forms_2 WHERE location = 'Asia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INT, name VARCHAR(50), type VARCHAR(50)); INSERT INTO vessels (vessel_id, name, type) VALUES (1, 'MV Ocean Wave', 'Container Ship'), (2, 'MS Ocean Breeze', 'Tanker'), (3, 'MV Ocean Tide', 'Tanker'); | What is the type of the vessel with ID 2 in the 'vessels' table? | SELECT type FROM vessels WHERE vessel_id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, name VARCHAR(50), genre VARCHAR(50)); INSERT INTO artists (artist_id, name, genre) VALUES (1, 'Claude Monet', 'Painting'); CREATE TABLE art_pieces (art_piece_id INT, title VARCHAR(50), year_made INT, artist_id INT); INSERT INTO art_pieces (art_piece_id, title, year_made, artist_id) ... | Which artists have not created any art pieces? | SELECT a.name FROM artists a LEFT JOIN art_pieces ap ON a.artist_id = ap.artist_id WHERE ap.art_piece_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offsets (country VARCHAR(255), program VARCHAR(255)); INSERT INTO carbon_offsets (country, program) VALUES ('US', 'Tree Planting'), ('US', 'Renewable Energy'), ('Canada', 'Tree Planting'), ('Germany', 'Energy Efficiency'); | How many carbon offset programs have been implemented in each country? | SELECT country, COUNT(program) AS num_programs FROM carbon_offsets GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, name VARCHAR(50)); INSERT INTO athletes (athlete_id, name) VALUES (1, 'John Doe'); CREATE TABLE stadiums (stadium_id INT, name VARCHAR(50)); INSERT INTO stadiums (stadium_id, name) VALUES (1, 'Yankee Stadium'); | Which athletes in the 'Athletes' table have the same name as a stadium in the 'Stadiums' table? | SELECT a.name FROM athletes a INNER JOIN stadiums s ON a.name = s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, Amount FLOAT, DonationDate DATE); INSERT INTO Donations (DonationID, DonorID, Amount, DonationDate) VALUES (1, 1, 500.00, '2021-01-01'), (2, 1, 250.00, '2021-02-14'); | What was the average donation amount per month in 2021, sorted by month? | SELECT MONTH(DonationDate) as Month, AVG(Amount) as AvgDonation FROM Donations WHERE YEAR(DonationDate) = 2021 GROUP BY Month ORDER BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE refugee_support (refugee_id INT, organization_id INT, age INT, gender VARCHAR(10), support_date DATE); INSERT INTO refugee_support (refugee_id, organization_id, age, gender, support_date) VALUES (1, 201, 23, 'Male', '2021-01-12'), (2, 201, 30, 'Female', '2021-02-03'), (3, 202, 18, 'Male', '2021-03-25'), (4... | How many refugees were supported by each organization by age group and gender in Q1 2021? | SELECT organization_id, gender, age_group, COUNT(*) as supported_refugees FROM (SELECT organization_id, gender, CASE WHEN age <= 17 THEN 'Minor' WHEN age BETWEEN 18 AND 64 THEN 'Adult' ELSE 'Senior' END as age_group FROM refugee_support WHERE EXTRACT(QUARTER FROM support_date) = 1 AND EXTRACT(YEAR FROM support_date) = ... | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodations (ID INT, Type VARCHAR(50), Cost FLOAT, Disability VARCHAR(50), Region VARCHAR(50)); INSERT INTO Accommodations (ID, Type, Cost, Disability, Region) VALUES (1, 'Note-taking Services', 1000.0, 'Learning Disability', 'Midwest'), (2, 'Extra Time for Exams', 1200.0, 'Learning Disability', 'Midwes... | What is the total budget for accommodations and support programs for students with learning disabilities in the Midwest? | SELECT SUM(A.Cost) + SUM(S.Cost) FROM Accommodations A, SupportPrograms S WHERE A.Disability = 'Learning Disability' AND S.Disability = 'Learning Disability' AND A.Region = 'Midwest' AND S.Region = 'Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_sales (id INT, title VARCHAR(255), genre VARCHAR(50), revenue FLOAT); INSERT INTO music_sales (id, title, genre, revenue) VALUES (1, 'Song1', 'Pop', 25000.0), (2, 'Song2', 'Rock', 30000.0), (3, 'Song3', 'Pop', 20000.0); | What is the total revenue for the 'Pop' genre in the 'music_sales' table? | SELECT SUM(revenue) FROM music_sales WHERE genre = 'Pop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (policyholder_id INT, claim_number INT, state VARCHAR(2)); INSERT INTO claims (policyholder_id, claim_number, state) VALUES (1, 1, 'MI'), (2, 1, 'MI'), (3, 1, 'OH'); | Identify policyholders who have never made a claim in Michigan | SELECT policyholder_id FROM claims WHERE state = 'MI' GROUP BY policyholder_id HAVING COUNT(claim_number) = 1; | 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.