context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE gulf_of_mexico_platforms (year INT, region VARCHAR(20), num_platforms INT); INSERT INTO gulf_of_mexico_platforms (year, region, num_platforms) VALUES (2015, 'Gulf of Mexico', 1500), (2016, 'Gulf of Mexico', 1550), (2017, 'Gulf of Mexico', 1600), (2018, 'Gulf of Mexico', 1650), (2019, 'Gulf of Mexico', 1700... | List the number of offshore drilling platforms in the Gulf of Mexico as of 2020. | SELECT num_platforms FROM gulf_of_mexico_platforms WHERE year = 2020 AND region = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (id INT, name TEXT, industry TEXT, location TEXT); INSERT INTO Company (id, name, industry, location) VALUES (1, 'EcoInnovations', 'GreenTech', 'Nigeria'), (2, 'BioSolutions', 'Biotech', 'Brazil'), (3, 'TechBoost', 'Tech', 'India'); CREATE TABLE Funding (id INT, company_id INT, amount INT, round TE... | What is the total funding amount for companies in the 'GreenTech' industry? | SELECT SUM(Funding.amount) FROM Company INNER JOIN Funding ON Company.id = Funding.company_id WHERE Company.industry = 'GreenTech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_impact_investments (id INT, region VARCHAR(50), category VARCHAR(50), transaction_value FLOAT); INSERT INTO social_impact_investments (id, region, category, transaction_value) VALUES (1, 'Asia', 'Climate Action', 8000.0), (2, 'Europe', 'Gender Equality', 6000.0), (3, 'Africa', 'Climate Action', 1000... | Find the minimum transaction value for social impact investments in the 'Gender Equality' category, considering only investments in Europe. | SELECT MIN(transaction_value) FROM social_impact_investments WHERE category = 'Gender Equality' AND region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rovers (id INT, name VARCHAR(50), mission VARCHAR(50), launch_date DATE); INSERT INTO rovers (id, name, mission, launch_date) VALUES (1, 'Curiosity', 'Mars Science Laboratory', '2011-11-26'); INSERT INTO rovers (id, name, mission, launch_date) VALUES (2, 'Spirit', 'Mars Exploration Rover', '2003-06-10'); | Delete rovers launched before 2010 | DELETE FROM rovers WHERE launch_date < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE philadelphia_properties (type VARCHAR(10), price INT); INSERT INTO philadelphia_properties (type, price) VALUES ('Co-op', 350000); INSERT INTO philadelphia_properties (type, price) VALUES ('Condo', 450000); | What is the median listing price for co-op properties in Philadelphia? | SELECT AVG(price) FROM (SELECT DISTINCT price FROM philadelphia_properties WHERE type = 'Co-op' ORDER BY price LIMIT 2 OFFSET 1) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculties (faculty_id INT, name VARCHAR(50), department VARCHAR(20), race VARCHAR(20)); INSERT INTO faculties (faculty_id, name, department, race) VALUES (1, 'Jose Hernandez', 'Mathematics', 'Hispanic'), (2, 'Sofia Rodriguez', 'Mathematics', 'Asian'), (3, 'Ali Al-Sayed', 'Physics', 'Middle Eastern'); CREAT... | What is the total amount of research grants awarded to faculty members who identify as Asian? | SELECT SUM(amount) FROM research_grants JOIN faculties ON research_grants.faculty_id = faculties.faculty_id WHERE faculties.race = 'Asian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE City_Donations (id INT, donor VARCHAR(50), city VARCHAR(50), amount FLOAT, donation_date DATE); INSERT INTO City_Donations (id, donor, city, amount, donation_date) VALUES (1, 'James Lee', 'San Francisco', 400, '2022-01-01'); INSERT INTO City_Donations (id, donor, city, amount, donation_date) VALUES (2, 'Mi... | Identify the top 3 cities with the highest total donations in 2022. | SELECT city, SUM(amount) as total_donation FROM City_Donations WHERE YEAR(donation_date) = 2022 GROUP BY city ORDER BY total_donation DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletics_athletes (athlete_id INT, athlete_name VARCHAR(50), birthdate DATE, gender VARCHAR(50), gold INT, silver INT, bronze INT); | What are the names of athletes with the most gold medals in athletics? | SELECT athlete_name FROM athletics_athletes WHERE gold = (SELECT MAX(gold) FROM athletics_athletes) AND gold > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, city VARCHAR(20)); INSERT INTO hotels (id, city) VALUES (1, 'Rome'), (2, 'London'); CREATE TABLE tours (id INT, hotel_id INT, virtual BOOLEAN); INSERT INTO tours (id, hotel_id, virtual) VALUES (1, 1, true), (2, 1, true), (3, 2, false); | What is the maximum number of virtual tours offered per hotel in Rome? | SELECT MAX(t.virtual) FROM tours t JOIN hotels h ON t.hotel_id = h.id WHERE h.city = 'Rome'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (PatientID INT, Age INT, Gender VARCHAR(10), Disease VARCHAR(20), Region VARCHAR(20)); INSERT INTO Patients (PatientID, Age, Gender, Disease, Region) VALUES (1, 34, 'Male', 'Influenza', 'Los Angeles'); INSERT INTO Patients (PatientID, Age, Gender, Disease, Region) VALUES (2, 42, 'Female', 'Pneumon... | Count the number of tuberculosis cases in the New York region. | SELECT COUNT(*) FROM Patients WHERE Disease = 'Tuberculosis' AND Region = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_beneficiaries (program VARCHAR(10), count INT); INSERT INTO program_beneficiaries (program, count) VALUES ('ProgA', 20), ('ProgA', 10), ('ProgB', 30); | What is the total number of beneficiaries served by each program? | SELECT program, SUM(count) FROM program_beneficiaries GROUP BY program; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleTypes (vehicle_type_id INT, vehicle_type TEXT); CREATE TABLE AutonomousVehicleTesting (vehicle_id INT, vehicle_type_id INT, testing_location TEXT); | What are the top 5 most common vehicle types in the autonomous vehicle testing program in California? | SELECT vt.vehicle_type, COUNT(*) AS testing_count FROM AutonomousVehicleTesting avt INNER JOIN VehicleTypes vt ON avt.vehicle_type_id = vt.vehicle_type_id WHERE testing_location = 'California' GROUP BY 1 ORDER BY testing_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_investments (investment_id INT, investment_amount INT, investment_type TEXT); INSERT INTO tourism_investments (investment_id, investment_amount, investment_type) VALUES (1, 5000000, 'Virtual Tourism'), (2, 3000000, 'Cultural Preservation'), (3, 4000000, 'Sustainable Tourism'); | What is the sum of all investments in virtual tourism globally? | SELECT SUM(investment_amount) FROM tourism_investments WHERE investment_type = 'Virtual Tourism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_lending_client (client_id INT PRIMARY KEY, name VARCHAR(100), age INT, gender VARCHAR(10));CREATE TABLE socially_responsible_lending_loan (loan_id INT PRIMARY KEY, client_id INT, loan_amount DECIMAL(10, 2), loan_date DATE);INSERT INTO socially_responsible_lending_client (client_id, nam... | Insert records for new clients from the Socially Responsible Lending database | INSERT INTO client (client_id, name, age, gender) SELECT client_id, name, age, gender FROM socially_responsible_lending_client WHERE NOT EXISTS (SELECT 1 FROM client c WHERE c.client_id = socially_responsible_lending_client.client_id); | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicles (Vehicle VARCHAR(50), Manufacturer VARCHAR(50), Year INT, Range INT); INSERT INTO ElectricVehicles (Vehicle, Manufacturer, Year, Range) VALUES ('Chevy Bolt EV', 'Chevrolet', 2022, 259); | Find electric vehicles with a range greater than 300 miles | SELECT * FROM ElectricVehicles WHERE Range > 300; | gretelai_synthetic_text_to_sql |
CREATE TABLE agroecology_projects (id INT, project_name VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO agroecology_projects (id, project_name, start_date, end_date) VALUES (1, 'Forest Garden', '2020-01-01', '2022-12-31'), (2, 'Water Retention', '2019-01-01', '2021-12-31'), (3, 'Sustainable Grazing', '2022-0... | Delete all entries from the 'agroecology_projects' table where the 'start_date' is after 2021-01-01. | DELETE FROM agroecology_projects WHERE start_date > '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency (id INT PRIMARY KEY, sector VARCHAR(255), efficiency_improvement FLOAT, country VARCHAR(255)); | Delete records in the 'energy_efficiency' table where the 'efficiency_improvement' is less than 0.05 | DELETE FROM energy_efficiency WHERE efficiency_improvement < 0.05; | gretelai_synthetic_text_to_sql |
CREATE TABLE ConsumerPreferences (UserID INT, PreferredBrand VARCHAR(50), PreferredProduct VARCHAR(50), PreferredIngredients VARCHAR(255)); INSERT INTO ConsumerPreferences (UserID, PreferredBrand, PreferredProduct, PreferredIngredients) VALUES (1, 'Origins', 'Ginzing Energy-Boosting Gel Moisturizer', 'Water, Glycerin')... | Count the number of users who prefer each brand, for products that do not include water as an ingredient, partitioned by preferred brand. | SELECT PreferredBrand, PreferredProduct, PreferredIngredients, COUNT(*) OVER (PARTITION BY PreferredBrand) as 'BrandPopularity' FROM ConsumerPreferences WHERE PreferredIngredients NOT LIKE '%Water%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_loans(id INT, client_id INT);CREATE TABLE clients(id INT, name TEXT, location TEXT); | What is the total amount of Shariah-compliant loans issued to clients in rural areas? | SELECT SUM(1) FROM shariah_compliant_loans s INNER JOIN clients c ON s.client_id = c.id WHERE c.location LIKE '%rural%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, region TEXT); CREATE TABLE conservation_status (id INT, species_id INT, status TEXT); INSERT INTO marine_species (id, name, region) VALUES (1, 'Blue Whale', 'Atlantic'); INSERT INTO conservation_status (id, species_id, status) VALUES (1, 1, 'Endangered'); INSERT INTO mari... | How many marine species are there in the Atlantic region without a known conservation status? | SELECT COUNT(marine_species.id) FROM marine_species LEFT JOIN conservation_status ON marine_species.id = conservation_status.species_id WHERE marine_species.region = 'Atlantic' AND conservation_status.status IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE art_forms (id INT, name VARCHAR(50), description VARCHAR(100), origin_country VARCHAR(50), is_practiced BOOLEAN); | Delete records of art forms no longer practiced | DELETE FROM art_forms WHERE is_practiced = FALSE | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), ethical_certification VARCHAR(255)); INSERT INTO suppliers (id, name, location, ethical_certification) VALUES (1, 'Supplier A', 'USA', 'Fair Trade'), (2, 'Supplier B', 'Mexico', 'SA8000'), (3, 'Supplier C', 'China', 'BSCI'), (4, 'Supp... | What is the total number of suppliers in each country, and the number of suppliers with ethical certifications for each country? | SELECT location as country, COUNT(*) as total_suppliers, SUM(CASE WHEN ethical_certification IS NOT NULL THEN 1 ELSE 0 END) as certified_suppliers FROM suppliers GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE cardano_nodes (node_id VARCHAR(50), confirmations_required INT); | What is the minimum number of confirmations required by at least 50% of the nodes in the Cardano network? | SELECT MIN(confirmations_required) FROM cardano_nodes HAVING COUNT(*) >= (SELECT COUNT(*) FROM cardano_nodes) * 0.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor_depth (location VARCHAR(255), depth FLOAT); INSERT INTO ocean_floor_depth (location, depth) VALUES ('Mariana Trench', 10994), ('Puerto Rico Trench', 8605); | What is the minimum depth of the ocean floor in the Mariana trench? | SELECT MIN(depth) FROM ocean_floor_depth WHERE location = 'Mariana Trench'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, name VARCHAR(50), age INT, sessions_completed INT); | What is the maximum number of sessions completed by a volunteer in the volunteers table? | SELECT MAX(sessions_completed) FROM volunteers; | gretelai_synthetic_text_to_sql |
CREATE TABLE sports_events (event_id INT, year INT, tickets_sold INT); INSERT INTO sports_events (event_id, year, tickets_sold) VALUES (1, 2017, 60000), (2, 2018, 80000), (3, 2017, 55000); | What is the total number of tickets sold for sports_events in '2017'? | SELECT SUM(tickets_sold) FROM sports_events WHERE year = 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, region VARCHAR(20), shipment_type VARCHAR(20), revenue FLOAT); INSERT INTO Shipments (id, region, shipment_type, revenue) VALUES (1, 'North', 'Domestic', 500.0), (2, 'North', 'International', 800.0); | What is the total revenue generated from domestic shipments in the North region? | SELECT SUM(revenue) FROM Shipments WHERE region = 'North' AND shipment_type = 'Domestic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (country VARCHAR(50), year INT, waste_kg FLOAT); INSERT INTO waste_generation (country, year, waste_kg) VALUES ('Canada', 2018, 15000); INSERT INTO waste_generation (country, year, waste_kg) VALUES ('Canada', 2019, 8000); | Delete records where waste generation is less than 10000 kg | DELETE FROM waste_generation WHERE waste_kg < 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_practices (employee_id INT, department TEXT, is_ethical BOOLEAN); CREATE TABLE employees (employee_id INT, employee_name TEXT); | What is the total number of employees, and how many of them work in departments that have ethical practices? | SELECT COUNT(DISTINCT ethical_practices.employee_id) AS total_employees, SUM(ethical_practices.is_ethical) AS ethical_employees FROM ethical_practices INNER JOIN employees ON ethical_practices.employee_id = employees.employee_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_emissions (ev_id INT, state VARCHAR(255), co2_reduction FLOAT); | What is the average CO2 emission reduction (in metric tons) for electric vehicles in the state of New York? | SELECT AVG(co2_reduction) FROM ev_emissions WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArcticResearchLab (id INT, year INT, month INT, temperature FLOAT); INSERT INTO ArcticResearchLab (id, year, month, temperature) VALUES (1, 2000, 1, -10.5), (2, 2000, 2, -12.3), (3, 2000, 3, -13.1); | What is the maximum temperature per month in the Arctic Research Lab? | SELECT month, MAX(temperature) FROM ArcticResearchLab GROUP BY year, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE employee_positions(dept VARCHAR(20), job_title VARCHAR(20), num_employees INT); INSERT INTO employee_positions VALUES ('engineering', 'engineer', 30), ('engineering', 'technician', 20), ('environmental', 'scientist', 40), ('environmental', 'technician', 30); | Determine the number of employees by job title and department | SELECT dept, job_title, SUM(num_employees) FROM employee_positions GROUP BY dept, job_title; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT, event_type VARCHAR(50), location VARCHAR(50)); INSERT INTO Events (event_id, event_type, location) VALUES (1, 'Musical', 'New York'), (2, 'Theater', 'Los Angeles'), (3, 'Art', 'Los Angeles'), (4, 'Art', 'New York'); | How many art events took place in each location? | SELECT location, COUNT(event_id) FROM Events WHERE event_type = 'Art' GROUP BY location | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (id INT, name TEXT, cuisine TEXT); INSERT INTO Restaurants (id, name, cuisine) VALUES (1, 'El Mexicano', 'Mexican'), (2, 'La Trattoria', 'Italian'); CREATE TABLE Menu (id INT, name TEXT, type TEXT, rating FLOAT, restaurant_id INT); INSERT INTO Menu (id, name, type, rating, restaurant_id) VALUES... | What is the average rating of vegan dishes in Mexican and Italian restaurants? | SELECT AVG(rating) as avg_rating FROM Menu WHERE type = 'Dish' AND cuisine IN ('Mexican', 'Italian') AND vegan = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT PRIMARY KEY, name VARCHAR(255), beds INT, location VARCHAR(255)); INSERT INTO hospitals (id, name, beds, location) VALUES (1, 'Johns Hopkins Hospital', 1138, 'Baltimore, MD'); INSERT INTO hospitals (id, name, beds, location) VALUES (2, 'Massachusetts General Hospital', 999, 'Boston, MA');... | What is the maximum number of hospital beds in a single hospital, and which hospital has this number of beds? | SELECT name, MAX(beds) FROM hospitals; | gretelai_synthetic_text_to_sql |
CREATE TABLE Albums (AlbumID int, AlbumName varchar(100), ReleaseYear int, Genre varchar(50)); INSERT INTO Albums VALUES (1, 'The Dark Side of the Moon', 1973, 'Rock'); INSERT INTO Albums VALUES (2, 'Thriller', 1982, 'Pop'); INSERT INTO Albums VALUES (3, 'Back in Black', 1980, 'Rock'); INSERT INTO Albums VALUES (4, 'Th... | Find the top 3 albums with the most tracks released before 2000 across all genres. | SELECT AlbumName FROM (SELECT AlbumName, ROW_NUMBER() OVER (ORDER BY ReleaseYear) as Rank FROM Albums WHERE ReleaseYear < 2000) WHERE Rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE soil_conditions (location VARCHAR(255), soil_moisture INT, last_updated DATETIME); | Update the soil_moisture values in the soil_conditions table by adding 5 for all records where the location is 'Farm A' | UPDATE soil_conditions SET soil_moisture = soil_moisture + 5 WHERE location = 'Farm A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, name VARCHAR(255)); INSERT INTO animals (id, name) VALUES (1, 'Tiger'), (2, 'Elephant'), (3, 'Rhinoceros'), (4, 'Panda'), (5, 'Giraffe'); CREATE VIEW critical_habitats AS SELECT * FROM habitats WHERE id IN (1, 3, 5); | Get the names of all animals in the 'critical_habitats' view | SELECT animals.name FROM animals JOIN critical_habitats ON animals.habitat_id = critical_habitats.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileSourcing (FabricType VARCHAR(255), Quantity INT, IsSustainable BOOLEAN); INSERT INTO TextileSourcing (FabricType, Quantity, IsSustainable) VALUES ('Organic Cotton', 1200, TRUE), ('Recycled Polyester', 800, TRUE), ('Tencel', 1500, TRUE), ('Virgin Polyester', 1000, FALSE), ('Conventional Cotton', 2000... | Which are the top 5 sustainable fabric types by their total usage in all clothing items? | SELECT FabricType FROM TextileSourcing WHERE IsSustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (date DATE, cultivator VARCHAR(255), product VARCHAR(255), weight DECIMAL(10,2)); INSERT INTO production VALUES ('2022-01-01', 'Cultivator X', 'Flower', 250.00), ('2022-01-01', 'Cultivator Y', 'Concentrate', 700.00); | What was the total production weight for each product category by cultivator in Q1 2022? | SELECT cultivator, p.product as product_category, SUM(weight) as total_weight FROM production JOIN ( SELECT 'Flower' as product UNION ALL SELECT 'Concentrate' as product ) p ON production.product = p.product WHERE EXTRACT(QUARTER FROM date) = 1 AND EXTRACT(YEAR FROM date) = 2022 GROUP BY cultivator, p.product; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT, VolunteerCount INT); INSERT INTO Programs (ProgramID, ProgramName, VolunteerCount) VALUES (1, 'Feeding America', 75); INSERT INTO Programs (ProgramID, ProgramName, VolunteerCount) VALUES (2, 'Red Cross', 30); INSERT INTO Programs (ProgramID, ProgramName, Volunteer... | What is the average number of volunteers per program? | SELECT AVG(VolunteerCount) FROM Programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_projects (id INT, country VARCHAR(50), region VARCHAR(50), capacity FLOAT); INSERT INTO wind_projects (id, country, region, capacity) VALUES (1, 'USA', 'north_america', 5000.00), (2, 'Canada', 'north_america', 3000.00), (3, 'Mexico', 'north_america', 2000.00); | What is the total installed capacity (in MW) of wind power projects in the 'north_america' region, partitioned by country and ordered by capacity in descending order? | SELECT region, country, SUM(capacity) as total_capacity FROM wind_projects WHERE region = 'north_america' GROUP BY country, region ORDER BY total_capacity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (id INT, item VARCHAR(50), quantity INT, country VARCHAR(50)); INSERT INTO Warehouse (id, item, quantity, country) VALUES (1, 'WidgetA', 200, 'France'), (2, 'WidgetB', 300, 'USA'); | What is the total quantity of item 'WidgetA' shipped from France to the USA? | SELECT SUM(quantity) FROM Warehouse WHERE item = 'WidgetA' AND country = 'France' AND EXISTS (SELECT 1 FROM Warehouse w2 WHERE w2.item = 'WidgetA' AND w2.country = 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE OpenDataInitiatives (InitiativeID INT, Department VARCHAR(50), Year INT); | Which departments are responsible for the implementation of open data initiatives since 2017? | SELECT OpenDataInitiatives.Department FROM OpenDataInitiatives WHERE OpenDataInitiatives.Year >= 2017 GROUP BY OpenDataInitiatives.Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name TEXT, material TEXT, fair_trade BOOLEAN); INSERT INTO products (product_id, name, material, fair_trade) VALUES (1, 'Fair Trade Organic Cotton Shirt', 'Organic Cotton', true), (2, 'Regular Cotton Shirt', 'Cotton', false); | How many Fair Trade certified products are made from 'Organic Cotton'? | SELECT COUNT(*) FROM products WHERE products.material = 'Organic Cotton' AND products.fair_trade = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (city VARCHAR(20), trips INT);INSERT INTO public_transportation (city, trips) VALUES ('New York', 1000000), ('Los Angeles', 800000), ('Chicago', 900000); | What is the total number of public transportation trips in New York, Los Angeles, and Chicago? | SELECT SUM(trips) FROM public_transportation WHERE city IN ('New York', 'Los Angeles', 'Chicago'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Game (GameID int, GameName varchar(50), Genre varchar(50), Duration int); INSERT INTO Game (GameID, GameName, Genre, Duration) VALUES (1, 'GameA', 'Shooter', 120), (2, 'GameB', 'RPG', 240), (3, 'GameC', 'Shooter', 180); | What is the average game duration for each game genre? | SELECT Genre, AVG(Duration) as AvgDuration FROM Game GROUP BY Genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE fantom_transactions (transaction_id INT, tx_time TIMESTAMP, gas_price DECIMAL(10, 2)); INSERT INTO fantom_transactions (transaction_id, tx_time, gas_price) VALUES (1, '2022-01-01 10:00:00', 0.01), (2, '2022-01-02 11:00:00', 0.02), (3, '2022-01-03 12:00:00', 0.03), (4, '2022-01-04 13:00:00', 0.04), (5, '202... | What is the maximum, minimum, and average gas price for transactions on the Fantom network, grouped by day? | SELECT DATE_FORMAT(tx_time, '%Y-%m-%d') AS day, MAX(gas_price) AS max_gas_price, MIN(gas_price) AS min_gas_price, AVG(gas_price) AS avg_gas_price FROM fantom_transactions GROUP BY day; | gretelai_synthetic_text_to_sql |
CREATE TABLE preservation (id INT, city VARCHAR(20), art_pieces INT); INSERT INTO preservation (id, city, art_pieces) VALUES (1, 'Rome', 1000), (2, 'Rome', 2000), (3, 'Paris', 3000), (4, 'Rome', 3000), (5, 'Rome', 2500); | What is the highest number of art pieces preserved in 'Rome'? | SELECT MAX(art_pieces) FROM preservation WHERE city = 'Rome'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists_revenue (artist_id INT, gender VARCHAR(50), revenue FLOAT); INSERT INTO artists_revenue (artist_id, gender, revenue) VALUES (1, 'Male', 500000.0), (2, 'Female', 450000.0), (3, 'Non-binary', 400000.0), (4, 'Male', 350000.0), (5, 'Female', 300000.0); | What is the difference between the total revenue of male and female artists? | SELECT SUM(CASE WHEN gender = 'Male' THEN revenue ELSE 0 END) - SUM(CASE WHEN gender = 'Female' THEN revenue ELSE 0 END) FROM artists_revenue; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerPreferences (PlayerID INT, Preference VARCHAR(50)); INSERT INTO PlayerPreferences (PlayerID, Preference) VALUES (1, 'VR'), (2, 'Non-VR'), (3, 'VR'), (4, 'Non-VR'), (5, 'Non-VR'); CREATE TABLE Players (PlayerID INT, PlayerName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, PlayerNam... | What is the total number of players who prefer using Non-VR technology for gaming and are from Europe or South America? | (SELECT COUNT(*) FROM PlayerPreferences JOIN Players ON PlayerPreferences.PlayerID = Players.PlayerID WHERE Players.Country IN ('Europe', 'South America') AND PlayerPreferences.Preference = 'Non-VR') | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, garment_id INT, size INT, sale_date DATE, country VARCHAR(50)); INSERT INTO sales (id, garment_id, size, sale_date, country) VALUES (1, 1004, 2, '2021-05-20', 'USA'); | How many size 2 garments were sold in the US in the last week? | SELECT COUNT(*) FROM sales WHERE size = 2 AND country = 'USA' AND sale_date >= DATEADD(day, -7, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE food_waste (year INT, location VARCHAR(255), waste INT); | What is the trend of food waste in urban areas over the last 5 years? | SELECT year, AVG(waste) as avg_waste FROM food_waste WHERE location = 'urban' GROUP BY year ORDER BY year DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Atlantic_Ocean (id INT, location VARCHAR(255), temperature DECIMAL(5,2)); INSERT INTO Atlantic_Ocean (id, location, temperature) VALUES (1, 'North Atlantic', 12.00), (2, 'South Atlantic', 24.00); CREATE TABLE Salmon_Farms (id INT, location VARCHAR(255), month INT, year INT, avg_temperature DECIMAL(5,2)); I... | What is the average water temperature in the Atlantic Ocean for salmon farms in January? | SELECT AVG(Salmon_Farms.avg_temperature) FROM Salmon_Farms INNER JOIN Atlantic_Ocean ON Salmon_Farms.location = Atlantic_Ocean.location WHERE Atlantic_Ocean.location IN ('North Atlantic', 'South Atlantic') AND Salmon_Farms.month = 1 AND Salmon_Farms.year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name TEXT); INSERT INTO artists (id, name) VALUES (1, 'Artist 1'), (2, 'Artist 2'); CREATE TABLE artworks (id INT, title TEXT, artist_id INT); INSERT INTO artworks (id, title, artist_id) VALUES (1, 'Artwork 1', 1), (2, 'Artwork 2', 1); | Which artists have not created any artworks? | SELECT ar.name FROM artists ar LEFT JOIN artworks a ON ar.id = a.artist_id WHERE a.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_projects (project_id INT, name VARCHAR(100), co2_reduction INT); INSERT INTO carbon_offset_projects (project_id, name, co2_reduction) VALUES (1, 'Forest Conservation', 10000); | What is the average CO2 emissions reduction for each carbon offset project? | SELECT AVG(co2_reduction) as avg_co2_reduction FROM carbon_offset_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, name VARCHAR(255), conservation_status VARCHAR(255)); INSERT INTO animals (id, name, conservation_status) VALUES (1, 'Tiger', 'Endangered'), (2, 'Elephant', 'Vulnerable'), (3, 'Rhinoceros', 'Critically Endangered'), (4, 'Panda', 'Vulnerable'), (5, 'Giraffe', 'Least Concern'); | Find the number of animals in each conservation status | SELECT conservation_status, COUNT(*) AS animal_count FROM animals GROUP BY conservation_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_revenue(menu_item VARCHAR(255), category VARCHAR(255), revenue DECIMAL(10,2), sustainable_source BOOLEAN); INSERT INTO sustainable_revenue VALUES ('Vegan Pizza', 'Vegan', 1200, TRUE); INSERT INTO sustainable_revenue VALUES ('Tofu Stir Fry', 'Vegan', 800, TRUE); | What is the total revenue for each sustainable menu item category in Q1 of 2023? | SELECT category, SUM(revenue) FROM sustainable_revenue WHERE sustainable_source = TRUE AND date >= '2023-01-01' AND date < '2023-04-01' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation (id INT, initiative_name VARCHAR(50), country VARCHAR(50), year INT); INSERT INTO agricultural_innovation (id, initiative_name, country, year) VALUES (1, 'Precision Agriculture', 'Canada', 2018), (2, 'Drip Irrigation', 'Mexico', 2019), (3, 'Vertical Farming', 'US', 2020); | Which agricultural innovation initiatives were implemented in a specific year and their budgets in the 'agricultural_innovation' table? | SELECT initiative_name, budget FROM agricultural_innovation WHERE year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_rating (product_id INT, rating INT, cruelty_free BOOLEAN); INSERT INTO product_rating (product_id, rating, cruelty_free) VALUES (1, 4, true), (2, 3, false), (3, 5, true), (4, 4, false), (5, 5, true); CREATE TABLE product (product_id INT, product_name VARCHAR(30), product_type VARCHAR(30)); INSERT I... | What is the average rating of cruelty-free eyeshadows? | SELECT AVG(rating) as avg_rating FROM product_rating JOIN product ON product_rating.product_id = product.product_id WHERE cruelty_free = true AND product_type = 'Eyeshadow'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerLevels (PlayerID INT, GameName VARCHAR(20), Playtime FLOAT, Level INT); INSERT INTO PlayerLevels (PlayerID, GameName, Playtime, Level) VALUES (4001, 'Mystic Quest', 210.5, 5), (4002, 'Mystic Quest', 315.2, 10), (4003, 'Mystic Quest', 156.8, 2); | What is the average playtime per level for players in the "Mystic Quest" game? | SELECT AVG(Playtime) FROM PlayerLevels WHERE GameName = 'Mystic Quest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE areas (id INT, name VARCHAR(20)); INSERT INTO areas (id, name) VALUES (1, 'Urban'), (2, 'Rural'); CREATE TABLE budget (item VARCHAR(20), area_id INT, amount INT); INSERT INTO budget (item, area_id, amount) VALUES ('Public Transportation', 1, 9000000), ('Public Transportation', 2, 5000000); | What is the maximum budget allocated for public transportation in urban areas? | SELECT MAX(amount) FROM budget WHERE item = 'Public Transportation' AND area_id = (SELECT id FROM areas WHERE name = 'Urban'); | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT PRIMARY KEY, name VARCHAR(100), species VARCHAR(50), population INT); INSERT INTO animals (id, name, species, population) VALUES (1, 'Giraffe', 'Mammal', 30000), (2, 'Elephant', 'Mammal', 5000); CREATE VIEW mammals_view AS SELECT * FROM animals WHERE species = 'Mammal'; CREATE TABLE habitat... | Insert data into the 'habitats' table | INSERT INTO habitats (id, name, location, size) VALUES (2, 'Rainforest', 'South America', 25000.2); | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (PolicyholderID INT, Age INT, State VARCHAR(50)); INSERT INTO Policyholders (PolicyholderID, Age, State) VALUES (1, 25, 'California'), (2, 30, 'California'), (3, 45, 'Texas'), (4, 50, 'Texas'), (5, 60, 'Florida'); | What is the policy count for policyholders in each age group, in 5-year intervals, for policyholders in each state? | SELECT State, FLOOR(Age / 5) * 5 AS AgeGroup, COUNT(*) AS PolicyCount FROM Policyholders GROUP BY State, AgeGroup; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendees (id INT, event_id INT, no_attendees INT); CREATE TABLE events (id INT, name VARCHAR(255), category VARCHAR(255), date DATE); | How many total attendees were there for events with a 'music' category? | SELECT SUM(a.no_attendees) FROM attendees a INNER JOIN events e ON a.event_id = e.id WHERE e.category = 'music'; | gretelai_synthetic_text_to_sql |
CREATE TABLE gym_memberships (id INT, member_name VARCHAR(50), start_date DATE, end_date DATE, membership_type VARCHAR(50), price DECIMAL(5,2)); INSERT INTO gym_memberships VALUES (1, 'John Doe', '2021-01-01', '2021-12-31', 'Premium', 49.99), (2, 'Jane Smith', '2021-04-01', '2021-12-31', 'Basic', 29.99), (3, 'Alice Joh... | What is the total revenue for each quarter in 2021? | SELECT DATE_FORMAT(start_date, '%Y-%m') AS quarter, SUM(price) AS total_revenue FROM gym_memberships WHERE start_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (country VARCHAR(255), date DATE, humidity INT); INSERT INTO WeatherData (country, date, humidity) VALUES ('Mexico', '2022-08-01', 40), ('Mexico', '2022-08-02', 45), ('Brazil', '2022-08-01', 50), ('Brazil', '2022-08-02', 55), ('Argentina', '2022-08-01', 35), ('Argentina', '2022-08-02', 30); | Find the top 3 countries with the lowest average humidity in August. | SELECT country, AVG(humidity) as Avg_Humidity FROM WeatherData WHERE date BETWEEN '2022-08-01' AND '2022-08-31' GROUP BY country ORDER BY Avg_Humidity ASC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE refugee_support.schools (id INT, name VARCHAR(50), capacity INT, location VARCHAR(50)); | What is the total number of schools in the 'refugee_support' schema? | SELECT COUNT(*) FROM refugee_support.schools; | gretelai_synthetic_text_to_sql |
CREATE TABLE COMMUNITY_ENGAGEMENT (id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), type VARCHAR(255)); INSERT INTO COMMUNITY_ENGAGEMENT (id, name, region, type) VALUES (1, 'Mayan Cultural Festival', 'Americas', 'Cultural'); | What community engagement programs exist in the Americas and their types? | SELECT name, type FROM COMMUNITY_ENGAGEMENT WHERE region = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtForms (id INT PRIMARY KEY, name VARCHAR(100), type VARCHAR(50), origin VARCHAR(100), practitioners INT); INSERT INTO ArtForms (id, name, type, origin, practitioners) VALUES (1, 'Bharatanatyam', 'Dance', 'India', 5000); | What is the location with the minimum number of art form practitioners? | SELECT origin, MIN(practitioners) as min_practitioners FROM ArtForms GROUP BY origin; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_phosphorus (farm_id INT, farm_type VARCHAR(255), measurement_date DATE, phosphorus DECIMAL(5,2)); INSERT INTO farm_phosphorus (farm_id, farm_type, measurement_date, phosphorus) VALUES (1, 'Pond', '2022-06-01', 0.5), (2, 'Cage', '2022-06-01', 0.4), (3, 'Recirculating', '2022-07-01', 0.6), (4, 'Pond', '... | What is the maximum phosphorus level (mg/L) in any farm type, in the last 3 months? | SELECT MAX(phosphorus) FROM farm_phosphorus WHERE measurement_date >= DATE(NOW()) - INTERVAL 3 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE africa_temperature (year INT, avg_temp FLOAT); INSERT INTO africa_temperature (year, avg_temp) VALUES (2015, 20.1), (2016, 20.5), (2017, 21.2), (2018, 20.8), (2019, 21.0), (2020, 21.5); CREATE TABLE north_america_temperature (year INT, avg_temp FLOAT); INSERT INTO north_america_temperature (year, avg_temp)... | What is the average temperature change in Africa and North America from 2015 to 2020? | SELECT AVG(africa_temperature.avg_temp) AS africa_avg_temp, AVG(north_america_temperature.avg_temp) AS north_america_avg_temp FROM africa_temperature, north_america_temperature WHERE africa_temperature.year = north_america_temperature.year AND africa_temperature.year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers(FarmerID INT, Age INT); | Add a new column 'FarmSize' to the 'Farmers' table with a data type of INT | ALTER TABLE Farmers ADD FarmSize INT; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_vehicles (id INT, name TEXT, country TEXT, year INT, sales INT); INSERT INTO electric_vehicles (id, name, country, year, sales) VALUES (1, 'Tesla Model 3', 'Germany', 2021, 20000), (2, 'BMW i3', 'Germany', 2021, 7000); | How many electric vehicles were sold in the country 'Germany' in the year 2021? | SELECT SUM(sales) FROM electric_vehicles WHERE country = 'Germany' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE hr.employee_details (id INT, employee_id INT, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(50), birth_date DATE); CREATE TABLE hr.employee_hires (id INT, employee_id INT, hire_date DATE, job_id VARCHAR(20)); CREATE TABLE hr.jobs (id INT, job_id VARCHAR(20), job_title VARCHAR(50)); | Show the names and job titles of employees who have been with the company for more than 10 years in the 'hr' schema's 'employee_details' and 'employee_hires' tables | SELECT e.first_name, e.last_name, j.job_title FROM hr.employee_details e INNER JOIN hr.employee_hires h ON e.employee_id = h.employee_id INNER JOIN hr.jobs j ON h.job_id = j.job_id WHERE DATEDIFF(CURDATE(), h.hire_date) > 3650; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), salary DECIMAL(10,2)); INSERT INTO employees (id, name, department, salary) VALUES (1, 'John Doe', 'manufacturing', 50000.00), (2, 'Jane Smith', 'engineering', 60000.00); | Find the average salary of employees in the 'manufacturing' department | SELECT AVG(salary) FROM employees WHERE department = 'manufacturing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_hours (labor_id INT, state VARCHAR(20), year INT, hours_worked INT); INSERT INTO labor_hours (labor_id, state, year, hours_worked) VALUES (1, 'California', 2019, 1500000), (2, 'California', 2018, 1400000), (3, 'New York', 2019, 1200000), (4, 'Texas', 2019, 1300000), (5, 'Texas', 2018, 1100000); | What is the total number of construction labor hours worked in the state of Texas in 2018 and 2019? | SELECT state, SUM(hours_worked) FROM labor_hours WHERE state = 'Texas' AND year IN (2018, 2019) GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE IndiaVisitorCount (year INT, tourists INT); INSERT INTO IndiaVisitorCount (year, tourists) VALUES (2017, 16000000), (2019, 18000000); | Calculate the percentage change in the number of tourists visiting India from 2017 to 2019 | SELECT (SUM(CASE WHEN year = 2019 THEN tourists ELSE 0 END) - SUM(CASE WHEN year = 2017 THEN tourists ELSE 0 END)) * 100.0 / SUM(CASE WHEN year = 2017 THEN tourists ELSE 0 END) AS pct_change FROM IndiaVisitorCount; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (region VARCHAR(255), waste_type VARCHAR(255), year INT, amount INT); INSERT INTO WasteGeneration (region, waste_type, year, amount) VALUES ('North', 'Recyclables', 2018, 12000), ('North', 'Non-Recyclables', 2018, 18000), ('South', 'Recyclables', 2018, 8000), ('South', 'Non-Recyclables', 20... | What is the total waste generation for each region, including recyclables and non-recyclables, for the year 2018? | SELECT SUM(amount) as TotalWaste, region FROM WasteGeneration WHERE year = 2018 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE policyholders (id INT, policyholder_name TEXT, state TEXT, age INT, gender TEXT); INSERT INTO policyholders (id, policyholder_name, state, age, gender) VALUES (1, 'John Doe', 'NY', 35, 'Male'); INSERT INTO policyholders (id, policyholder_name, state, age, gender) VALUES (2, 'Jane Smith', 'NY', 42, 'Female'... | What is the average claim amount for policyholders in New York? | SELECT AVG(claim_amount) FROM claims JOIN policyholders ON claims.policyholder_id = policyholders.id WHERE policyholders.state = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT PRIMARY KEY, name VARCHAR(255), address VARCHAR(255), city VARCHAR(255), country VARCHAR(255), stars DECIMAL(2,1)); | Update the address field in the hotels table for the hotel with id 4 | UPDATE hotels SET address = '5th Avenue, New York, NY' WHERE id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_plants (id INT, name VARCHAR(255), location VARCHAR(255), budget FLOAT); CREATE TABLE plant_engineers (id INT, plant_id INT, specialty VARCHAR(255), experience INT); INSERT INTO plant_engineers (id, plant_id, specialty, experience) VALUES (1, 1, 'Mechanical', 7), (2, 1, 'Electrical', 8); | How many engineers are assigned to each water treatment plant project? | SELECT w.name, COUNT(pe.id) as num_engineers FROM water_plants w JOIN plant_engineers pe ON w.id = pe.plant_id GROUP BY w.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Energy_Storage_SK (Type VARCHAR(20), Country VARCHAR(20), Capacity INT); INSERT INTO Energy_Storage_SK VALUES ('Lithium-Ion Batteries', 'South Korea', 10000), ('Flywheels', 'South Korea', 2000), ('Pumped Hydro', 'South Korea', 5000), ('CAES', 'South Korea', 3000); | Find the percentage of energy storage capacity in South Korea that comes from lithium-ion batteries? | SELECT (SUM(CASE WHEN Type = 'Lithium-Ion Batteries' THEN Capacity ELSE 0 END) * 100.0 / SUM(Capacity)) AS Battery_Percentage FROM Energy_Storage_SK WHERE Country = 'South Korea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects(id INT, project_name VARCHAR(50), start_date DATE, end_date DATE, status VARCHAR(20), region VARCHAR(20)); | What is the total number of defense projects in the Americas and their average duration? | SELECT 'Americas' AS continent, AVG(DATEDIFF(end_date, start_date)) AS avg_duration, COUNT(*) AS total_projects FROM defense_projects WHERE region IN ('North America', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_education (id INT, program_name VARCHAR(50), enrollment INT); INSERT INTO community_education (id, program_name, enrollment) VALUES (1, 'Wildlife Conservation', 1500), (2, 'Biodiversity Awareness', 1200), (3, 'Climate Change Education', 1800); | What is the minimum enrollment for community education programs? | SELECT MIN(enrollment) FROM community_education; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (id INT, farm_id INT, date DATE, temperature FLOAT); | What is the 'maximum' and 'minimum' temperature for 'April' in the 'weather_data' table? | SELECT MAX(temperature), MIN(temperature) FROM weather_data WHERE date BETWEEN '2022-04-01' AND '2022-04-30'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA FoodService;CREATE TABLE Sustainability (sustainability_id INT, restaurant_id INT, category VARCHAR(50), score INT); INSERT INTO Sustainability (sustainability_id, restaurant_id, category, score) VALUES (1, 1, 'dining', 85), (2, 1, 'dining', 90), (3, 2, 'takeout', 70), (4, 2, 'takeout', 75); | What is the average sustainable sourcing score for each restaurant category? | SELECT category, AVG(score) as avg_score FROM Sustainability GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE data_usage (customer_id INT, data_usage_bytes BIGINT, country VARCHAR(50), usage_date DATE); INSERT INTO data_usage (customer_id, data_usage_bytes, country, usage_date) VALUES (1, 10000000, 'Canada', '2023-03-01'), (2, 15000000, 'Canada', '2023-03-01'), (3, 20000000, 'USA', '2023-03-01'), (4, 25000000, 'US... | What is the average monthly data usage for the top 10% of customers in each country? | SELECT country, NTILE(100) OVER (PARTITION BY country ORDER BY data_usage_bytes DESC) as tier, AVG(data_usage_bytes) as avg_data_usage FROM data_usage GROUP BY country, tier HAVING tier <= 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsEvents (EventID INT, Location VARCHAR(50), Date DATE); INSERT INTO EsportsEvents (EventID, Location, Date) VALUES (1, 'Los Angeles, USA', '2022-01-01'), (2, 'Tokyo, Japan', '2022-02-01'), (3, 'New York, USA', '2022-03-01'); | How many esports events have been held in North America? | SELECT COUNT(*) FROM EsportsEvents WHERE Location LIKE '%North America%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements (id INT, industry VARCHAR, state VARCHAR, duration INT); INSERT INTO cb_agreements (id, industry, state, duration) VALUES (1, 'Construction', 'Texas', 36); | What is the average duration of collective bargaining agreements in Texas by industry? | SELECT industry, AVG(duration) as avg_duration FROM cb_agreements WHERE state = 'Texas' GROUP BY industry; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (vessel_id VARCHAR(10), name VARCHAR(20), type VARCHAR(20), max_speed FLOAT); INSERT INTO Vessels (vessel_id, name, type, max_speed) VALUES ('1', 'Vessel A', 'Cargo', 20.5); | What is the average speed of Vessel A? | SELECT AVG(max_speed) FROM Vessels WHERE name = 'Vessel A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE memberships (id INT, member_type VARCHAR(50), region VARCHAR(50)); CREATE TABLE workout_data (member_id INT, workout_type VARCHAR(50), duration INT, heart_rate_avg INT, calories_burned INT, workout_date DATE); | What is the total number of calories burned for each member in the first quarter of 2022? | SELECT m.id, SUM(w.calories_burned) as total_calories_burned FROM memberships m JOIN workout_data w ON m.id = w.member_id WHERE w.workout_date >= DATE '2022-01-01' AND w.workout_date < DATE '2022-04-01' GROUP BY m.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (id INT, region VARCHAR(20), volume INT, date DATE); INSERT INTO wells (id, region, volume, date) VALUES (1, 'Caribbean', 900, '2022-01-01'); INSERT INTO wells (id, region, volume, date) VALUES (2, 'Caribbean', 1900, '2022-02-01'); INSERT INTO wells (id, region, volume, date) VALUES (3, 'Caribbean', ... | Find the total production volume for wells in the Caribbean in the first half of 2022. | SELECT SUM(volume) FROM wells WHERE region = 'Caribbean' AND MONTH(date) <= 6 AND YEAR(date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys_expenses (attorney_id INT, amount DECIMAL(10, 2)); | What is the total expense for each attorney? | SELECT attorney_id, SUM(amount) FROM attorneys_expenses GROUP BY attorney_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, title VARCHAR(50), year INT, location VARCHAR(50)); INSERT INTO events (event_id, title, year, location) VALUES (1, 'Art Exhibition', 2020, 'New York'); INSERT INTO events (event_id, title, year, location) VALUES (2, 'Theater Performance', 2019, 'London'); | What is the total number of cultural events in the 'events' table for the year 2020? | SELECT COUNT(*) FROM events WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Emissions (Site VARCHAR(255), Date DATE, Emissions INT); INSERT INTO Emissions (Site, Date, Emissions) VALUES ('Mine A', '2021-01-01', 500), ('Mine A', '2021-02-01', 600), ('Mine A', '2021-03-01', 700), ('Mine B', '2021-01-01', 800), ('Mine B', '2021-02-01', 900), ('Mine B', '2021-03-01', 1000); | What is the monthly trend in greenhouse gas emissions by mine site in the last year? | SELECT Site, DATEPART(YEAR, Date) as Year, DATEPART(MONTH, Date) as Month, AVG(Emissions) as Average_Emissions FROM Emissions WHERE Date >= DATEADD(YEAR, -1, GETDATE()) GROUP BY Site, DATEPART(YEAR, Date), DATEPART(MONTH, Date) ORDER BY Year, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_workshops (id INT PRIMARY KEY, workshop_name TEXT, date DATE, location TEXT, max_attendees INT); | Create a table for storing information about professional development workshops for teachers | CREATE TABLE teacher_workshops (id INT PRIMARY KEY, workshop_name TEXT, workshop_date DATE, location TEXT, max_attendees INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE restorative_justice_programs (program_id INT, program_name VARCHAR(255), cases_resolved INT); INSERT INTO restorative_justice_programs (program_id, program_name, cases_resolved) VALUES (1, 'Restorative Circles', 120), (2, 'Victim Offender Mediation', 150), (3, 'Community Reparative Boards', 180), (4, 'Peac... | What is the total number of cases resolved by restorative justice programs, in descending order of program size? | SELECT program_name, cases_resolved FROM restorative_justice_programs ORDER BY cases_resolved DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours_spain (id INT, name VARCHAR(50), month VARCHAR(10), visitors INT); INSERT INTO virtual_tours_spain (id, name, month, visitors) VALUES (1, 'Tour1', 'January', 50), (1, 'Tour1', 'February', 75), (2, 'Tour2', 'January', 100), (2, 'Tour2', 'February', 120); | What is the minimum and maximum number of visitors per month for each virtual tour in Spain? | SELECT name, MIN(visitors) as min_visitors, MAX(visitors) as max_visitors FROM virtual_tours_spain WHERE name LIKE '%Spain%' GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (ExhibitionID INT, ExhibitionName TEXT, Year INT, Region TEXT, Attendance INT); INSERT INTO Exhibitions (ExhibitionID, ExhibitionName, Year, Region, Attendance) VALUES (1, 'African Art Now', 2017, 'Africa', 2000); INSERT INTO Exhibitions (ExhibitionID, ExhibitionName, Year, Region, Attendance) ... | How many art exhibitions were held in Africa by year and what was their average attendance? | SELECT Year, AVG(Attendance) as AvgAttendance FROM Exhibitions WHERE Region = 'Africa' GROUP BY Year; | 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.