context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE mobile_usage (customer_id INT, time TIMESTAMP); INSERT INTO mobile_usage (customer_id, time) VALUES (1, TIMESTAMP '2022-01-01 08:00:00'), (2, TIMESTAMP '2022-01-01 12:00:00'), (3, TIMESTAMP '2022-01-01 16:00:00'); | What is the peak usage time for mobile customers in the city of Mumbai? | SELECT MAX(time) FROM mobile_usage WHERE city = 'Mumbai'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects (id INT PRIMARY KEY, region VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO defense_projects (id, region, start_date, end_date) VALUES (1, 'Asia-Pacific', '2023-07-01', '2023-09-30'); ALTER TABLE defense_projects ADD COLUMN delayed BOOLEAN DEFAULT FALSE; UPDATE defense_projects S... | How many defense projects were delayed in the Asia-Pacific region in Q3 2023? | SELECT COUNT(*) FROM defense_projects WHERE region = 'Asia-Pacific' AND delayed = TRUE AND start_date <= '2023-09-30' AND end_date >= '2023-07-01'; | gretelai_synthetic_text_to_sql |
game (game_id, name, genre, release_year) | Add a new game 'NexusRacers' with genre 'Racing' | INSERT INTO game (name, genre, release_year) VALUES ('NexusRacers', 'Racing', 2023) | gretelai_synthetic_text_to_sql |
CREATE TABLE fairness_categories (id INT PRIMARY KEY, category VARCHAR(50), project_name VARCHAR(50)); INSERT INTO fairness_categories (id, category, project_name) VALUES (1, 'Disparate Impact', 'Assessing Data Bias'), (2, 'Disparate Impact', 'Reducing Bias in Models'), (3, 'Bias Mitigation', 'Fair Feature Selection'),... | Number of Algorithmic Fairness projects for 'Disparate Impact' and 'Bias Mitigation' categories. | SELECT COUNT(*), category FROM fairness_categories WHERE category IN ('Disparate Impact', 'Bias Mitigation') GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (Id INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50), Age INT, Gender VARCHAR(50), State VARCHAR(50)); CREATE TABLE Policies (Id INT PRIMARY KEY, PolicyholderId INT, CoverageAmount DECIMAL(10,2), FOREIGN KEY (PolicyholderId) REFERENCES Policyholders(Id)); CREATE TABLE Underwriting... | What is the total premium amount and number of policies for policyholders who have a risk assessment score greater than 90 and live in the state of New York? | SELECT P.State, U.RiskAssessmentScore, SUM(U.Premium) as TotalPremiumAmount, COUNT(P.Id) as NumberOfPolicies FROM Policyholders P JOIN Policies PL ON P.Id = PL.PolicyholderId JOIN Underwriting U ON P.Id = U.PolicyholderId WHERE P.State = 'New York' AND U.RiskAssessmentScore > 90 GROUP BY P.State ORDER BY TotalPremiumAm... | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), year_opened INT, total_employees INT); INSERT INTO mines (id, name, location, year_opened, total_employees) VALUES (1, 'Golden Ridge Mine', 'Australia', 1992, 250); INSERT INTO mines (id, name, location, year_opened, total_employees) VALU... | Which mines in Australia have an average pollution level greater than 4? | SELECT mines.id, AVG(environmental_impact.pollution_level) as avg_pollution FROM environmental_impact JOIN mines ON environmental_impact.mine_id = mines.id WHERE mines.location = 'Australia' GROUP BY mines.id HAVING AVG(environmental_impact.pollution_level) > 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE biotech_startups (id INT, name TEXT, region TEXT, budget FLOAT); INSERT INTO biotech_startups (id, name, region, budget) VALUES (4, 'StartupD', 'West Coast', 8000000), (5, 'StartupE', 'East Coast', 6000000); | What is the total funding for biotech startups in the 'west_coast' region? | SELECT SUM(budget) FROM biotech_startups WHERE region = 'West Coast'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExtractionSites (SiteID INT PRIMARY KEY, SiteName VARCHAR(50), Location VARCHAR(50), Owner VARCHAR(50), OperationalStatus VARCHAR(50), ManagerID INT); INSERT INTO ExtractionSites (SiteID, SiteName, Location, Owner, OperationalStatus, ManagerID) VALUES (1, 'South Africa Gold Mine', 'South Africa', 'Global I... | Which employees are responsible for managing each mining site? | SELECT Employees.FirstName, Employees.LastName, ExtractionSites.SiteName FROM Employees INNER JOIN ExtractionSites ON Employees.EmployeeID = ExtractionSites.ManagerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_vehicles (id INT PRIMARY KEY, make VARCHAR(50), model VARCHAR(50), year INT, top_speed INT); | Calculate the average top speed of autonomous vehicles grouped by make in the 'autonomous_vehicles' table | SELECT make, AVG(top_speed) FROM autonomous_vehicles GROUP BY make; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (drug_name TEXT, approval_year INTEGER, success BOOLEAN); INSERT INTO clinical_trials (drug_name, approval_year, success) VALUES ('DrugA', 2016, true), ('DrugB', 2017, false), ('DrugC', 2018, true), ('DrugD', 2019, true), ('DrugE', 2020, false); | What was the average clinical trial success rate for drugs approved between 2015 and 2020? | SELECT AVG(success) as avg_success_rate FROM (SELECT approval_year, success, COUNT(*) as trials_count FROM clinical_trials WHERE approval_year BETWEEN 2015 AND 2020 GROUP BY approval_year, success) subquery WHERE trials_count > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cultivators (CultivatorID INT, CultivatorName VARCHAR(255), Region VARCHAR(255)); CREATE TABLE Violations (ViolationID INT, CultivatorID INT, ViolationDate DATE); INSERT INTO Cultivators (CultivatorID, CultivatorName, Region) VALUES (1, 'Happy Hemp Farms', 'Northern California'); INSERT INTO Cultivators (C... | Compare the number of violations for cultivators in different regions. | SELECT Region, COUNT(*) AS NumberOfViolations FROM Violations JOIN Cultivators ON Violations.CultivatorID = Cultivators.CultivatorID GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE otas (id INT PRIMARY KEY, hotel_id INT, bookings INT, booking_date DATE); | What is the total number of OTA bookings for hotels in 'Mumbai' in Q3 2022? | SELECT SUM(bookings) FROM otas WHERE city = 'Mumbai' AND EXTRACT(QUARTER FROM booking_date) = 3 AND EXTRACT(YEAR FROM booking_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE taxi_trips (ride_id INT, ride_start_time TIMESTAMP, ride_end_time TIMESTAMP, ride_distance FLOAT, fare FLOAT, trip_type VARCHAR(10)); | What is the total count and average fare of traditional taxi rides per month? | SELECT EXTRACT(MONTH FROM ride_start_time) AS month, COUNT(*) AS total_count, AVG(fare) AS avg_fare FROM taxi_trips WHERE trip_type = 'Traditional Taxi' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tour_data (hotel_id INT, hotel_name TEXT, country TEXT, total_views INT, avg_view_time FLOAT); INSERT INTO virtual_tour_data (hotel_id, hotel_name, country, total_views, avg_view_time) VALUES (1, 'Luxury Resort', 'Mexico', 2000, 120.5), (2, 'Boutique Hotel', 'Spain', 1500, 98.3), (3, 'Beachfront Ho... | What are the unique virtual tour engagement metrics for each hotel in the virtual_tour_data table? | SELECT DISTINCT hotel_name, country, total_views, avg_view_time FROM virtual_tour_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (product_name TEXT, ingredient TEXT); INSERT INTO ingredients (product_name, ingredient) VALUES ('Mascara A', 'Palm Oil'), ('Foundation B', 'Water'), ('Lipstick C', 'Beeswax'); CREATE TABLE sales (product_name TEXT, sale_date DATE, country TEXT); INSERT INTO sales (product_name, sale_date, coun... | Which beauty products are made with palm oil and were sold in Germany? | SELECT product_name FROM product_sales WHERE country = 'Germany' AND ingredient = 'Palm Oil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (menu_id INT, restaurant_id INT, is_organic BOOLEAN);CREATE TABLE sustainable_restaurants (restaurant_id INT); | Determine the proportion of organic meals in the 'menu_items' table for restaurants in the 'sustainable_restaurants' table? | SELECT COUNT(*) * 100.0 / (SELECT COUNT(*) FROM menu_items WHERE restaurant_id IN (SELECT restaurant_id FROM sustainable_restaurants)) as organic_proportion FROM menu_items WHERE is_organic = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistId INT, ArtistName VARCHAR(255), Country VARCHAR(255)); CREATE TABLE Streams (StreamId INT, ArtistId INT, StreamCount INT); INSERT INTO Artists (ArtistId, ArtistName, Country) VALUES (1, 'Taylor Swift', 'USA'), (2, 'BTS', 'South Korea'), (3, 'Ed Sheeran', 'UK'); INSERT INTO Streams (StreamId... | Find the top 5 artists with the highest number of streams in a specific country. | SELECT A.ArtistName, SUM(S.StreamCount) AS TotalStreams FROM Artists A INNER JOIN Streams S ON A.ArtistId = S.ArtistId WHERE A.Country = 'USA' GROUP BY A.ArtistName ORDER BY TotalStreams DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (id INT, name VARCHAR(50), description TEXT, allergens TEXT); INSERT INTO Menu (id, name, description, allergens) VALUES (1, 'Chicken Alfredo', 'Creamy fettuccine with chicken', 'Milk, Eggs'), (2, 'Beef Tacos', 'Soft corn tortillas filled with seasoned beef', 'Wheat'), (3, 'Veggie Burger', 'Grilled ve... | Which menu items contain common allergens? | SELECT name, allergens FROM Menu WHERE allergens IN ('Milk', 'Eggs', 'Wheat'); | gretelai_synthetic_text_to_sql |
peacekeeping_operations | List all peacekeeping operations in Africa | SELECT * FROM peacekeeping_operations WHERE location LIKE '%Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artist_sales (year INT, artist VARCHAR(255), revenue FLOAT); INSERT INTO artist_sales (year, artist, revenue) VALUES (2018, 'Taylor Swift', 1500000), (2018, 'BTS', 1000000), (2019, 'Billie Eilish', 3000000), (2019, 'Ariana Grande', 2000000), (2020, 'The Weeknd', 1000000), (2020, 'Dua Lipa', 1200000); | Which artist earned the most revenue in 2019? | SELECT artist, MAX(revenue) FROM artist_sales WHERE year = 2019 GROUP BY artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE city (id INT, name VARCHAR(50), population INT); INSERT INTO city (id, name, population) VALUES (1, 'San Francisco', 884000); INSERT INTO city (id, name, population) VALUES (2, 'New York', 8601000); INSERT INTO city (id, name, population) VALUES (3, 'Los Angeles', 4000000); INSERT INTO city (id, name, popu... | Which cities have a population greater than 3 million and are not New York? | SELECT name FROM city WHERE population > 3000000 AND name != 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cyber_incidents_by_month(incident_id INT, incident_date DATE, region VARCHAR(255)); INSERT INTO cyber_incidents_by_month(incident_id, incident_date, region) VALUES (1, '2020-01-01', 'Middle East'), (2, '2020-02-01', 'Middle East'), (3, '2020-03-01', 'Middle East'), (4, '2020-04-01', 'Middle East'), (5, '20... | List the number of cybersecurity incidents in the Middle East by month in 2020. | SELECT MONTH(incident_date), COUNT(*) FROM cyber_incidents_by_month WHERE region = 'Middle East' AND YEAR(incident_date) = 2020 GROUP BY MONTH(incident_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (mineral TEXT, impact_score DECIMAL); INSERT INTO environmental_impact (mineral, impact_score) VALUES ('Coal', 19.5), ('Uranium', 21.3), ('Lithium', 15.9), ('Nickel', 13.1), ('Cobalt', 17.8); | What is the average environmental impact score per mineral? | SELECT mineral, AVG(impact_score) FROM environmental_impact GROUP BY mineral; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, artwork VARCHAR(50), artist VARCHAR(50), value INT); INSERT INTO artworks (id, artwork, artist, value) VALUES (1, 'Painting', 'John Smith', 10000), (2, 'Sculpture', 'Maria Rodriguez', 15000), (3, 'Print', 'Jacques Leclerc', 5000); | What is the total value of artworks by artist? | SELECT artist, SUM(value) as total_value FROM artworks GROUP BY artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (author_id INT, name VARCHAR(50), affiliation VARCHAR(100)); INSERT INTO authors (author_id, name, affiliation) VALUES (1, 'Alice', 'University of Oxford'); INSERT INTO authors (author_id, name, affiliation) VALUES (2, 'Bob', 'Google Research'); CREATE TABLE papers (paper_id INT, title VARCHAR(100)... | Find the number of papers published by each author, ordered by the count in descending order, and return only those authors who have published more than 5 papers. | SELECT author_id, COUNT(*) as paper_count FROM papers GROUP BY author_id HAVING COUNT(*) > 5 ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE MarineSpecies (id INT PRIMARY KEY, species VARCHAR(255), researcher VARCHAR(255)); | What is the total number of marine species researched and their respective researchers? | SELECT species, researcher, COUNT(*) as total FROM MarineSpecies GROUP BY species, researcher; | gretelai_synthetic_text_to_sql |
CREATE TABLE Game_Scores (Player_ID INT, Player_Name VARCHAR(50), Game_Name VARCHAR(50), Score INT); INSERT INTO Game_Scores (Player_ID, Player_Name, Game_Name, Score) VALUES (1, 'John Doe', 'Galactic Warriors', 500), (2, 'Jane Smith', 'Galactic Warriors', 800), (3, 'Mike Johnson', 'Galactic Warriors', 300), (4, 'Sara ... | What is the minimum score obtained in the game 'Galactic Warriors'? | SELECT MIN(Score) FROM Game_Scores WHERE Game_Name = 'Galactic Warriors'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonorID INT, DonationDate DATE, Amount DECIMAL(10,2)); INSERT INTO Donations (DonorID, DonationDate, Amount) VALUES (1, '2021-01-02', 500), (2, '2021-03-15', 250), (1, '2021-02-28', 300); | What was the total amount donated by each donor in Q1 2021? | SELECT DonorID, SUM(Amount) as TotalDonation FROM Donations WHERE DonationDate BETWEEN '2021-01-01' AND '2021-03-31' GROUP BY DonorID; | gretelai_synthetic_text_to_sql |
CREATE TABLE industrial_water_usage (state VARCHAR(20), year INT, sector VARCHAR(30), usage FLOAT); INSERT INTO industrial_water_usage (state, year, sector, usage) VALUES ('California', 2020, 'Agriculture', 12345.6), ('California', 2020, 'Manufacturing', 23456.7), ('California', 2020, 'Mining', 34567.8), ('California',... | List the top 5 water consuming industries in California in 2020. | SELECT sector, usage FROM industrial_water_usage WHERE state = 'California' AND year = 2020 ORDER BY usage DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor_readings (sensor_id INT, farm_id INT, temperature FLOAT); | Delete the sensor reading for sensor 002 at farm 501 | DELETE FROM sensor_readings WHERE sensor_id = 002 AND farm_id = 501; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(20), Sexuality VARCHAR(20), Department VARCHAR(20)); INSERT INTO Employees (EmployeeID, Gender, Sexuality, Department) VALUES (1, 'Male', 'Straight', 'IT'), (2, 'Female', 'Lesbian', 'IT'), (3, 'Non-binary', 'Asexual', 'HR'), (4, 'Male', 'Gay', 'HR'); | What is the number of employees who identify as LGBTQ+? | SELECT COUNT(*) FROM Employees WHERE Sexuality <> 'Straight'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_districts(district_name TEXT, created_at DATE); INSERT INTO eco_districts(district_name, created_at) VALUES('G', '2022-01-01'), ('H', '2022-02-01'), ('I', '2022-03-01'); CREATE TABLE district_waste(district_name TEXT, total_waste_gen FLOAT); INSERT INTO district_waste(district_name, total_waste_gen) VA... | What are the waste generation metrics for the newest eco-districts? | SELECT district_name, total_waste_gen FROM district_waste INNER JOIN eco_districts ON district_waste.district_name = eco_districts.district_name ORDER BY created_at DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE oceania_countries (country VARCHAR(50)); CREATE TABLE travel_warnings (country VARCHAR(50), warning VARCHAR(100)); INSERT INTO oceania_countries (country) VALUES ('Australia'), ('New Zealand'), ('Fiji'), ('Papua New Guinea'), ('Samoa'); INSERT INTO travel_warnings (country, warning) VALUES ('Papua New Guin... | Which countries in Oceania have travel advisories? | SELECT country FROM oceania_countries WHERE country NOT IN (SELECT country FROM travel_warnings WHERE warning IS NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, donation_amount FLOAT, donor_country TEXT, organization_id INT); CREATE TABLE organizations (id INT, name TEXT, cause_area TEXT); | What is the average donation amount for each cause area, excluding donations less than $50, for donors from the United States? | SELECT o.cause_area, AVG(donations.donation_amount) as avg_donation_amount FROM donations INNER JOIN organizations o ON donations.organization_id = o.id WHERE donations.donation_amount >= 50 AND donations.donor_country = 'United States' GROUP BY o.cause_area; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (AstronautId INT, Name VARCHAR(50), Age INT, Gender VARCHAR(10), Manufacturer VARCHAR(20)); INSERT INTO Astronauts (AstronautId, Name, Age, Gender, Manufacturer) VALUES (1, 'Anousheh Ansari', 52, 'Female', 'Roscosmos'), (2, 'Yelena Serova', 49, 'Female', 'Roscosmos'), (3, 'Valentina Tereshkova',... | Who are the oldest female astronauts who have flown on a Roscosmos spacecraft? | SELECT Name, Gender, Age FROM Astronauts WHERE Manufacturer = 'Roscosmos' AND Gender = 'Female' AND Age = (SELECT MAX(Age) FROM Astronauts WHERE Gender = 'Female' AND Manufacturer = 'Roscosmos'); | gretelai_synthetic_text_to_sql |
CREATE TABLE software (id INT, name VARCHAR(255), severity VARCHAR(255)); INSERT INTO software (id, name, severity) VALUES (1, 'Windows', 'severe'), (2, 'Linux', 'medium'), (3, 'MacOS', 'low'); | How many severe vulnerabilities exist in the 'software' table? | SELECT COUNT(*) FROM software WHERE severity = 'severe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, call_time TIMESTAMP, location VARCHAR(20)); | What is the minimum response time for emergency calls in the "central" district, for the month of August? | SELECT MIN(EXTRACT(EPOCH FROM call_time - LAG(call_time) OVER (PARTITION BY location ORDER BY call_time)) / 60) FROM emergency_calls WHERE location = 'central' AND EXTRACT(MONTH FROM call_time) = 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (region VARCHAR(255), source VARCHAR(255), date DATE, usage INT); INSERT INTO water_usage (region, source, date, usage) VALUES ('Southern', 'Lake', '2018-01-01', 10000); | What is the average daily water usage for each water source in the southern region in 2018?' | SELECT region, source, AVG(usage) FROM water_usage WHERE region = 'Southern' AND YEAR(date) = 2018 GROUP BY region, source; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), products VARCHAR(255)); CREATE TABLE chemical_inventory (id INT PRIMARY KEY, chemical_name VARCHAR(255), supplier_id INT, impact FLOAT, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); CREATE TABLE environmental_impact (id INT PRI... | Which suppliers have provided chemicals with the highest environmental impact scores in the past year? | SELECT suppliers.name, MAX(environmental_impact.impact) AS max_impact FROM suppliers INNER JOIN chemical_inventory ON suppliers.id = chemical_inventory.supplier_id INNER JOIN environmental_impact ON chemical_inventory.chemical_name = environmental_impact.chemical_name WHERE environmental_impact.date >= DATEADD(year, -1... | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergyProjects (id INT, project_type VARCHAR(50), installed_capacity FLOAT); INSERT INTO RenewableEnergyProjects (id, project_type, installed_capacity) VALUES (1, 'Solar', 1000.0), (2, 'Wind', 2000.0), (3, 'Solar', 1500.0); | What is the maximum installed capacity of renewable energy projects in the 'RenewableEnergyProjects' table, grouped by project_type? | SELECT project_type, MAX(installed_capacity) FROM RenewableEnergyProjects GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_sustainability (hotel_id integer, name text, location text, sustainable_practices text); | Display the number of hotels in the "hotel_sustainability" table that have solar power as a sustainable practice | SELECT COUNT(*) FROM hotel_sustainability WHERE sustainable_practices ILIKE '%Solar Power%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farms (farm_id INT, fish_count INT, water_quality_index FLOAT); INSERT INTO Farms (farm_id, fish_count, water_quality_index) VALUES (1, 500, 75), (2, 800, 68), (3, 650, 72); | Count the number of fish in each farm that has a water quality index above 70? | SELECT farm_id, COUNT(fish_count) FROM Farms WHERE water_quality_index > 70 GROUP BY farm_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE packages (package_id INT, delivery_date DATE, warehouse_location VARCHAR(20), weight FLOAT); INSERT INTO packages (package_id, delivery_date, warehouse_location, weight) VALUES (1, '2021-05-01', 'Warehouse A', 3.5), (2, '2021-06-10', 'Warehouse A', 4.2), (3, '2021-07-20', 'Warehouse C', 6.1); | Remove packages that have a weight greater than 5 kg | DELETE FROM packages WHERE weight > 5.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, name VARCHAR(50)); INSERT INTO players VALUES (1, 'John'); INSERT INTO players VALUES (2, 'Jane'); INSERT INTO players VALUES (3, 'Mark'); CREATE TABLE game_sessions (session_id INT, player_id INT, game VARCHAR(50), duration INT); INSERT INTO game_sessions VALUES (1, 1, 'Action', 12... | How many hours did each player spend playing 'Action' games in the 'game_sessions' table? | SELECT p.name, SUM(gs.duration) as action_hours FROM players p JOIN game_sessions gs ON p.player_id = gs.player_id WHERE gs.game = 'Action' GROUP BY p.player_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE au_peacekeeping (id INT, year INT, location VARCHAR(50)); INSERT INTO au_peacekeeping (id, year, location) VALUES (1, 2018, 'Somalia'), (2, 2019, 'Somalia'), (3, 2020, 'South Sudan'), (4, 2021, 'Mali'); | Which peacekeeping operations were carried out by the African Union in 2020? | SELECT location FROM au_peacekeeping WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name TEXT); INSERT INTO suppliers (id, name) VALUES (1, 'STU'), (2, 'VWX'), (3, 'YZA'); CREATE TABLE ethical_certifications (id INT, supplier_id INT, certification TEXT); INSERT INTO ethical_certifications (id, supplier_id, certification) VALUES (1, 1, 'Fair Trade'), (2, 3, 'Organic'); | Which suppliers have not provided any ethical certifications for their materials? | SELECT s.name FROM suppliers s LEFT JOIN ethical_certifications ec ON s.id = ec.supplier_id WHERE ec.supplier_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_access (id INT, individual_id INT, insurance_status TEXT, state TEXT); INSERT INTO healthcare_access (id, individual_id, insurance_status, state) VALUES (1, 1, 'Insured', 'New Mexico'); INSERT INTO healthcare_access (id, individual_id, insurance_status, state) VALUES (2, 2, 'Uninsured', 'New Mex... | What is the percentage of uninsured individuals in New Mexico? | SELECT (COUNT(*) FILTER (WHERE insurance_status = 'Uninsured')) * 100.0 / COUNT(*) FROM healthcare_access WHERE state = 'New Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_ai_features (hotel_id INT, hotel_name TEXT, region TEXT, ai_feature TEXT); INSERT INTO hotel_ai_features (hotel_id, hotel_name, region, ai_feature) VALUES (4, 'Hotel W', 'Australia', 'Facial Recognition'), (5, 'Hotel X', 'Australia', 'Predictive Maintenance'), (6, 'Hotel Y', 'Australia', 'Automated R... | What are the unique AI features offered by hotels in 'Australia'? | SELECT DISTINCT ai_feature FROM hotel_ai_features WHERE region = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Name VARCHAR(50), Age INT, JoinDate DATE); INSERT INTO Members (MemberID, Name, Age, JoinDate) VALUES (1, 'Hannah Nguyen', 33, '2022-01-15'); INSERT INTO Members (MemberID, Name, Age, JoinDate) VALUES (2, 'Carlos Alvarez', 40, '2021-06-27'); INSERT INTO Members (MemberID, Name, Age, ... | List the names and ages of members who joined in 2022. | SELECT Name, Age FROM Members WHERE YEAR(JoinDate) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE reporters (id INT, name VARCHAR(50), gender VARCHAR(10), age INT, position VARCHAR(20), country VARCHAR(50)); INSERT INTO reporters (id, name, gender, age, position, country) VALUES (1, 'Anna Smith', 'Female', 35, 'News Reporter', 'USA'); INSERT INTO reporters (id, name, gender, age, position, country) VAL... | What is the average age of male reporters from Asia? | SELECT AVG(age) FROM reporters WHERE gender = 'Male' AND country = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE containers (id INT, port VARCHAR(255), handled_date DATE); INSERT INTO containers (id, port, handled_date) VALUES (1, 'XYZ', '2022-01-02'), (2, 'ABC', '2022-02-03'), (3, 'GHI', '2022-03-04'); | Delete all records of containers handled by port 'GHI' | DELETE FROM containers WHERE port = 'GHI'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_responses (id INT, response_type VARCHAR(255), location VARCHAR(255), timestamp TIMESTAMP); INSERT INTO emergency_responses (id, response_type, location, timestamp) VALUES (1, 'EMS', 'Bronx', '2022-01-01 10:00:00'); | What is the number of emergency medical service (EMS) calls in the Bronx? | SELECT COUNT(*) FROM emergency_responses WHERE response_type = 'EMS' AND location = 'Bronx'; | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (product_gender varchar(10), material varchar(20), quantity int); INSERT INTO materials (product_gender, material, quantity) VALUES ('Women', 'organic cotton', 500), ('Women', 'recycled polyester', 300), ('Men', 'sustainable silk', 200), ('Men', 'recycled cotton', 400); | What is the total quantity of materials used in the production of women's and men's products? | SELECT product_gender, SUM(quantity) FROM materials GROUP BY product_gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(50), type VARCHAR(50), distance_from_earth FLOAT); INSERT INTO satellites (id, name, type, distance_from_earth) VALUES (1, 'ISS', 'Space Station', 417.9); INSERT INTO satellites (id, name, type, distance_from_earth) VALUES (2, 'GPS', 'Satellite Constellation', 20200); | What is the average distance of active satellites from the Earth's surface? | SELECT AVG(distance_from_earth) FROM satellites WHERE type = 'Space Station' OR type = 'Satellite Constellation' AND status = 'active'; | gretelai_synthetic_text_to_sql |
CREATE TABLE museums (name VARCHAR(255), city VARCHAR(255), art_pieces INT); INSERT INTO museums (name, city, art_pieces) VALUES ('Louvre Museum, Paris', 'Paris', 35000), ('Musée d’Orsay, Paris', 'Paris', 4000); | What is the total number of art pieces in each museum located in Paris? | SELECT name, SUM(art_pieces) FROM museums WHERE city = 'Paris' GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment_sales (company VARCHAR(255), region VARCHAR(255), year INT, cost INT); INSERT INTO military_equipment_sales (company, region, year, cost) VALUES ('Northrop Grumman', 'Africa', 2019, 5000000); | What was the average cost of military equipment sold by Northrop Grumman to Africa in 2019? | SELECT AVG(cost) FROM military_equipment_sales WHERE company = 'Northrop Grumman' AND region = 'Africa' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE raw_materials (id INT, date_purchased DATE, cost FLOAT); CREATE TABLE chemical_products (id INT, name VARCHAR(50), production_date DATE); | What is the total amount of raw materials used in the production of all chemicals in the past month? | SELECT SUM(cost) FROM raw_materials JOIN chemical_products ON raw_materials.date_purchased >= DATE_SUB(chemical_products.production_date, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE taxi_fleet (fleet_id INT, city VARCHAR(255), vehicle_type VARCHAR(255)); INSERT INTO taxi_fleet (fleet_id, city, vehicle_type) VALUES (1, 'NYC', 'Sedan'), (2, 'LA', 'Wheelchair van'), (3, 'Chicago', 'Sedan'), (4, 'Houston', 'Minivan'), (5, 'Seattle', 'Accessible sedan'); | What is the percentage of accessible vehicles in the taxi fleet? | SELECT COUNT(*) * 100.0 / (SELECT COUNT(*) FROM taxi_fleet) AS percentage_accessible_vehicles FROM taxi_fleet WHERE vehicle_type IN ('Wheelchair van', 'Accessible sedan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, DonationDate DATE, DonationAmount DECIMAL(10,2), DonationPurpose VARCHAR(50)); CREATE TABLE Donors (DonorID INT, DonorName VARCHAR(50), DonationType VARCHAR(50)); | Who are the top 5 donors in the Impact Investing category? | SELECT DonorName, SUM(DonationAmount) FROM Donations d JOIN Donors don ON d.DonorID = don.DonorID WHERE DonationPurpose = 'Impact Investing' GROUP BY DonorID, DonorName ORDER BY SUM(DonationAmount) DESC FETCH NEXT 5 ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL, DonationDate DATE); INSERT INTO Donors (DonorID, DonorName, DonationAmount, DonationDate) VALUES (1, 'John Doe', 50.00, '2019-01-01'); INSERT INTO Donors (DonorID, DonorName, DonationAmount, DonationDate) VALUES (2, 'Jane Smith', 100.00, '2019-04... | What is the total amount donated in Q1 2019? | SELECT SUM(DonationAmount) FROM Donors WHERE QUARTER(DonationDate) = 1 AND YEAR(DonationDate) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (Employee_ID INT, Employee_Name TEXT, Gender TEXT, Age INT); INSERT INTO Employees (Employee_ID, Employee_Name, Gender, Age) VALUES (1, 'John Doe', 'Male', 35); INSERT INTO Employees (Employee_ID, Employee_Name, Gender, Age) VALUES (2, 'Jane Smith', 'Female', 40); | What is the total number of employees and the average age, grouped by gender? | SELECT Gender, AVG(Age) as Average_Age, COUNT(*) as Employee_Count FROM Employees GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, name TEXT, country TEXT); INSERT INTO players (player_id, name, country) VALUES (1, 'Neymar', 'Brazil'), (2, 'Alves', 'Brazil'), (3, 'Muller', 'Germany'); CREATE TABLE assists (assist_id INT, player_id INT, assists INT); INSERT INTO assists (assist_id, player_id, assists) VALUES (1,... | What is the average number of assists per game for players from Brazil? | SELECT AVG(assists) FROM assists JOIN games ON assists.player_id = games.player_id JOIN players ON assists.player_id = players.player_id WHERE players.country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RecyclingRatesByRegion (country VARCHAR(50), region VARCHAR(20), rate DECIMAL(5,2)); INSERT INTO RecyclingRatesByRegion (country, region, rate) VALUES ('Australia', 'Asia-Pacific', 55.3), ('Japan', 'Asia-Pacific', 52.1), ('New Zealand', 'Asia-Pacific', 49.8); | Which countries in the Asia-Pacific region have recycling rates above 50%? | SELECT country FROM RecyclingRatesByRegion WHERE region = 'Asia-Pacific' AND rate > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE germany_projects (id INT, project_name VARCHAR(100), state VARCHAR(50), project_type VARCHAR(50), installed_capacity INT); INSERT INTO germany_projects (id, project_name, state, project_type, installed_capacity) VALUES (1, 'Wind Project A', 'Bavaria', 'Wind', 10000), (2, 'Solar Project A', 'Bavaria', 'Sola... | What is the total installed capacity of renewable energy projects in the state of Bavaria, Germany, grouped by project type? | SELECT project_type, SUM(installed_capacity) FROM germany_projects WHERE state = 'Bavaria' GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_customers (customer_id INT, region VARCHAR(50)); CREATE TABLE regional_offices (office_id INT, region VARCHAR(50), num_customers INT); INSERT INTO broadband_customers (customer_id, region) VALUES (1, 'Northeast'); INSERT INTO broadband_customers (customer_id, region) VALUES (2, 'Southeast'); INSE... | How many broadband customers does each regional office support? | SELECT r.region, COUNT(b.customer_id) FROM broadband_customers b INNER JOIN regional_offices r ON b.region = r.region GROUP BY r.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE gold_mine (site_id INT, country VARCHAR(50), num_employees INT, extraction_date DATE, quantity INT); INSERT INTO gold_mine (site_id, country, num_employees, extraction_date, quantity) VALUES (1, 'Canada', 80, '2016-01-02', 100), (2, 'Canada', 90, '2016-12-31', 150), (3, 'Canada', 70, '2016-03-04', 200); | Calculate the average daily production quantity of gold for mining sites in Canada with over 75 employees, for the year 2016. | SELECT country, AVG(quantity) as avg_daily_gold_prod FROM gold_mine WHERE num_employees > 75 AND country = 'Canada' AND extraction_date >= '2016-01-01' AND extraction_date <= '2016-12-31' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_vehicles_by_type (id INT PRIMARY KEY, city VARCHAR(255), type VARCHAR(255), num_vehicles INT); | List the number of electric vehicles in each city, for each vehicle type | CREATE VIEW electric_vehicles_by_type_city AS SELECT city, type, COUNT(*) as num_vehicles FROM electric_vehicles GROUP BY city, type; SELECT * FROM electric_vehicles_by_type_city; | gretelai_synthetic_text_to_sql |
CREATE TABLE LaborRights (id INT, year INT, sector VARCHAR(255), violations INT); INSERT INTO LaborRights (id, year, sector, violations) VALUES (1, 2020, 'Manufacturing', 30); | How many labor rights violations were recorded in the Manufacturing sector in 2020? | SELECT SUM(violations) FROM LaborRights WHERE sector = 'Manufacturing' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinic_FL (patient_id INT, name VARCHAR(50)); INSERT INTO clinic_FL (patient_id, name) VALUES (1, 'John Doe'), (2, 'Jane Smith'), (3, 'Alice Johnson'); | Delete the record of 'Jane Smith' from 'clinic_FL'. | DELETE FROM clinic_FL WHERE name = 'Jane Smith'; | gretelai_synthetic_text_to_sql |
CREATE TABLE trucks (id INT PRIMARY KEY, make VARCHAR(50), model VARCHAR(50), year INT); | Add a new record to the "trucks" table for a new truck from "Mercedes" with a year of 2024 | INSERT INTO trucks (id, make, model, year) VALUES (3, 'Mercedes', 'eCitaro', 2024); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name VARCHAR(255), category VARCHAR(255), cruelty_free BOOLEAN); INSERT INTO products (id, name, category, cruelty_free) VALUES (1, 'Lipstick', 'luxury', true), (2, 'Mascara', 'luxury', true), (3, 'Eyeshadow', 'luxury', false); | Delete all records of cruelty-free makeup products from the 'luxury' category. | DELETE FROM products WHERE category = 'luxury' AND cruelty_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_mission_duration (spacecraft_name TEXT, mission_name TEXT, duration INTEGER, start_date DATE, end_date DATE); INSERT INTO spacecraft_mission_duration (spacecraft_name, mission_name, duration, start_date, end_date) VALUES ('Voyager 1', 'Voyager 1 Mission', 43733, '1977-09-05', ' Still operational... | Which spacecraft has the longest continuous mission duration? | SELECT spacecraft_name, MAX(duration) as longest_continuous_mission_duration FROM spacecraft_mission_duration WHERE end_date = ' Still operational'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (CaseID INT, Category VARCHAR(50), BillingAmount DECIMAL(10,2)); INSERT INTO Cases (CaseID, Category, BillingAmount) VALUES (1, 'Family', 2000.00), (2, 'Civil', 3000.00), (3, 'Personal Injury', 4000.00); | What is the average billing amount for cases in each category? | SELECT Category, AVG(BillingAmount) FROM Cases GROUP BY Category; | gretelai_synthetic_text_to_sql |
CREATE TABLE school_info (school_id INT, num_students INT, open_pedagogy_participation BOOLEAN); INSERT INTO school_info (school_id, num_students, open_pedagogy_participation) VALUES (100, 150, TRUE), (200, 250, FALSE), (300, 180, TRUE), (400, 120, TRUE), (500, 300, FALSE); | What is the total number of students who have participated in open pedagogy initiatives in schools with more than 150 students? | SELECT COUNT(*) as total_participants FROM school_info WHERE num_students > 150 AND open_pedagogy_participation = TRUE; | gretelai_synthetic_text_to_sql |
CREATE VIEW resort_hotels AS SELECT * FROM hotels WHERE hotel_name LIKE '%Resort'; CREATE TABLE hotel_prices (hotel_id INT, price INT); | What is the minimum price for each hotel in the resort_hotels view? | SELECT h.hotel_name, MIN(hp.price) FROM resort_hotels h JOIN hotel_prices hp ON h.id = hp.hotel_id GROUP BY h.hotel_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE model_data (model_id INT, team VARCHAR(255)); INSERT INTO model_data (model_id, team) VALUES (1, 'Team A'), (2, 'Team B'), (3, 'Team C'), (4, 'Team B'), (5, 'Team A'); | How many models were developed by 'Team B' or 'Team C'? | SELECT COUNT(*) FROM model_data WHERE team IN ('Team B', 'Team C'); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_expenditure (id INT, country VARCHAR(255), year INT, expenditure INT); INSERT INTO military_expenditure (id, country, year, expenditure) VALUES (1, 'USA', 2017, 700000), (2, 'China', 2017, 300000), (3, 'Russia', 2017, 200000), (4, 'USA', 2018, 750000), (5, 'China', 2018, 350000), (6, 'Russia', 201... | What is the total military expenditure for each country over the past 5 years? | SELECT c.name, SUM(me.expenditure) as total_expenditure FROM military_expenditure me JOIN countries c ON me.country = c.name WHERE me.year BETWEEN 2017 AND 2021 GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, accessibility_needs BOOLEAN, country VARCHAR(255)); INSERT INTO users (id, accessibility_needs, country) VALUES (1, true, 'USA'), (2, false, 'Canada'), (3, true, 'Mexico'), (4, false, 'Brazil'), (5, true, 'USA'), (6, false, 'Argentina'), (7, true, 'Chile'); | What is the average number of users with accessibility needs per country? | SELECT AVG(accessibility_needs) FROM (SELECT COUNT(*) AS accessibility_needs, country FROM users GROUP BY country) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_info (policy_id INT, policy_holder TEXT, coverage_amount INT); | Insert a new policy for 'Sophia Rodriguez' with a coverage amount of $350,000 into the policy_info table | INSERT INTO policy_info (policy_id, policy_holder, coverage_amount) VALUES (4, 'Sophia Rodriguez', 350000); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorID int, RecipientID int, DonationDate date, AmountDonated float); INSERT INTO Donations (DonationID, DonorID, RecipientID, DonationDate, AmountDonated) VALUES (1, 1, 101, '2022-01-01', 5000.00), (2, 2, 102, '2022-02-01', 7000.00), (3, 1, 103, '2022-03-01', 8000.00), (4, 5, 1... | Find the top 3 countries with the highest total donation amount in 2022. | SELECT RecipientID, SUM(AmountDonated) AS TotalDonated FROM Donations WHERE YEAR(DonationDate) = 2022 GROUP BY RecipientID ORDER BY TotalDonated DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, title VARCHAR(255), season INT, lead_actor VARCHAR(255)); INSERT INTO tv_shows (id, title, season, lead_actor) VALUES (1, 'The Queen''s Gambit', 1, 'Anya Taylor-Joy'); | What's the name of the lead actor in 'The Queen's Gambit'? | SELECT lead_actor FROM tv_shows WHERE title = 'The Queen''s Gambit'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName VARCHAR(100), Program VARCHAR(50), SignUpDate DATE); CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(100), ProgramDate DATE); | What's the average number of volunteers per program in the year 2019? | SELECT AVG(VolunteersPerProgram) FROM (SELECT COUNT(*) AS VolunteersPerProgram FROM Volunteers WHERE YEAR(SignUpDate) = 2019 GROUP BY Program) AS Subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (product_id INT, product_name TEXT, price DECIMAL(5,2), product_category TEXT, country TEXT); INSERT INTO Products (product_id, product_name, price, product_category, country) VALUES (1, 'Ruby Woo', 18.00, 'Lipstick', 'Spain'), (2, 'Russian Red', 19.50, 'Lipstick', 'Spain'), (3, 'Lady Danger', 17.... | What are the average prices for lipsticks and foundations in Spain? | SELECT product_category, AVG(price) AS avg_price FROM Products WHERE country = 'Spain' GROUP BY product_category; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; USE biotech; CREATE TABLE if not exists startup_funding (id INT PRIMARY KEY, company_name VARCHAR(255), location VARCHAR(255), funding_amount FLOAT); INSERT INTO startup_funding (id, company_name, location, funding_amount) VALUES (1, 'Genetech', 'USA', 5000000.00), (2, 'BioGen', 'US... | What is the maximum funding amount for biotech startups in South America? | SELECT MAX(funding_amount) FROM biotech.startup_funding WHERE location = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, garment_type VARCHAR(20), color VARCHAR(20), price DECIMAL(10, 2), quantity INT); | What are the top 5 best-selling garments in terms of quantity sold? | SELECT garment_type, SUM(quantity) AS quantity_sold FROM sales GROUP BY garment_type ORDER BY quantity_sold DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (id INT, name VARCHAR(255)); INSERT INTO teams (id, name) VALUES (1, 'TeamA'), (2, 'TeamB'), (3, 'TeamC'); CREATE TABLE merchandise_sales (team_id INT, year INT, quarter INT, revenue DECIMAL(10,2)); | What was the total revenue for each team's merchandise sales by quarter in 2022? | SELECT t.name, m.quarter, SUM(m.revenue) as total_revenue FROM merchandise_sales m JOIN teams t ON m.team_id = t.id WHERE m.year = 2022 GROUP BY t.name, m.quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (id INT, name VARCHAR(50), category VARCHAR(50), price DECIMAL(5,2), cruelty_free BOOLEAN); INSERT INTO Products (id, name, category, price, cruelty_free) VALUES (1, 'Nourishing Lipstick', 'Makeup', 14.99, true), (2, 'Luxury Foundation', 'Makeup', 45.50, false), (3, 'Tinted Mascara', 'Makeup', 8.9... | What is the average price of cruelty-free makeup products? | SELECT AVG(p.price) as avg_price FROM Products p WHERE p.category = 'Makeup' AND p.cruelty_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_donations (program_id INT, donation_amount DECIMAL); | Calculate the total donation amount for each program in 'Education & Outreach' | SELECT program_id, SUM(donation_amount) FROM program_donations WHERE program_id IN (SELECT id FROM programs WHERE name = 'Education & Outreach') GROUP BY program_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergy (ProjectID INT, CO2EmissionReduction FLOAT); | What is the CO2 emission reduction of renewable energy projects in the RenewableEnergy schema? | select avg(CO2EmissionReduction) as avg_reduction from RenewableEnergy; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (call_id INT, call_time TIME, call_day VARCHAR(10));CREATE TABLE response_times (response_time_id INT, call_id INT, response_time INT); | What is the average response time for emergency calls during weekdays and weekends? | SELECT CASE WHEN DATEPART(dw, call_time) IN (1, 7) THEN 'Weekend' ELSE 'Weekday' END AS day_type, AVG(response_time) AS avg_response_time FROM emergency_calls JOIN response_times ON emergency_calls.call_id = response_times.call_id GROUP BY CASE WHEN DATEPART(dw, call_time) IN (1, 7) THEN 'Weekend' ELSE 'Weekday' END; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibitions (id INT, name VARCHAR(50), type VARCHAR(50), visitor_count INT); INSERT INTO exhibitions (id, name, type, visitor_count) VALUES (1, 'Cubism', 'Modern Art', 1200), (2, 'Abstract', 'Modern Art', 1800), (3, 'Impressionism', 'Classic Art', 1400); CREATE TABLE modern_art_visits (id INT, exhibition_... | What was the total number of visits to the modern art exhibitions? | SELECT SUM(no_visitors) FROM modern_art_visits; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_heritage_sites (site_id INT, name TEXT, country TEXT, visitors INT); INSERT INTO cultural_heritage_sites (site_id, name, country, visitors) VALUES (1, 'Neuschwanstein Castle', 'Germany', 1500000), (2, 'Brandenburg Gate', 'Germany', 1200000), (3, 'Chichen Itza', 'Mexico', 2000000), (4, 'Teotihuacan... | Find the top 3 most visited cultural heritage sites in Mexico and Argentina. | SELECT name, visitors FROM cultural_heritage_sites WHERE country IN ('Mexico', 'Argentina') ORDER BY visitors DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE AgriculturalTraining(TrainingID INT, TrainingName VARCHAR(50), TrainingDuration INT); | Add a new column 'TrainerName' with a data type of VARCHAR(50) to the 'AgriculturalTraining' table | ALTER TABLE AgriculturalTraining ADD TrainerName VARCHAR(50); | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT, state VARCHAR(50), consumption FLOAT, date DATE); INSERT INTO water_usage (id, state, consumption, date) VALUES (1, 'Texas', 12000, '2022-02-01'); INSERT INTO water_usage (id, state, consumption, date) VALUES (2, 'Texas', 13000, '2022-02-02'); | Find the total water consumption in cubic meters for the state of Texas in February 2022 | SELECT SUM(consumption) FROM water_usage WHERE state = 'Texas' AND date >= '2022-02-01' AND date <= '2022-02-28'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ontario_green_buildings (id INT, province VARCHAR(20)); INSERT INTO ontario_green_buildings (id, province) VALUES (1, 'Ontario'), (2, 'Quebec'); | Display the total number of green buildings in the province of Ontario, Canada. | SELECT COUNT(*) FROM ontario_green_buildings WHERE province = 'Ontario'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID int, Name varchar(50), Region varchar(50)); INSERT INTO Attorneys VALUES (1, 'John Smith', 'Northeast'), (2, 'Jane Doe', 'Southeast'); CREATE TABLE Cases (CaseID int, AttorneyID int); INSERT INTO Cases VALUES (1, 1), (2, 1), (3, 2), (4, 2); | How many cases were handled by attorneys in each region? | SELECT A.Region, COUNT(C.CaseID) as NumCases FROM Attorneys A JOIN Cases C ON A.AttorneyID = C.AttorneyID GROUP BY A.Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), location VARCHAR(255), sustainable_practices BOOLEAN); CREATE TABLE garments (id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2), quantity INT, supplier_id INT); CREATE TABLE manufacturing_costs (id INT, garment_id INT, labor_cost DECIMAL(5,2), materi... | Who are the suppliers located in India? | SELECT suppliers.name FROM suppliers WHERE suppliers.location = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation (id INT, city VARCHAR(50), state VARCHAR(50), riders INT); INSERT INTO transportation (id, city, state, riders) VALUES (1, 'City A', 'New York', 10000), (2, 'City B', 'New York', 20000), (3, 'City A', 'New York', 15000); | What is the total number of public transportation riders by city in the state of New York? | SELECT state, city, SUM(riders) as total_riders FROM transportation GROUP BY state, city; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerHours (VolunteerID INT, Program VARCHAR(50), Hours INT, VolunteerDate DATE); | Create a table for tracking volunteer hours, with columns for VolunteerID, Program, Hours, and Date. | CREATE TABLE VolunteerHours (VolunteerID INT, Program VARCHAR(50), Hours INT, VolunteerDate DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE Railway (railway_id INT, region VARCHAR(20), resilience_score DECIMAL(3,2)); INSERT INTO Railway (railway_id, region, resilience_score) VALUES (1, 'Midwest', 92.00), (2, 'Northwest', 85.00); | What is the count of railways in the Midwest with a resilience score over 90? | SELECT COUNT(*) FROM Railway WHERE region = 'Midwest' AND resilience_score > 90; | 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.