context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE InfrastructureProjects (id INT, region VARCHAR(20), cost FLOAT, year INT); INSERT INTO InfrastructureProjects (id, region, cost, year) VALUES (1, 'Southern', 150000, 2020), (2, 'Northern', 200000, 2019), (3, 'Southern', 120000, 2018); | What was the total cost of all infrastructure projects in the Southern region in 2020? | SELECT SUM(cost) FROM InfrastructureProjects WHERE region = 'Southern' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, category VARCHAR(20), cost FLOAT); INSERT INTO Infrastructure (id, category, cost) VALUES (1, 'Transportation', 5000000), (2, 'WaterSupply', 3000000), (3, 'Transportation', 7000000), (4, 'WaterSupply', 1000000), (5, 'SewerSystems', 6000000), (6, 'Roads', 2000000); | Identify the categories with an average cost per project higher than the overall average cost. | SELECT category, AVG(cost) FROM Infrastructure GROUP BY category HAVING AVG(cost) > (SELECT AVG(cost) FROM Infrastructure); | gretelai_synthetic_text_to_sql |
CREATE TABLE shark_population (year INT, ocean VARCHAR(255), population INT); INSERT INTO shark_population (year, ocean, population) VALUES (2011, 'Arctic Ocean', 15000), (2012, 'Arctic Ocean', 14500), (2013, 'Arctic Ocean', 14000), (2014, 'Arctic Ocean', 13500), (2015, 'Arctic Ocean', 13000), (2016, 'Arctic Ocean', 12... | What is the change in population of sharks in the Arctic Ocean over the past 10 years? | SELECT year, population, LAG(population) OVER (ORDER BY year) as prev_population, population - LAG(population) OVER (ORDER BY year) as population_change FROM shark_population WHERE ocean = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Strains (id INT, strain TEXT, thc_content REAL, state TEXT); INSERT INTO Strains (id, strain, thc_content, state) VALUES (1, 'Strain A', 20.5, 'California'), (2, 'Strain B', 18.3, 'Oregon'), (3, 'Strain C', 22.7, 'Washington'); | What was the average THC content for each strain grown in California? | SELECT strain, AVG(thc_content) AS avg_thc FROM Strains WHERE state = 'California' GROUP BY strain; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (id INT, project_name VARCHAR(50), country VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO ContractNegotiations (id, project_name, country, start_date, end_date) VALUES (1, 'Project C', 'Russia', '2020-01-01', '2021-01-01'); INSERT INTO ContractNegotiations (id, project_name,... | List all contract negotiations with Russia in the last 2 years. | SELECT * FROM ContractNegotiations WHERE country = 'Russia' AND start_date >= DATE_SUB(NOW(), INTERVAL 2 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists metro_lines (line_id serial primary key,name varchar(255));CREATE TABLE if not exists metro_stations (station_id serial primary key,name varchar(255),line_id int);CREATE TABLE if not exists routes (route_id serial primary key,line_id int,start_station_id int,end_station_id int);CREATE TABLE i... | What is the maximum fare for a trip on the Red Line? | SELECT MAX(f.price) FROM fares f JOIN routes r ON f.route_id = r.route_id JOIN metro_stations s ON r.start_station_id = s.station_id WHERE s.line_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (id INT, team_a TEXT, team_b TEXT, location TEXT, score_team_a INT, score_team_b INT); INSERT INTO games (id, team_a, team_b, location, score_team_a, score_team_b) VALUES (1, 'Team A', 'Team E', 'Home', 120, 130); | What was the lowest scoring game for Team E in the 2016 season? | SELECT MIN(LEAST(score_team_a, score_team_b)) FROM games WHERE team_a = 'Team E' OR team_b = 'Team E' AND year = 2016; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT, name TEXT, fair_trade_certifications INT); INSERT INTO Suppliers (id, name, fair_trade_certifications) VALUES (1, 'Supplier A', 12), (2, 'Supplier B', 15), (3, 'Supplier C', 8), (4, 'Supplier D', 20), (5, 'Supplier E', 18), (6, 'Supplier F', 9); | Who are the top 5 suppliers with the highest number of fair trade certifications? | SELECT name, fair_trade_certifications FROM Suppliers ORDER BY fair_trade_certifications DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapists ( therapist_id INT PRIMARY KEY, name VARCHAR(100), specialization VARCHAR(50), experience INT); | Create a table named 'therapists' | CREATE TABLE therapists ( therapist_id INT PRIMARY KEY, name VARCHAR(100), specialization VARCHAR(50), experience INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (site_id INT, site_name TEXT, ei_score FLOAT); INSERT INTO environmental_impact (site_id, site_name, ei_score) VALUES (1, 'Site A', 75), (3, 'Site C', 60); | Update the environmental impact scores for Site A and Site C, and insert a new record for Site D with an environmental impact score of 80. | UPDATE environmental_impact SET ei_score = 85 WHERE site_id = 1; UPDATE environmental_impact SET ei_score = 70 WHERE site_id = 3; INSERT INTO environmental_impact (site_id, site_name, ei_score) VALUES (4, 'Site D', 80); | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (title VARCHAR(255), release_year INT, rating DECIMAL(3,2), production_country VARCHAR(50)); INSERT INTO movies (title, release_year, rating, production_country) VALUES ('The Revenant', 2015, 8.0, 'USA'), ('Mad Max: Fury Road', 2015, 8.1, 'Australia'), ('Zootopia', 2016, 8.0, 'USA'), ('La La Land', ... | What is the average rating of movies produced in the US and released between 2015-2017? | SELECT AVG(rating) FROM movies WHERE release_year BETWEEN 2015 AND 2017 AND production_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_applications (dapp_id INT, dapp_name VARCHAR(50), region VARCHAR(50), max_tps INT, min_tps INT); INSERT INTO decentralized_applications (dapp_id, dapp_name, region, max_tps, min_tps) VALUES (1, 'DApp 1', 'Australian', 1000, 500), (2, 'DApp 2', 'Australian', 1500, 800); | Find the maximum and minimum number of transactions per second for decentralized applications in the Australian region. | SELECT MAX(max_tps) as max_tps, MIN(min_tps) as min_tps FROM decentralized_applications WHERE region = 'Australian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, organic BOOLEAN, local BOOLEAN, supplier_id INT); INSERT INTO products (product_id, product_name, organic, local, supplier_id) VALUES (1, 'Carrots', true, true, 1), (2, 'Broccoli', true, false, 1), (3, 'Apples', false, true, 2), (4, 'Eggs', true, true, 3); | Calculate the number of suppliers providing products that are both organic and local | SELECT COUNT(*) FROM products WHERE organic = true AND local = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, name TEXT, country TEXT, donation FLOAT); INSERT INTO volunteers (id, name, country, donation) VALUES (1, 'John Doe', 'USA', 50.00), (2, 'Jane Smith', 'Canada', 100.00), (3, 'Alice Johnson', 'USA', 25.00); | How many volunteers have made donations in each country? | SELECT country, COUNT(*) FROM volunteers GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_services_union (id INT, name VARCHAR); INSERT INTO legal_services_union (id, name) VALUES (1, 'Hana'); CREATE TABLE real_estate_union (id INT, name VARCHAR); INSERT INTO real_estate_union (id, name) VALUES (1, 'Kai'); | Show the names of members who are in both 'legal_services' and 'real_estate' unions. | SELECT name FROM legal_services_union WHERE name IN (SELECT name FROM real_estate_union); | gretelai_synthetic_text_to_sql |
CREATE TABLE activities (activity_id INT, activity_name VARCHAR(50), country VARCHAR(50), rating INT); INSERT INTO activities (activity_id, activity_name, country, rating) VALUES (1, 'Wine Tasting', 'France', 5), (2, 'Historical Walking Tour', 'France', 4), (3, 'Cooking Class', 'France', 5), (4, 'Art Gallery', 'France'... | Which sustainable tourism activities in France are rated 5? | SELECT activity_name FROM activities WHERE country = 'France' AND rating = 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (Id INT, State VARCHAR(255), Ethnicity VARCHAR(255)); INSERT INTO CommunityHealthWorkers (Id, State, Ethnicity) VALUES (1, 'California', 'Not Hispanic or Latino'); INSERT INTO CommunityHealthWorkers (Id, State, Ethnicity) VALUES (2, 'California', 'Hispanic or Latino'); INSERT INTO Co... | How many community health workers identify as Hispanic or Latino in California? | SELECT COUNT(*) FROM CommunityHealthWorkers WHERE State = 'California' AND Ethnicity = 'Hispanic or Latino'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileProduction (id INT, material VARCHAR(255), region VARCHAR(255), quantity INT); INSERT INTO TextileProduction (id, material, region, quantity) VALUES (1, 'Organic Cotton', 'Africa', 400), (2, 'Synthetic Material', 'Asia', 800), (3, 'Organic Cotton', 'South America', 500); | What is the total quantity of organic cotton used in textile production in Africa and South America? | SELECT SUM(quantity) FROM TextileProduction WHERE material = 'Organic Cotton' AND region IN ('Africa', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE water_treatment_plant (plant_id INT, state VARCHAR(50), year INT, month INT, day INT, water_consumption FLOAT); INSERT INTO water_treatment_plant (plant_id, state, year, month, day, water_consumption) VALUES (4, 'Florida', 2020, 9, 1, 12345.6), (4, 'Florida', 2020, 9, 2, 23456.7), (4, 'Florida', 2020, 9, 3... | What is the minimum water consumption for each day in the month of September for the water treatment plant with ID 4 in the state of Florida in 2020? | SELECT day, MIN(water_consumption) as min_water_consumption FROM water_treatment_plant WHERE plant_id = 4 AND state = 'Florida' AND year = 2020 AND month = 9 GROUP BY day; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, age INT, country VARCHAR(20)); INSERT INTO patients (id, age, country) VALUES (1, 25, 'Australia'), (2, 35, 'New Zealand'); CREATE TABLE medications (id INT, patient_id INT, medication VARCHAR(20)); INSERT INTO medications (id, patient_id, medication) VALUES (1, 1, 'Prozac'), (2, 2, 'Lexa... | What is the minimum age of patients who received medication in Australia? | SELECT MIN(patients.age) FROM patients INNER JOIN medications ON patients.id = medications.patient_id WHERE medications.medication IS NOT NULL AND patients.country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor_data_2021 (id INT, crop VARCHAR(20), temperature DECIMAL(5,2)); INSERT INTO sensor_data_2021 (id, crop, temperature) VALUES (1, 'Corn', 22.5), (2, 'Soybean', 25.3), (3, 'Corn', 18.7); | What is the minimum temperature recorded for crop 'Corn' in the 'sensor_data_2021' table? | SELECT MIN(temperature) FROM sensor_data_2021 WHERE crop = 'Corn'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10)); CREATE TABLE Games (GameID INT, GameName VARCHAR(20), Rating INT); CREATE TABLE PlayerGames (PlayerID INT, GameID INT); | What is the average age of players who have played a game with a rating of 9 or above, and what is the total number of games they have played? | SELECT AVG(Players.Age), SUM(PlayerGames.PlayerID) as TotalGames FROM Players INNER JOIN PlayerGames ON Players.PlayerID = PlayerGames.PlayerID INNER JOIN Games ON PlayerGames.GameID = Games.GameID WHERE Games.Rating >= 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningEmployees (State VARCHAR(50), EmployeeEthnicity VARCHAR(50), EmployeeCount INT); INSERT INTO MiningEmployees(State, EmployeeEthnicity, EmployeeCount) VALUES ('Texas', 'Native American or Alaska Native', 200), ('Texas', 'Hispanic', 500), ('Texas', 'Black', 300), ('Louisiana', 'Native American or Alask... | What is the total number of employees in the mining industry who identify as Native American or Alaska Native, in Texas and Louisiana? | SELECT State, SUM(EmployeeCount) FROM MiningEmployees WHERE EmployeeEthnicity = 'Native American or Alaska Native' AND State IN ('Texas', 'Louisiana') GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE Smart_Contracts (Contract_ID INT, Asset_ID INT, Daily_Transactions INT); INSERT INTO Smart_Contracts (Contract_ID, Asset_ID, Daily_Transactions) VALUES (1, 1, 500), (2, 2, 700), (3, 1, 600), (4, 3, 800), (5, 4, 900); CREATE TABLE Digital_Assets (Asset_ID INT, Asset_Name VARCHAR(255), Issuer_Country VARCHAR... | What is the maximum number of daily transactions for smart contracts associated with digital assets issued by companies in the APAC region? | SELECT MAX(Daily_Transactions) AS Max_Transactions FROM Smart_Contracts JOIN Digital_Assets ON Smart_Contracts.Asset_ID = Digital_Assets.Asset_ID WHERE Issuer_Country IN ('Japan', 'China', 'Australia', 'India'); | gretelai_synthetic_text_to_sql |
CREATE TABLE streams (id INT, track_id INT, user_id INT, region VARCHAR(255), genre VARCHAR(255), revenue DECIMAL(10,2), timestamp TIMESTAMP); | What is the average revenue per stream for jazz music in the United Kingdom? | SELECT AVG(revenue) FROM streams WHERE genre = 'jazz' AND region = 'United Kingdom'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name TEXT); INSERT INTO marine_protected_areas (id, name) VALUES (1, 'Galapagos Marine Reserve'); INSERT INTO marine_protected_areas (id, name) VALUES (2, 'Great Barrier Reef Marine Park'); | What is the total number of marine protected areas worldwide? | SELECT COUNT(*) FROM marine_protected_areas; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA AI_Safety;CREATE TABLE Algorithms (algo_id INT, fairness_score FLOAT); INSERT INTO AI_Safety.Algorithms (algo_id, fairness_score) VALUES (1, 0.75), (2, 0.9), (3, 0.6); | Find the number of algorithms with a fairness score over 0.8 in the 'AI_Safety' schema. | SELECT COUNT(*) FROM AI_Safety.Algorithms WHERE fairness_score > 0.8; | gretelai_synthetic_text_to_sql |
CREATE TABLE caribbean_sea (id INT, well_name VARCHAR(255), drill_date DATE, production_oil INT); | What is the total number of wells that were drilled in the Caribbean Sea before 2010, and what is the total amount of oil they produced? | SELECT COUNT(*) as total_wells, SUM(production_oil) as total_oil_produced FROM caribbean_sea WHERE drill_date < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, country VARCHAR(20), operation_name VARCHAR(30), job_title VARCHAR(30)); INSERT INTO mining_operations (id, country, operation_name, job_title) VALUES (1, 'Canada', 'Operation A', 'Engineer'); INSERT INTO mining_operations (id, country, operation_name, job_title) VALUES (2, 'Cana... | What is the total number of employees working in mining operations across Canada and the United States, grouped by their job titles? | SELECT job_title, COUNT(*) FROM mining_operations WHERE country IN ('Canada', 'USA') GROUP BY job_title; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_name TEXT, is_vegan BOOLEAN, cost DECIMAL(5,2)); INSERT INTO ingredients (ingredient_name, is_vegan, cost) VALUES ('Tofu', true, 2.50); INSERT INTO ingredients (ingredient_name, is_vegan, cost) VALUES ('Almond Milk', true, 3.25); | What is the total cost of 'Vegan' ingredients? | SELECT SUM(cost) FROM ingredients WHERE is_vegan = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE sale (id INT, wholesaler VARCHAR(255), product VARCHAR(255), price FLOAT, quantity INT); INSERT INTO sale (id, wholesaler, product, price, quantity) VALUES (1, 'Wholesaler Z', 'Cannabis Edibles', 30.0, 500); | What is the total revenue generated by Cannabis Edibles sold by Wholesaler Z? | SELECT SUM(price * quantity) FROM sale WHERE wholesaler = 'Wholesaler Z' AND product = 'Cannabis Edibles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE LaborDisputes (DisputeID INT, Sector VARCHAR(20), Duration INT); INSERT INTO LaborDisputes (DisputeID, Sector, Duration) VALUES (1, 'Transportation', 45), (2, 'Transportation', 30), (3, 'Construction', 60); | What is the average duration of labor disputes in the 'Transportation' sector that lasted more than 30 days? | SELECT AVG(Duration) FROM LaborDisputes WHERE Sector = 'Transportation' AND Duration > 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE Garments (GarmentID INT, GarmentName VARCHAR(50), CategoryID INT);CREATE TABLE GarmentCategories (CategoryID INT, CategoryName VARCHAR(50)); | Delete all records of a specific category of garments from the database. | DELETE FROM Garments WHERE CategoryID IN (SELECT CategoryID FROM GarmentCategories WHERE CategoryName = 'Outerwear'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Green_Infrastructure (id INT, project_name VARCHAR(50), location VARCHAR(50), cost FLOAT); INSERT INTO Green_Infrastructure (id, project_name, location, cost) VALUES (1, 'Urban Forestry', 'City G', 3000000); INSERT INTO Green_Infrastructure (id, project_name, location, cost) VALUES (2, 'Stormwater Manageme... | Which projects in the Green_Infrastructure table have a cost greater than 4000000? | SELECT project_name FROM Green_Infrastructure WHERE cost > 4000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE trips (id INT, route_id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, passengers INT); INSERT INTO trips (id, route_id, trip_start_time, trip_end_time, passengers) VALUES (1, 105, '2022-01-01 06:00:00', '2022-01-01 07:00:00', 40), (2, 105, '2022-01-01 07:30:00', '2022-01-01 08:30:00', 45); | What is the total duration and average number of passengers for route 105? | SELECT route_id, TIMESTAMPDIFF(HOUR, MIN(trip_start_time), MAX(trip_end_time)) as total_duration, AVG(passengers) as avg_passengers FROM trips WHERE route_id = 105; | gretelai_synthetic_text_to_sql |
CREATE TABLE HumanResources (EmployeeID INT, FirstName VARCHAR(20), LastName VARCHAR(20), Position VARCHAR(20), Gender VARCHAR(10), HireDate DATE); | Calculate the percentage of female faculty members in the HumanResources table. | SELECT ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM HumanResources WHERE Position LIKE '%faculty%'), 2) AS Percentage FROM HumanResources WHERE Gender = 'Female' AND Position LIKE '%faculty%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Age INT, MembershipType VARCHAR(20)); INSERT INTO Members (MemberID, Age, MembershipType) VALUES (1, 35, 'Platinum'), (2, 45, 'Gold'), (3, 28, 'Platinum'); | What is the average age of members who have a platinum membership? | SELECT AVG(Age) FROM Members WHERE MembershipType = 'Platinum'; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (id INT, type VARCHAR(10), region VARCHAR(10)); INSERT INTO subscribers (id, type, region) VALUES (1, 'prepaid', 'coastal'), (2, 'postpaid', 'coastal'), (3, 'prepaid', 'coastal'); CREATE TABLE calls (subscriber_id INT, call_date DATE); INSERT INTO calls (subscriber_id, call_date) VALUES (1, '20... | What is the number of mobile customers who have not made any voice calls in the last month in the 'coastal' region? | SELECT COUNT(*) FROM subscribers LEFT JOIN calls ON subscribers.id = calls.subscriber_id WHERE subscribers.region = 'coastal' AND calls.call_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id int, product_id int, sale_date date, revenue decimal(5,2)); CREATE TABLE products (product_id int, product_name varchar(255), is_recycled boolean, country varchar(50)); INSERT INTO sales (sale_id, product_id, sale_date, revenue) VALUES (1, 1, '2022-01-01', 50.00); INSERT INTO products (produ... | What is the daily sales revenue of recycled products in Germany? | SELECT sale_date, SUM(revenue) AS daily_revenue FROM sales JOIN products ON sales.product_id = products.product_id WHERE is_recycled = true AND country = 'Germany' GROUP BY sale_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE CaseQuarter (CaseID INT, OpenQuarter VARCHAR(6)); INSERT INTO CaseQuarter (CaseID, OpenQuarter) VALUES (1, 'Q1 2021'), (2, 'Q4 2020'), (3, 'Q1 2021'); | How many cases were opened in Q1 of 2021? | SELECT COUNT(*) FROM CaseQuarter WHERE OpenQuarter = 'Q1 2021'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (restaurant_id INT, cuisine_type VARCHAR(255), revenue DECIMAL(10,2), transaction_date DATE); INSERT INTO restaurant_revenue (restaurant_id, cuisine_type, revenue, transaction_date) VALUES (1, 'Chinese', 5000, '2022-01-01'), (2, 'Italian', 6000, '2022-01-02'); | What is the total revenue generated by each cuisine type in the first half of 2022? | SELECT cuisine_type, SUM(revenue) as total_revenue FROM restaurant_revenue WHERE transaction_date BETWEEN '2022-01-01' AND '2022-06-30' GROUP BY cuisine_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, RestaurantName varchar(255)); INSERT INTO Restaurants (RestaurantID, RestaurantName) VALUES (1, 'Mama Mia'), (2, 'Taqueria Los Compadres'), (3, 'Wok Express'); CREATE TABLE Inspections (InspectionID int, RestaurantID int, Violation varchar(255)); INSERT INTO Inspections (Insp... | List all restaurants that had a food safety inspection violation | SELECT R.RestaurantName FROM Restaurants R INNER JOIN Inspections I ON R.RestaurantID = I.RestaurantID WHERE I.Violation IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment_usage (id INT, equipment_type VARCHAR(255), usage_duration INT, timestamp DATETIME); INSERT INTO equipment_usage (id, equipment_type, usage_duration, timestamp) VALUES (1, 'Tractor', 120, '2022-01-01 10:00:00'); | Calculate the percentage of time each type of equipment was in use in the past month. | SELECT equipment_type, 100.0 * SUM(usage_duration) / SUM(CASE WHEN equipment_type = 'Tractor' THEN usage_duration ELSE 0 END) as usage_percentage FROM equipment_usage WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH) GROUP BY equipment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE journalists (id INT, name VARCHAR(50)); INSERT INTO journalists (id, name) VALUES (1, 'John Smith'), (2, 'Jane Doe'), (3, 'Mike Johnson'), (4, 'Emma White'); CREATE TABLE articles (id INT, journalist_id INT, title VARCHAR(100)); INSERT INTO articles (id, journalist_id, title) VALUES (1, 1, 'News article 1'... | Who are the journalists who have not published any articles in the "articles" table? | SELECT name FROM journalists WHERE id NOT IN (SELECT journalist_id FROM articles); | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (org_id INT, org_name VARCHAR(50), org_state VARCHAR(2));CREATE TABLE donations (donation_id INT, org_id INT, donation_amount DECIMAL(10,2)); INSERT INTO organizations (org_id, org_name, org_state) VALUES (1, 'Habitat for Humanity', 'NY'), (2, 'Greenpeace', 'CA'), (3, 'American Cancer Society... | What is the total donation amount by organizations based in each state? | SELECT o.org_state, SUM(d.donation_amount) as total_donation_amount FROM organizations o JOIN donations d ON o.org_id = d.org_id GROUP BY o.org_state; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE virtual_tours (id INT PRIMARY KEY, name VARCHAR(255), country_id INT); ALTER TABLE virtual_tours ADD FOREIGN KEY (country_id) REFERENCES countries(id); | Which countries have the most virtual tours available? | SELECT countries.name, COUNT(virtual_tours.id) FROM countries INNER JOIN virtual_tours ON countries.id = virtual_tours.country_id GROUP BY countries.name ORDER BY COUNT(virtual_tours.id) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), Visitor_id INT, FOREIGN KEY (Visitor_id) REFERENCES Visitors(id)); INSERT INTO Exhibitions (id, name, type, Visitor_id) VALUES (1, 'Modern Art', 'Permanent', 1), (2, 'Wildlife Photography', 'Temporary', 2); | What is the average number of visitors per month for temporary exhibitions? | SELECT AVG(visitors_per_month) FROM Digital_Trends INNER JOIN Exhibitions ON Digital_Trends.exhibition_id = Exhibitions.id WHERE Exhibitions.type = 'Temporary'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workout (WorkoutID INT PRIMARY KEY, MemberID INT, Duration INT, Date DATE); CREATE TABLE Member (MemberID INT PRIMARY KEY, Age INT, Gender VARCHAR(10), MembershipStart DATE); | What is the total number of workouts for members who joined after 2019, grouped by gender? | SELECT Member.Gender, COUNT(Workout.WorkoutID) FROM Workout INNER JOIN Member ON Workout.MemberID = Member.MemberID WHERE Member.MembershipStart > '2019-12-31' GROUP BY Member.Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE traffic_violations (id INT PRIMARY KEY, location VARCHAR(255), violation_year INT, violation_count INT); INSERT INTO traffic_violations (id, location, violation_year, violation_count) VALUES (1, 'Oakland', 2020, 3500); | What is the number of traffic violations in Oakland in 2020? | SELECT violation_count FROM traffic_violations WHERE location = 'Oakland' AND violation_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products_By_Category (product_category VARCHAR(255), product_id INT); INSERT INTO Products_By_Category (product_category, product_id) VALUES ('Clothing', 100), ('Electronics', 101), ('Food', 102), ('Clothing', 103), ('Furniture', 104); CREATE TABLE Supplier_Products (product_id INT, is_recycled BOOLEAN); I... | Calculate the total number of items in each product category that are made from recycled materials. | SELECT product_category, COUNT(*) as recycled_count FROM Products_By_Category INNER JOIN Supplier_Products ON Products_By_Category.product_id = Supplier_Products.product_id WHERE Supplier_Products.is_recycled = true GROUP BY product_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections (restaurant_id INT, inspection_date DATE, violation_count INT); | Insert a new record in the food_safety_inspections table with a random restaurant_id, inspection_date of '2023-01-17', and a violation_count of 3 | INSERT INTO food_safety_inspections (restaurant_id, inspection_date, violation_count) VALUES (FLOOR(RAND()*(SELECT MAX(restaurant_id) FROM food_safety_inspections))+1, '2023-01-17', 3); | gretelai_synthetic_text_to_sql |
CREATE TABLE production (year INT, element VARCHAR(10), quantity INT); INSERT INTO production (year, element, quantity) VALUES (2017, 'Neodymium', 500), (2018, 'Neodymium', 550), (2019, 'Neodymium', 600), (2020, 'Neodymium', 650), (2017, 'Praseodymium', 700), (2018, 'Praseodymium', 750), (2019, 'Praseodymium', 800), (2... | What is the total production of Neodymium, Praseodymium, and Dysprosium in 2018? | SELECT SUM(quantity) FROM production WHERE element IN ('Neodymium', 'Praseodymium', 'Dysprosium') AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accessible_Tech (company VARCHAR(50), product VARCHAR(50)); INSERT INTO Accessible_Tech (company, product) VALUES ('Google', 'Screen Reader'), ('Microsoft', 'Adaptive Keyboard'), ('Apple', 'Voice Control'), ('IBM', 'Accessibility Checker'); | What is the average number of accessible technology products per company? | SELECT company, AVG(COUNT(product)) FROM Accessible_Tech GROUP BY company; | gretelai_synthetic_text_to_sql |
CREATE TABLE biotech_startups (id INT, name VARCHAR(100), location VARCHAR(100), funding FLOAT); INSERT INTO biotech_startups (id, name, location, funding) VALUES (1, 'Startup A', 'USA', 15000000); INSERT INTO biotech_startups (id, name, location, funding) VALUES (2, 'Startup B', 'USA', 22000000); | Update the funding amount for 'Startup A' to 18000000. | UPDATE biotech_startups SET funding = 18000000 WHERE name = 'Startup A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_equity (community_id INT, score INT); INSERT INTO community_health_equity (community_id, score) VALUES (1, 85), (2, 90), (3, 80), (4, 95), (5, 88); | What is the maximum health equity metric score achieved in each community? | SELECT community_id, MAX(score) FROM community_health_equity GROUP BY community_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouses (id INT, name TEXT, capacity INT, country TEXT); INSERT INTO Warehouses (id, name, capacity, country) VALUES (1, 'Paris Warehouse', 5000, 'France'); INSERT INTO Warehouses (id, name, capacity, country) VALUES (2, 'London Warehouse', 7000, 'England'); | Update the capacity of the warehouse in Paris to 6000. | UPDATE Warehouses SET capacity = 6000 WHERE name = 'Paris Warehouse'; | gretelai_synthetic_text_to_sql |
CREATE TABLE croplands (id INT, country VARCHAR(255), ndvi_index DECIMAL(3,2), year INT); INSERT INTO croplands (id, country, ndvi_index, year) VALUES (1, 'Brazil', 0.71, 2021); INSERT INTO croplands (id, country, ndvi_index, year) VALUES (2, 'Brazil', 0.77, 2021); INSERT INTO croplands (id, country, ndvi_index, year) ... | What is the minimum and maximum NDVI index value for croplands in Brazil in 2021? | SELECT country, MIN(ndvi_index) as min_ndvi, MAX(ndvi_index) as max_ndvi FROM croplands WHERE country = 'Brazil' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_exploration (program_name TEXT, depth FLOAT); INSERT INTO deep_sea_exploration (program_name, depth) VALUES ('Mariana Trench Exploration', 10994.0), ('Atlantic Ocean Ridge Exploration', 3000.0); | What is the average depth of all deep-sea exploration programs? | SELECT AVG(depth) FROM deep_sea_exploration; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_collaborations (id INT, country1 VARCHAR(255), country2 VARCHAR(255), mission_name VARCHAR(255), PRIMARY KEY(id)); INSERT INTO space_collaborations (id, country1, country2, mission_name) VALUES (1, 'Country1', 'Country2', 'Mission1'), (2, 'Country2', 'Country3', 'Mission2'), (3, 'Country1', 'Country3... | Which countries have collaborated on space missions and what are their mission names? | SELECT space_collaborations.country1, space_collaborations.country2, space_collaborations.mission_name FROM space_collaborations; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitarySpending (Year INT, Country VARCHAR(50), Spending FLOAT, Region VARCHAR(50)); INSERT INTO MilitarySpending (Year, Country, Spending, Region) VALUES (2016, 'United States', 600.1, 'NATO'), (2016, 'United Kingdom', 45.6, 'NATO'), (2017, 'United States', 615.4, 'NATO'); | Rank the top 3 countries with the highest increase in military spending between 2016 and 2018 in the North Atlantic Treaty Organization (NATO)? | SELECT Country, MAX(Spending) - MIN(Spending) as Increase FROM MilitarySpending WHERE Year IN (2016, 2018) AND Region = 'NATO' GROUP BY Country ORDER BY Increase DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Permits (PermitID int, PermitNumber varchar(255), IssueDate date, City varchar(255)); | What is the total number of building permits issued in New York City in the past year? | SELECT COUNT(PermitNumber) as TotalPermits FROM Permits WHERE IssueDate >= DATEADD(year, -1, GETDATE()) AND City = 'New York City'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (name TEXT, launch_date DATE, country TEXT);INSERT INTO Satellites (name, launch_date, country) VALUES ('USA', '2010-01-20', 'USA'); INSERT INTO Satellites (name, launch_date, country) VALUES ('Fengyun-3C', '2010-05-05', 'China'); | Which countries have launched satellites in 2010? | SELECT DISTINCT country FROM Satellites WHERE EXTRACT(YEAR FROM launch_date) = 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE staff_members (id INT, name VARCHAR(50), role VARCHAR(50), department VARCHAR(50)); INSERT INTO staff_members (id, name, role, department) VALUES (1, 'John Doe', 'Manager', 'Finance'), (2, 'Jane Smith', 'Director', 'Marketing'), (3, 'Mike Johnson', 'Specialist', 'IT'), (4, 'Alice Davis', 'Analyst', 'Financ... | List all departments with more than 5 staff members and their total count. | SELECT department, COUNT(*) AS total_staff FROM staff_members GROUP BY department HAVING total_staff > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (organization VARCHAR(50), operation_name VARCHAR(50), operation_start_date DATE); INSERT INTO peacekeeping_operations (organization, operation_name, operation_start_date) VALUES ('African Union', 'AMIS', '2004-07-28'), ('African Union', 'AMIS-II', '2005-01-01'), ('African Union', '... | How many peacekeeping operations have been conducted by the African Union since its formation? | SELECT COUNT(*) FROM peacekeeping_operations WHERE organization = 'African Union'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Agricultural_Innovations (Project_ID INT, Project_Name VARCHAR(50), Project_Budget FLOAT, Project_Region VARCHAR(50)); INSERT INTO Agricultural_Innovations (Project_ID, Project_Name, Project_Budget, Project_Region) VALUES (1, 'Precision Agriculture', 30000, 'Region A'), (2, 'Vertical Farming', 40000, 'Regi... | Find the top 2 agricultural innovation projects with the highest budget in the Agriculture schema, per region, and rank them within their respective regions. | SELECT Project_ID, Project_Name, Project_Budget, Project_Region, ROW_NUMBER() OVER (PARTITION BY Project_Region ORDER BY Project_Budget DESC) AS Project_Rank FROM Agricultural_Innovations; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerDonations (VolunteerID INT, DonationAmount DECIMAL(10,2), VolunteerHours INT); INSERT INTO VolunteerDonations (VolunteerID, DonationAmount, VolunteerHours) VALUES (1, 750.00, 25), (2, 300.00, 30), (3, 100.00, 15), (4, 600.00, 45); | List the names of the volunteers who have donated more than $500 and volunteered more than 20 hours? | SELECT VolunteerName FROM Volunteers INNER JOIN VolunteerDonations ON Volunteers.VolunteerID = VolunteerDonations.VolunteerID WHERE DonationAmount > 500 AND VolunteerHours > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, tier INT); INSERT INTO teacher_pd (teacher_id, tier) VALUES (1, 1), (2, 3), (3, 2), (4, 1), (5, 3); CREATE TABLE student_mental_health (student_id INT, mental_health_score INT, teacher_id INT); INSERT INTO student_mental_health (student_id, mental_health_score, teacher_id) VALUE... | What is the average mental health score of students grouped by their teacher's professional development tier? | SELECT t.tier, AVG(smh.mental_health_score) FROM student_mental_health smh JOIN teacher_pd t ON smh.teacher_id = t.teacher_id GROUP BY t.tier; | gretelai_synthetic_text_to_sql |
CREATE TABLE Innovation_Projects (Nation VARCHAR(50), Continent VARCHAR(50), Project VARCHAR(50), Budget DECIMAL(10,2)); INSERT INTO Innovation_Projects (Nation, Continent, Project, Budget) VALUES ('USA', 'Americas', 'Stealth Drone Project', 15000000.00), ('Brazil', 'Americas', 'Cyber Defense System', 12000000.00), ('C... | What is the total number of military innovation projects in the Americas? | SELECT COUNT(Project) FROM Innovation_Projects WHERE Continent = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (id INT, source_country VARCHAR(20), destination_state VARCHAR(20), weight FLOAT, shipping_date DATE); INSERT INTO shipments (id, source_country, destination_state, weight, shipping_date) VALUES (1, 'Japan', 'Washington', 3.1, '2022-01-03'), (2, 'Japan', 'Washington', 4.8, '2022-01-07'); | What is the minimum weight of packages shipped from Japan to Washington in the last month? | SELECT MIN(weight) FROM shipments WHERE source_country = 'Japan' AND destination_state = 'Washington' AND shipping_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Threat_Level (id INT, report_number VARCHAR(50), report_date DATE, threat_level INT); | What is the average threat level for the last week? | SELECT AVG(threat_level) FROM Threat_Level WHERE report_date >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK); | gretelai_synthetic_text_to_sql |
CREATE TABLE TotalArtifacts (SiteID varchar(5), ArtifactCount int); INSERT INTO TotalArtifacts (SiteID, ArtifactCount) VALUES ('S001', 250), ('S002', 300), ('S003', 400); | What is the total number of artifacts found at all sites? | SELECT SUM(ArtifactCount) FROM TotalArtifacts; | gretelai_synthetic_text_to_sql |
CREATE TABLE eagle_ford_wells (well text, completion_year integer); INSERT INTO eagle_ford_wells VALUES ('Well1', 2016), ('Well2', 2017), ('Well3', 2019), ('Well4', 2018), ('Well5', 2020), ('Well6', 2015), ('Well7', 2021); | Find the total number of wells in the 'Eagle Ford' shale play that were completed after 2017. | SELECT COUNT(well) FROM eagle_ford_wells WHERE completion_year > 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE components (id INT, manufacturer TEXT, energy_source TEXT, quantity INT); INSERT INTO components (id, manufacturer, energy_source, quantity) VALUES (1, 'XYZ', 'solar', 500), (2, 'ABC', 'wind', 700); CREATE TABLE dates (id INT, component_id INT, date DATE); INSERT INTO dates (id, component_id, date) VALUES ... | How many components were manufactured using renewable energy sources in Q2 of 2021? | SELECT SUM(quantity) FROM components c JOIN dates d ON c.id = d.component_id WHERE energy_source IN ('solar', 'wind') AND date BETWEEN '2021-04-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fares (FareID INT, VehicleType VARCHAR(50), Fare DECIMAL(10,2)); INSERT INTO Fares (FareID, VehicleType, Fare) VALUES (1, 'Bus', 2.5), (2, 'Tram', 3.0), (3, 'Train', 5.0); | What is the average fare for each vehicle type? | SELECT VehicleType, AVG(Fare) as AverageFare FROM Fares GROUP BY VehicleType; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_france (id INT, city VARCHAR(255), production FLOAT); INSERT INTO renewable_energy_france (id, city, production) VALUES (1, 'Paris', 2000), (2, 'Lyon', 2500), (3, 'Marseille', 1500); | Find the average renewable energy production of each city in France. | SELECT city, AVG(production) FROM renewable_energy_france GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sustainable_Buildings (project_id INT, project_name VARCHAR(50), region VARCHAR(10), project_cost FLOAT); INSERT INTO Sustainable_Buildings VALUES (1, 'Green Demo', 'west', 500000.00), (2, 'Solar Highrise', 'east', 750000.00), (3, 'Eco Apartments', 'west', 600000.00); | What is the average project cost for sustainable building projects in the 'west' region, ordered by date? | SELECT AVG(project_cost) FROM Sustainable_Buildings WHERE region = 'west' ORDER BY project_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, email TEXT, total_donation DECIMAL); CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL); | What is the total amount donated by each donor, along with their contact information? | SELECT donors.name, donors.email, SUM(donations.amount) as total_donation FROM donors INNER JOIN donations ON donors.id = donations.donor_id GROUP BY donors.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE athlete_wellbeing (program_id INT, program_name VARCHAR(255), description TEXT, cost DECIMAL(5,2), date_started DATE, date_ended DATE); | What is the total revenue generated from 'athlete_wellbeing' table? | SELECT SUM(cost) FROM athlete_wellbeing; | gretelai_synthetic_text_to_sql |
CREATE TABLE southeast_asian_conservation_areas (id INT, name VARCHAR(255), area_size FLOAT, island_nation VARCHAR(255), funding FLOAT); | What is the average habitat preservation funding per square kilometer for each Southeast Asian conservation area, broken down by conservation area and island nation? | SELECT sea.name, sea.island_nation, AVG(sea.funding / sea.area_size) as avg_funding_per_sq_km FROM southeast_asian_conservation_areas sea GROUP BY sea.name, sea.island_nation; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (vessel_name VARCHAR(255)); INSERT INTO Vessels (vessel_name) VALUES ('VesselM'), ('VesselN'); CREATE TABLE Voyages (vessel_name VARCHAR(255), voyage_date DATE, fuel_consumption INT); INSERT INTO Voyages (vessel_name, voyage_date, fuel_consumption) VALUES ('VesselM', '2021-04-01', 150), ('VesselM',... | What was the maximum fuel consumption by 'VesselM' during its voyages in April 2021? | SELECT MAX(fuel_consumption) FROM Voyages WHERE vessel_name = 'VesselM' AND voyage_date BETWEEN '2021-04-01' AND '2021-04-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningSites (SiteID INT, SiteName VARCHAR(50), Location VARCHAR(50), EnvironmentalImpactScore INT); | Update the environmental impact score of the mining site named 'Existing Mine' to 80. | UPDATE MiningSites SET EnvironmentalImpactScore = 80 WHERE SiteName = 'Existing Mine'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (player_id INT, name VARCHAR(100), level INT, game VARCHAR(100), country VARCHAR(50)); INSERT INTO Players (player_id, name, level, game, country) VALUES (1, 'John Doe', 50, 'World of Warcraft', 'United States'), (2, 'Jane Smith', 45, 'World of Warcraft', 'Canada'); | How many players have reached level 50 in the game "World of Warcraft" and are from the United States? | SELECT COUNT(*) FROM Players p WHERE p.game = 'World of Warcraft' AND p.country = 'United States' AND p.level = 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), country VARCHAR(255), launch_date DATE, type VARCHAR(255)); INSERT INTO satellites (id, name, country, launch_date, type) VALUES (1, 'Sentinel-1A', 'European Union', '2014-04-03', 'Radar Imaging'); | Count of satellites launched per country, ordered by launch count. | SELECT country, COUNT(*) as launch_count FROM satellites GROUP BY country ORDER BY launch_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE transparency (id INT, region TEXT, initiative_count INT); INSERT INTO transparency (id, region, initiative_count) VALUES (1, 'African', 5), (2, 'Asian', 8), (3, 'European', 10), (4, 'American', 12); | What is the minimum number of government transparency initiatives in the African region? | SELECT MIN(initiative_count) FROM transparency WHERE region = 'African'; | gretelai_synthetic_text_to_sql |
CREATE TABLE classes(class_id INT, class_type VARCHAR(20), price DECIMAL(5,2)); INSERT INTO classes(class_id, class_type, price) VALUES (1, 'Yoga', 15.00); INSERT INTO classes(class_id, class_type, price) VALUES (2, 'Pilates', 20.00); INSERT INTO classes(class_id, class_type, price) VALUES (3, 'Zumba', 10.00); INSERT I... | What is the total revenue for each type of fitness class? | SELECT class_type, SUM(price) as total_revenue FROM classes GROUP BY class_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Underwriting (PolicyID INT, PolicyholderID INT, PolicyType TEXT, Premium INT); INSERT INTO Underwriting (PolicyID, PolicyholderID, PolicyType, Premium) VALUES (101, 1, 'Auto', 1200), (102, 2, 'Life', 500), (103, 3, 'Auto', 800), (104, 4, 'Life', 600); | List the policy types for policies with a premium greater than the average premium for all policies. | SELECT PolicyType FROM Underwriting WHERE Premium > (SELECT AVG(Premium) FROM Underwriting); | gretelai_synthetic_text_to_sql |
CREATE TABLE old_growth_forest (id INT, species VARCHAR(50), age INT); | Get the number of trees in the 'old_growth_forest' table older than 200 years. | SELECT COUNT(*) FROM old_growth_forest WHERE age > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryAircrafts (Id INT, Country VARCHAR(50), AircraftType VARCHAR(50), Quantity INT);INSERT INTO MilitaryAircrafts (Id, Country, AircraftType, Quantity) VALUES (1, 'France', 'Fighter Jet', 200), (2, 'Germany', 'Transport Plane', 150), (3, 'Italy', 'Helicopter', 300); | What are the total number of military aircrafts by type owned by the European countries? | SELECT Country, AircraftType, SUM(Quantity) AS Total FROM MilitaryAircrafts WHERE Country IN ('France', 'Germany', 'Italy') GROUP BY Country, AircraftType; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Country TEXT); INSERT INTO Volunteers (VolunteerID, VolunteerName, Country) VALUES (1, 'Alice', 'USA'); INSERT INTO Volunteers (VolunteerID, VolunteerName, Country) VALUES (2, 'Bob', 'Mexico'); CREATE TABLE VolunteerPrograms (ProgramID INT, ProgramName TEXT)... | How many volunteers from the USA have participated in each program in 2021? | SELECT VolunteerPrograms.ProgramName, COUNT(DISTINCT Volunteers.VolunteerID) AS VolunteerCount FROM Volunteers INNER JOIN VolunteerEvents ON Volunteers.VolunteerID = VolunteerEvents.VolunteerID INNER JOIN VolunteerPrograms ON VolunteerEvents.ProgramID = VolunteerPrograms.ProgramID WHERE Volunteers.Country = 'USA' AND Y... | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT PRIMARY KEY, ArtistName VARCHAR(255), ArtistBirthYear INT); INSERT INTO Artists (ArtistID, ArtistName, ArtistBirthYear) VALUES (1, 'Vincent Van Gogh', 1853), (2, 'Pablo Picasso', 1881), (3, 'Claude Monet', 1840), (4, 'Francisco Goya', 1746); CREATE TABLE Artworks (ArtworkID INT PRIMAR... | Find average age of artists who created more than 50 artworks | SELECT AVG(YEAR(CURRENT_DATE) - ArtistBirthYear) AS AverageAge FROM Artists WHERE ArtistID IN (SELECT ArtistID FROM Artworks GROUP BY ArtistID HAVING COUNT(ArtworkID) > 50); | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment_maintenance (equipment_id INTEGER PRIMARY KEY, last_maintenance_date DATE, next_maintenance_date DATE, completed_maintenance BOOLEAN, status TEXT); | Update equipment status in 'equipment_maintenance' table | UPDATE equipment_maintenance SET status = 'Operational' WHERE equipment_id = 1 AND completed_maintenance = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_details (id INT, vessel_id INT, age INT, type_id INT); | What is the average age of vessels for each vessel type? | SELECT vt.name, AVG(vd.age) as avg_age FROM vessel_details vd JOIN vessel_type vt ON vd.type_id = vt.id GROUP BY vt.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation (id INT, system_type VARCHAR(20), ridership INT); INSERT INTO transportation (id, system_type, ridership) VALUES (1, 'Subway', 5000000), (2, 'Bus', 3000000), (3, 'Light Rail', 1000000), (4, 'Ferry', 500000); | Which public transportation systems have the highest and lowest ridership in 'transportation' table? | SELECT system_type, ridership FROM (SELECT system_type, ridership, ROW_NUMBER() OVER (ORDER BY ridership DESC) AS rank FROM transportation WHERE system_type LIKE '%public%') AS subquery WHERE rank = 1 OR rank = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE traffic_violations (id INT, city VARCHAR(50), violation_type VARCHAR(50), fine INT); INSERT INTO traffic_violations (id, city, violation_type, fine) VALUES (1, 'New York City', 'Speeding', 100), (2, 'New York City', 'Running Red Light', 200), (3, 'Chicago', 'Speeding', 120); | What is the average fine amount for traffic violations in New York City? | SELECT AVG(fine) FROM traffic_violations WHERE city = 'New York City' AND violation_type = 'Traffic Violation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, industry TEXT, foundation_date DATE, founder_disability BOOLEAN); INSERT INTO startups(id, name, industry, foundation_date, founder_disability) VALUES (1, 'RenewableEmpower', 'Renewable Energy', '2018-01-01', true); | How many startups were founded by people with disabilities in the renewable energy sector in the past 5 years? | SELECT COUNT(*) FROM startups WHERE industry = 'Renewable Energy' AND foundation_date >= '2017-01-01' AND founder_disability = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Movies (movie_id INT, title TEXT, release_year INT, production_budget FLOAT); INSERT INTO Movies (movie_id, title, release_year, production_budget) VALUES (1, 'MovieA', 2005, 60.0), (2, 'MovieB', 2012, 40.0), (3, 'MovieC', 2018, 70.0), (4, 'MovieD', 2008, 55.0), (5, 'MovieE', 2010, 80.0), (6, 'MovieF', 201... | What is the total production budget for movies released in 2017 and 2018? | SELECT SUM(production_budget) FROM Movies WHERE release_year BETWEEN 2017 AND 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment (id INT, equipment_type VARCHAR(255), equipment_location VARCHAR(255), maintenance_cost FLOAT); INSERT INTO equipment (id, equipment_type, equipment_location, maintenance_cost) VALUES (1, 'Tank', 'Middle East', 10000); INSERT INTO equipment (id, equipment_type, equipment_location, maintenance_cos... | What is the average maintenance cost for military equipment in the Middle East, broken down by equipment type? | SELECT equipment_type, AVG(maintenance_cost) as avg_maintenance_cost FROM equipment WHERE equipment_location = 'Middle East' GROUP BY equipment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Glaciers (location VARCHAR(50), num_glaciers INT); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Svalbard', 2100); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Greenland', 2500); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Russian Arctic', 4500); INSERT INTO Glaciers (location... | What is the total number of glaciers in the Canadian Arctic? | SELECT SUM(num_glaciers) FROM Glaciers WHERE location = 'Canadian Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (GameID INT, Game VARCHAR(50), ReleaseYear INT, VR BOOLEAN); INSERT INTO Games (GameID, Game, ReleaseYear, VR) VALUES (1, 'Beat Saber', 2018, 1); INSERT INTO Games (GameID, Game, ReleaseYear, VR) VALUES (2, 'Superhot VR', 2017, 1); INSERT INTO Games (GameID, Game, ReleaseYear, VR) VALUES (3, 'Job Sim... | How many VR games have been released in each year? | SELECT ReleaseYear, COUNT(GameID) as GameCount FROM Games WHERE VR = 1 GROUP BY ReleaseYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, name VARCHAR(255), city VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO events (id, name, city, start_date, end_date) VALUES (1, 'Concert', 'Paris', '2020-06-01', '2020-06-03'), (2, 'Theater Play', 'London', '2021-07-15', '2021-07-17'), (3, 'Art Exhibit', 'Paris', '2020-11-01', '... | How many cultural events took place in 'Paris' between 2020 and 2021? | SELECT COUNT(*) FROM events WHERE city = 'Paris' AND start_date BETWEEN '2020-01-01' AND '2021-12-31'; | 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.