context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE well_production_niger (well_name VARCHAR(20), production_qty FLOAT, production_date DATE, location VARCHAR(20)); INSERT INTO well_production_niger (well_name, production_qty, production_date, location) VALUES ('Well A', 1000, '2020-01-01', 'Niger Delta'); INSERT INTO well_production_niger (well_name, produ... | What are the total production quantities for each well in the Niger Delta, partitioned by year? | SELECT well_name, EXTRACT(YEAR FROM production_date) as year, SUM(production_qty) as total_production FROM well_production_niger WHERE location = 'Niger Delta' GROUP BY well_name, year ORDER BY well_name, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, department VARCHAR(20), amount FLOAT); INSERT INTO Donations (id, department, amount) VALUES (1, 'Animals', 500.00), (2, 'Education', 300.00); | What are the total donations received by the 'Animals' department in the 'Donations' table? | SELECT SUM(amount) FROM Donations WHERE department = 'Animals' | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster (disaster_id INT, name VARCHAR(255), location VARCHAR(255), start_date DATE, people_impacted INT); INSERT INTO disaster VALUES (1, 'Hurricane Katrina', 'USA', '2005-08-29', 100000); INSERT INTO disaster VALUES (2, 'Earthquake', 'Mexico', '2017-09-19', 50000); | What is the number of people impacted by disasters in each country, sorted by the total number of people impacted, for the last 3 years? | SELECT location as country, SUM(people_impacted) as total_people_impacted FROM disaster WHERE start_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY location ORDER BY total_people_impacted DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (id INT, student_id INT, accommodation_type VARCHAR(255), cost FLOAT); INSERT INTO accommodations (id, student_id, accommodation_type, cost) VALUES (1, 123, 'visual_aids', 250.0), (2, 456, 'audio_aids', 100.0), (3, 789, 'large_print_materials', 120.0), (4, 890, 'mobility_aids', 300.0); | Update the cost of "audio_aids" to 150.0 in the "accommodations" table | UPDATE accommodations SET cost = 150.0 WHERE accommodation_type = 'audio_aids'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TotalFleet (TotalVehicles int, WheelchairAccessible int); INSERT INTO TotalFleet (TotalVehicles, WheelchairAccessible) VALUES (300, 50); | What is the total number of wheelchair accessible vehicles in the entire fleet? | SELECT SUM(WheelchairAccessible) FROM TotalFleet; | gretelai_synthetic_text_to_sql |
CREATE TABLE Historical_Sites (id INT, site_name VARCHAR(50), artifact_id INT); INSERT INTO Historical_Sites (id, site_name, artifact_id) VALUES (1, 'Site E', 1), (2, 'Site F', 2), (3, 'Site G', 3); CREATE TABLE Artifacts (id INT, artifact_name VARCHAR(50), age INT); INSERT INTO Artifacts (id, artifact_name, age) VALUE... | Which excavation sites have the oldest artifacts in the 'Historical_Sites' table? | SELECT site_name FROM Historical_Sites JOIN Artifacts ON Historical_Sites.artifact_id = Artifacts.id GROUP BY site_name HAVING MAX(age); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, program_name VARCHAR(50), budget DECIMAL, impact DECIMAL); | List all programs with a budget lower than the overall program impact? | SELECT program_name FROM programs WHERE budget < (SELECT AVG(impact) FROM programs); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicles (ID INT, Name TEXT, Type TEXT, SafetyRating FLOAT, ReleaseYear INT); INSERT INTO Vehicles (ID, Name, Type, SafetyRating, ReleaseYear) VALUES (1, 'Tesla Model S Plaid', 'Electric', 5.5, 2023); INSERT INTO Vehicles (ID, Name, Type, SafetyRating, ReleaseYear) VALUES (2, 'Lucid Air', 'Electric', 5.3, ... | What is the maximum safety rating of electric vehicles released in 2023? | SELECT MAX(SafetyRating) FROM Vehicles WHERE Type = 'Electric' AND ReleaseYear = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (id INT, project VARCHAR(50), location VARCHAR(50), amount FLOAT); INSERT INTO climate_finance (id, project, location, amount) VALUES (1, 'Adaptation Project', 'Africa', 5000000.0); INSERT INTO climate_finance (id, project, location, amount) VALUES (2, 'Mitigation Project', 'Africa', 700000... | What is the maximum amount of climate finance committed to projects in Africa? | SELECT MAX(amount) FROM climate_finance WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO customers (customer_id, name, region) VALUES (1, 'John Doe', 'East'), (2, 'Jane Smith', 'West'); CREATE TABLE transactions (transaction_id INT, customer_id INT, amount DECIMAL(10, 2)); INSERT INTO transactions (transaction_id, c... | What is the average transaction value per customer in the East region? | SELECT AVG(amount) FROM transactions t JOIN customers c ON t.customer_id = c.customer_id WHERE c.region = 'East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Port (id INT, name TEXT); INSERT INTO Port (id, name) VALUES (1, 'A'), (2, 'B'); CREATE TABLE Vessel (id INT, name TEXT, speed FLOAT, port_id INT); INSERT INTO Vessel (id, name, speed, port_id) VALUES (1, 'V1', 15, 1), (2, 'V2', 20, 1), (3, 'V3', 18, 2); | What is the average speed of vessels that departed from port 'A'? | SELECT AVG(speed) FROM Vessel WHERE port_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name TEXT, location TEXT, is_fair_trade BOOLEAN); CREATE TABLE manufacturers (id INT PRIMARY KEY, name TEXT, location TEXT, supplier_id INT, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); | Provide a list of fair trade suppliers who supply to manufacturers in the United States. | SELECT s.name FROM suppliers s JOIN manufacturers m ON s.id = m.supplier_id WHERE s.is_fair_trade = TRUE AND m.location = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_params (id INT, farm_id INT, country TEXT, water_type TEXT, dissolved_oxygen DECIMAL(5,2)); INSERT INTO water_params (id, farm_id, country, water_type, dissolved_oxygen) VALUES (1, 1, 'Colombia', 'Freshwater', 7.5); INSERT INTO water_params (id, farm_id, country, water_type, dissolved_oxygen) VALUES ... | What is the maximum dissolved oxygen level in freshwater fish ponds in Colombia? | SELECT MAX(dissolved_oxygen) FROM water_params WHERE country = 'Colombia' AND water_type = 'Freshwater'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (shipment_id INT, customer_id INT, shipped_date TIMESTAMP, shipped_time TIME, delivered_date TIMESTAMP, delivered_time TIME, status TEXT, delay DECIMAL(3,2)); | How many shipments were delivered on time in the month of June from the 'shipments' table? | SELECT COUNT(*) FROM shipments WHERE MONTH(delivered_date) = 6 AND delay = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (ExhibitionID INT PRIMARY KEY, Title TEXT, Date DATE, City TEXT); CREATE TABLE ExhibitionArtworks (ExhibitionID INT, ArtworkID INT); CREATE TABLE Artworks (ArtworkID INT PRIMARY KEY, Title TEXT, ArtistID INT, Category TEXT); | What is the average number of works displayed in exhibitions held in 'New York'? | SELECT AVG(ExhibitionArtworks.ArtworkID) FROM Exhibitions INNER JOIN ExhibitionArtworks ON Exhibitions.ExhibitionID = ExhibitionArtworks.ExhibitionID WHERE Exhibitions.City = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE expeditions (id INT PRIMARY KEY, name VARCHAR(100), leader_id INT, start_date DATE, end_date DATE); INSERT INTO expeditions (id, name, leader_id, start_date, end_date) VALUES (1, 'Arctic Exploration', 5, '2023-03-15', '2023-05-31'); CREATE TABLE species_observations (id INT PRIMARY KEY, expedition_id INT, ... | What is the name of the leader and the start date of the expeditions where the Musk Ox was observed? | SELECT expeditions.name, expeditions.start_date FROM expeditions INNER JOIN species_observations ON expeditions.id = species_observations.expedition_id WHERE species_observations.species = 'Musk Ox'; | gretelai_synthetic_text_to_sql |
CREATE TABLE soldiers (id INT PRIMARY KEY, name VARCHAR(50), rank VARCHAR(50), branch VARCHAR(50)); | Create a table named 'soldiers' | CREATE TABLE soldiers (id INT PRIMARY KEY, name VARCHAR(50), rank VARCHAR(50), branch VARCHAR(50)); | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (id INT, name TEXT, balance INT, type TEXT); INSERT INTO digital_assets (id, name, balance, type) VALUES (1, 'Asset1', 50, 'token'), (2, 'Asset2', 100, 'asset'); | What are the names and balances of all digital assets with a type of 'token'? | SELECT name, balance FROM digital_assets WHERE type = 'token' | gretelai_synthetic_text_to_sql |
CREATE SCHEMA forestry; CREATE TABLE habitats (id INT, name VARCHAR(50), area FLOAT); INSERT INTO habitats (id, name, area) VALUES (1, 'deer', 25.3), (2, 'wolf', 18.2), (3, 'bear', 31.5); | list all wildlife habitats with their respective areas in descending order | SELECT name, area FROM forestry.habitats ORDER BY area DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE influencers (influencer_id INT, influencer_name TEXT);CREATE TABLE posts (post_id INT, post_text TEXT, influencer_id INT, post_date DATE);CREATE TABLE brands (brand_id INT, brand_name TEXT, brand_sustainable BOOLEAN);CREATE TABLE mentions (mention_id INT, post_id INT, brand_id INT); | What are the top 5 most mentioned sustainable brands in influencer posts, in the last month? | SELECT b.brand_name, COUNT(m.mention_id) as mention_count FROM mentions m JOIN posts p ON m.post_id = p.post_id JOIN brands b ON m.brand_id = b.brand_id JOIN influencers i ON p.influencer_id = i.influencer_id WHERE b.brand_sustainable = TRUE AND p.post_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY b.brand_n... | gretelai_synthetic_text_to_sql |
CREATE TABLE lifelong_learning (participant_id INT, participant_age INT, participant_gender VARCHAR(10), program_title VARCHAR(50), program_date DATE); INSERT INTO lifelong_learning (participant_id, participant_age, participant_gender, program_title, program_date) VALUES (1, 35, 'Male', 'Coding for Beginners', '2022-03... | What is the distribution of lifelong learning program participants by age and gender in 'Spring 2022'? | SELECT participant_age, participant_gender, COUNT(participant_id) FROM lifelong_learning WHERE program_date = '2022-03-01' GROUP BY participant_age, participant_gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(255)); CREATE TABLE commercial_bank_transactions (transaction_id INT, customer_id INT, amount DECIMAL(10,2), trans_date DATE); | Find the customers who have made more than 10 transactions in a week for a commercial bank? | SELECT customers.name FROM customers INNER JOIN commercial_bank_transactions ON customers.customer_id = commercial_bank_transactions.customer_id WHERE DATE_PART('week', commercial_bank_transactions.trans_date) = DATE_PART('week', NOW()) AND DATE_PART('year', commercial_bank_transactions.trans_date) = DATE_PART('year', ... | gretelai_synthetic_text_to_sql |
CREATE TABLE Attendees (AttendeeID INT, Age INT, Gender VARCHAR(10));CREATE TABLE DancePrograms (ProgramID INT, ProgramName VARCHAR(20));CREATE TABLE Attendance (AttendeeID INT, ProgramID INT); | What is the average age of attendees who have participated in dance programs, and how many unique programs have they attended? | SELECT AVG(A.Age) AS Avg_Age, COUNT(DISTINCT A.ProgramID) AS Num_Unique_Programs FROM Attendees A INNER JOIN Attendance AT ON A.AttendeeID = AT.AttendeeID INNER JOIN DancePrograms DP ON AT.ProgramID = DP.ProgramID; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), TrainingCompletion DATE); | Insert a new employee from an underrepresented community into the Employees table | INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, TrainingCompletion) VALUES (8, 'Fatima', 'Ahmed', 'IT', '2022-05-10'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Platform VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Platform) VALUES (1, 25, 'PC'), (2, 30, 'Console'), (3, 22, 'VR'); | Show the names and average ages of players who have played VR games, compared to console players. | SELECT p1.Platform, AVG(p1.Age) as AvgAge FROM Players p1 WHERE p1.Platform IN ('VR', 'Console') GROUP BY p1.Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (name VARCHAR(255), country VARCHAR(255), ocean VARCHAR(255)); INSERT INTO vessels (name, country, ocean) VALUES ('Vessel 1', 'Country 1', 'Indian Ocean'), ('Vessel 2', 'Country 2', 'Indian Ocean'); | Which countries have the highest and lowest number of vessels in the Indian Ocean? | SELECT country, COUNT(*) as vessel_count FROM vessels WHERE ocean = 'Indian Ocean' GROUP BY country ORDER BY vessel_count DESC LIMIT 1; SELECT country, COUNT(*) as vessel_count FROM vessels WHERE ocean = 'Indian Ocean' GROUP BY country ORDER BY vessel_count ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Museums (MuseumID INT, Name TEXT, Country TEXT);CREATE TABLE GiftShops (GiftShopID INT, MuseumID INT, Revenue INT); | What is the total revenue generated by museum gift shops in the United States? | SELECT SUM(GiftShops.Revenue) FROM Museums INNER JOIN GiftShops ON Museums.MuseumID = GiftShops.MuseumID WHERE Museums.Country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers (id INT, name VARCHAR(50), industry VARCHAR(50), salary FLOAT, state VARCHAR(50)); INSERT INTO workers (id, name, industry, salary, state) VALUES (1, 'John Doe', 'oil', 60000, 'California'); INSERT INTO workers (id, name, industry, salary, state) VALUES (2, 'Jane Smith', 'gas', 65000, 'California')... | Update the record of 'Jane Smith' to have a salary of $70,000 in the 'gas' industry in California, USA. | UPDATE workers SET salary = 70000 WHERE name = 'Jane Smith' AND industry = 'gas' AND state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE model_details (id INT PRIMARY KEY, model_name VARCHAR(100), model_architecture VARCHAR(50), explainability_score DECIMAL(5,4), created_date DATE); INSERT INTO model_details (id, model_name, model_architecture, explainability_score, created_date) VALUES (1, 'Model1', 'Decision Tree', 0.8765, '2021-01-01'), ... | What is the average explainability score for models that use decision trees as their architecture? | SELECT model_architecture, AVG(explainability_score) as avg_explainability_score FROM model_details WHERE model_architecture = 'Decision Tree' GROUP BY model_architecture; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mekong_Delta_Farms (farm_name VARCHAR(50), crop VARCHAR(30), production INT, year INT); INSERT INTO Mekong_Delta_Farms (farm_name, crop, production, year) VALUES ('Farm1', 'Rice', 2000, 2019), ('Farm1', 'Sorghum', 1500, 2019); | What is the total production of 'Rice' and 'Sorghum' in the 'Mekong Delta' region for the year 2019? | SELECT SUM(mdf.production) as total_production FROM Mekong_Delta_Farms mdf WHERE mdf.crop IN ('Rice', 'Sorghum') AND mdf.year = 2019 GROUP BY mdf.crop; | gretelai_synthetic_text_to_sql |
CREATE TABLE arctic_temperature (year INT, avg_temp DECIMAL(5,2)); INSERT INTO arctic_temperature (year, avg_temp) VALUES (1980, -5.0), (1985, -4.8), (1990, -4.6), (1995, -4.4), (2000, -4.2), (2005, -3.8), (2010, -3.6), (2015, -3.2), (2020, -3.0); | What is the average temperature increase in the Arctic region from 1980 to 2020? | SELECT AVG(avg_temp) FROM arctic_temperature WHERE year BETWEEN 1980 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE strategy_projects (strategy_id INT, project_id INT, completion_year INT, sector VARCHAR(255), country VARCHAR(255)); INSERT INTO strategy_projects (strategy_id, project_id, completion_year, sector, country) VALUES (1, 1, 2020, 'Waste Management', 'USA'), (2, 2, 2020, 'Waste Management', 'Canada'), (3, 3, 2... | How many projects were completed in each country for waste management in 2020? | SELECT country, COUNT(project_id) as completed_projects FROM strategy_projects WHERE completion_year = 2020 AND sector = 'Waste Management' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProgramOutcomes (program VARCHAR(255), outcome VARCHAR(255), year INT); | Create a table named 'ProgramOutcomes' with columns 'program', 'outcome', and 'year'. | CREATE TABLE ProgramOutcomes (program VARCHAR(255), outcome VARCHAR(255), year INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE Songs (SongID INT, SongName VARCHAR(100), Genre VARCHAR(50), Country VARCHAR(50)); INSERT INTO Songs VALUES (1, 'Song1', 'Pop', 'USA'); INSERT INTO Songs VALUES (2, 'Song2', 'Pop', 'Canada'); INSERT INTO Songs VALUES (3, 'Song3', 'Rock', 'USA'); | How many pop songs have been streamed in the US and Canada? | SELECT COUNT(*) FROM Songs WHERE Genre = 'Pop' AND (Country = 'USA' OR Country = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, city TEXT, region TEXT, engagement_time FLOAT); INSERT INTO virtual_tours (tour_id, city, region, engagement_time) VALUES (1, 'Berlin', 'EMEA', 180.5), (2, 'Paris', 'EMEA', 210.7), (3, 'Rome', 'EMEA', 150.1); | What is the average virtual tour engagement time in 'EMEA'? | SELECT AVG(engagement_time) FROM virtual_tours WHERE region = 'EMEA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ads (ad_id INT, post_id INT, revenue DECIMAL(10,2), ad_date DATE);CREATE TABLE posts (post_id INT, user_id INT, content TEXT, post_date DATE, region VARCHAR(50)); INSERT INTO ads (ad_id, post_id, revenue, ad_date) VALUES (1, 1, 100, '2023-03-05'), (2, 2, 200, '2023-03-01'); INSERT INTO posts (post_id, user... | What was the total ad revenue for posts related to "veganism" in Asia in the last week? | SELECT SUM(revenue) FROM ads JOIN posts ON ads.post_id = posts.post_id WHERE posts.content LIKE '%vegan%' AND posts.region = 'Asia' AND ads.ad_date >= DATEADD(day, -7, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE forest_type (forest_type_id INT, forest_type_name TEXT, PRIMARY KEY (forest_type_id)); CREATE TABLE forest (forest_id INT, forest_type_id INT, hectares INT, age INT, carbon_sequestration_rate REAL, PRIMARY KEY (forest_id), FOREIGN KEY (forest_type_id) REFERENCES forest_type(forest_type_id)); | Show the carbon sequestration rate per hectare for each forest type, along with the average age of those forests, sorted by the carbon sequestration rate in descending order. | SELECT f.forest_type_name, f.carbon_sequestration_rate, AVG(f.age) AS average_age FROM forest f GROUP BY f.forest_type_name, f.carbon_sequestration_rate ORDER BY f.carbon_sequestration_rate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (Id INT, Race VARCHAR(25), Age INT); INSERT INTO CommunityHealthWorkers (Id, Race, Age) VALUES (1, 'Asian', 42), (2, 'Native American', 45), (3, 'Asian', 48), (4, 'Native American', 50), (5, 'Asian', 52); | What is the average age of community health workers who identify as Asian or Native American? | SELECT Race, AVG(Age) as AvgAge FROM CommunityHealthWorkers WHERE Race IN ('Asian', 'Native American') GROUP BY Race; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_electric_vehicles (city_name VARCHAR(255), num_electric_vehicles INT); INSERT INTO city_electric_vehicles (city_name, num_electric_vehicles) VALUES ('San Francisco', 15000), ('Los Angeles', 20000), ('New York', 30000); | How many cities in the 'transportation' schema have more than 10000 electric vehicles? | SELECT COUNT(*) FROM (SELECT city_name FROM city_electric_vehicles WHERE num_electric_vehicles > 10000 GROUP BY city_name) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (category VARCHAR(255), sales FLOAT, tax FLOAT); INSERT INTO menu (category, sales, tax) VALUES ('Appetizers', 5000.00, 0.08), ('Entrees', 12000.00, 0.09), ('Desserts', 6000.00, 0.10); | What is the total sales revenue for each menu category, including tax? | SELECT category, SUM(sales*(1+tax)) FROM menu GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name VARCHAR(100), location VARCHAR(50), budget FLOAT); INSERT INTO startups (id, name, location, budget) VALUES (1, 'BioTech Asia', 'Singapore', 3000000); INSERT INTO startups (id, name, location, budget) VALUES (2, 'Genetech Pacific', 'California', 5000000); INSERT INTO startups (id, na... | What is the average budget allocated for bioprocess engineering R&D in startups located in the Asia-Pacific region? | SELECT AVG(budget) FROM startups WHERE location LIKE '%Asia%' OR location LIKE '%Pacific%' AND category = 'bioprocess engineering'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donor_id INT, nonprofit_id INT, donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (donation_id, donor_id, nonprofit_id, donation_amount, donation_date) VALUES (1, 1, 1, 500, '2022-01-05'); INSERT INTO donations (donation_id, donor_id, nonprofit_id, donati... | List the top 3 nonprofit categories with the highest average donation amounts in 2022. | SELECT nonprofit_category, AVG(donation_amount) as avg_donation FROM donations JOIN nonprofits ON donations.nonprofit_id = nonprofits.nonprofit_id WHERE donation_date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY nonprofit_category ORDER BY avg_donation DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, donor_name VARCHAR, contact_name VARCHAR, contact_email VARCHAR, contact_phone VARCHAR); INSERT INTO donors (id, donor_name, contact_name, contact_email, contact_phone) VALUES (1, 'Jane Doe', 'Jane Doe', 'jane.doe@example.com', '555-555-5555'); | Update the contact information for a donor in the donors table | UPDATE donors SET contact_name = 'Jane Smith', contact_email = 'jane.smith@example.com', contact_phone = '555-555-5556' WHERE donor_name = 'Jane Doe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment_incidents (incident_date DATE, incident_type VARCHAR(255)); INSERT INTO military_equipment_incidents (incident_date, incident_type) VALUES ('2021-01-01', 'Malfunction'), ('2021-01-15', 'Collision'), ('2021-03-20', 'Theft'), ('2021-04-01', 'Malfunction'), ('2021-05-01', 'Collision'), ('20... | How many military equipment incidents occurred in Q1 and Q3 of 2021? | SELECT COUNT(*) FROM military_equipment_incidents WHERE incident_date BETWEEN '2021-01-01' AND '2021-03-31' OR incident_date BETWEEN '2021-07-01' AND '2021-09-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Productivity_Statistics (Mine_Name VARCHAR(50), Productivity FLOAT, Year INT); INSERT INTO Productivity_Statistics (Mine_Name, Productivity, Year) VALUES ('Garnet Grove', 5.2, 2018), ('Lapis Lazuli Lodge', 4.8, 2018), ('Agate Acres', 5.7, 2018), ('Fluorite Farm', 4.5, 2018); | Delete records of mines with productivity below the average for 2018. | DELETE FROM Productivity_Statistics WHERE Productivity < (SELECT AVG(Productivity) FROM Productivity_Statistics WHERE Year = 2018) AND Year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (CaseID int, Outcome varchar(50), AttorneyID int); CREATE TABLE Attorneys (AttorneyID int, Gender varchar(10)); INSERT INTO Cases VALUES (1, 'Won', 1), (2, 'Lost', 2), (3, 'Won', 3), (4, 'Lost', 1), (5, 'Won', 2), (6, 'Lost', 3); INSERT INTO Attorneys VALUES (1, 'Male'), (2, 'Female'), (3, 'Male'); | What is the success rate of cases handled by female attorneys, compared to male attorneys? | SELECT SUM(CASE WHEN Attorneys.Gender = 'Female' AND Cases.Outcome = 'Won' THEN 1 ELSE 0 END)/COUNT(*) AS FemaleSuccessRate, SUM(CASE WHEN Attorneys.Gender = 'Male' AND Cases.Outcome = 'Won' THEN 1 ELSE 0 END)/COUNT(*) AS MaleSuccessRate FROM Cases JOIN Attorneys ON Cases.AttorneyID = Attorneys.AttorneyID; | gretelai_synthetic_text_to_sql |
CREATE TABLE EventAttendance (attendee_id INT, event_id INT, event_location VARCHAR(50), attendee_date DATE); INSERT INTO EventAttendance (attendee_id, event_id, event_location, attendee_date) VALUES (1, 1, 'Asia', '2020-01-01'), (2, 2, 'Europe', '2020-02-01'), (3, 3, 'Asia', '2020-03-01'); | How many attendees were there at events in 'Asia'? | SELECT COUNT(*) AS total_attendees FROM EventAttendance WHERE event_location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd_inclusive (teacher_id INT, gender VARCHAR(10), workshop_date DATE, workshop_topic VARCHAR(50)); INSERT INTO teacher_pd_inclusive (teacher_id, gender, workshop_date, workshop_topic) VALUES (1, 'Female', '2021-02-15', 'Inclusive Teaching'), (2, 'Male', '2021-03-10', 'Inclusive Teaching'), (3, 'Non... | What is the percentage of teachers who have attended professional development workshops on inclusive teaching practices, by gender, in the past year? | SELECT gender, COUNT(teacher_id) * 100.0 / (SELECT COUNT(DISTINCT teacher_id) FROM teacher_pd_inclusive WHERE workshop_date >= DATEADD(year, -1, CURRENT_DATE)) as percentage FROM teacher_pd_inclusive WHERE workshop_topic = 'Inclusive Teaching' AND workshop_date >= DATEADD(year, -1, CURRENT_DATE) GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE art_collection (artwork_id INT, name VARCHAR(50), artist VARCHAR(50), year INT, medium VARCHAR(50)); | List the artworks in the 'art_collection' table, grouped by the medium they were created in. | SELECT medium, COUNT(*) as artwork_count FROM art_collection GROUP BY medium; | gretelai_synthetic_text_to_sql |
CREATE TABLE travel_advisories (country_issuing_advisory VARCHAR(50), destination VARCHAR(50)); | How many destinations have travel advisories issued by at least 3 countries in Africa? | SELECT COUNT(DISTINCT destination) FROM travel_advisories WHERE destination IN (SELECT destination FROM travel_advisories GROUP BY destination HAVING COUNT(DISTINCT country_issuing_advisory) >= 3 AND continent = 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_pollution_types (id INT, pollution_type VARCHAR(255), description TEXT); | List the types of marine pollution in the 'Marine Pollution Types' table. | SELECT DISTINCT pollution_type FROM marine_pollution_types; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics; CREATE TABLE if not exists genetics.projects (id INT, name TEXT, country TEXT); INSERT INTO genetics.projects (id, name, country) VALUES (1, 'ProjectX', 'Germany'); INSERT INTO genetics.projects (id, name, country) VALUES (2, 'ProjectY', 'USA'); INSERT INTO genetics.projects (id, n... | Count the number of unique genetic research projects in Germany. | SELECT COUNT(DISTINCT name) FROM genetics.projects WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Investments (CustomerID INT, Market VARCHAR(20), Value DECIMAL(10,2)); INSERT INTO Investments (CustomerID, Market, Value) VALUES (1, 'US', 5000); INSERT INTO Investments (CustomerID, Market, Value) VALUES (2, 'Europe', 3000); | Which customers have investments in either the US or European stock markets? | SELECT CustomerID FROM Investments WHERE Market IN ('US', 'Europe') GROUP BY CustomerID HAVING COUNT(DISTINCT Market) = 2 | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors (vendor_id INT, vendor_name TEXT, region TEXT); INSERT INTO vendors (vendor_id, vendor_name, region) VALUES (1, 'Green Vendors', 'Northeast'); INSERT INTO vendors (vendor_id, vendor_name, region) VALUES (2, 'Eco-Friendly Vendors', 'West'); | How many circular supply chain vendors are there in each region? | SELECT region, COUNT(*) FROM vendors GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmEmissions (farm_id INT, species VARCHAR(20), carbon_footprint FLOAT); INSERT INTO FarmEmissions (farm_id, species, carbon_footprint) VALUES (1, 'Tilapia', 500), (2, 'Pangasius', 600), (3, 'Catfish', 450); | What is the total carbon footprint (in kg CO2) for each farm in FarmEmissions? | SELECT farm_id, SUM(carbon_footprint) FROM FarmEmissions GROUP BY farm_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, name VARCHAR(50), language VARCHAR(50)); INSERT INTO heritage_sites (id, name, language) VALUES (1, 'Mesa Verde', 'English'), (2, 'Old Quebec', 'French'), (3, 'Chichen Itza', 'Mayan'), (4, 'Angkor Wat', 'Khmer'); | Update the language of the record with id 3 in the heritage_sites table to 'Spanish'. | UPDATE heritage_sites SET language = 'Spanish' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT, name VARCHAR(50)); CREATE TABLE crops_farmers (farmer_id INT, crop_id INT); INSERT INTO crops (id, name) VALUES (1, 'Corn'), (2, 'Soybean'), (3, 'Wheat'), (4, 'Rye'); INSERT INTO crops_farmers (farmer_id, crop_id) VALUES (1, 1), (1, 2), (2, 1), (3, 1), (3, 2), (3, 3); | Show the names of all the crops that are not cultivated by any farmer? | SELECT name FROM crops WHERE id NOT IN (SELECT crop_id FROM crops_farmers); | gretelai_synthetic_text_to_sql |
CREATE TABLE co_ownership (price INT, city VARCHAR(20)); | How many co-ownership properties are there in Oslo with a price below 300,000? | SELECT COUNT(*) FROM co_ownership WHERE price < 300000 AND city = 'Oslo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (id INT, name VARCHAR(50), initial_budget FLOAT); CREATE TABLE MissionBudget (id INT, mission_id INT, budget_year INT, budget FLOAT); CREATE VIEW TotalMissionBudget AS SELECT mission_id, SUM(budget) as total_budget FROM MissionBudget GROUP BY mission_id; | Which space missions have exceeded their initial budget? | SELECT SpaceMissions.name, TotalMissionBudget.total_budget FROM SpaceMissions JOIN TotalMissionBudget ON SpaceMissions.id = TotalMissionBudget.mission_id WHERE TotalMissionBudget.total_budget > SpaceMissions.initial_budget; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (FarmerID int, FarmerName text, Location text); INSERT INTO Farmers (FarmerID, FarmerName, Location) VALUES (1, 'Bob Smith', 'New York'); CREATE TABLE Production (Product text, FarmerID int, Quantity int); INSERT INTO Production (Product, FarmerID, Quantity) VALUES ('Carrots', 1, 800); INSERT INTO ... | What is the total production of 'Carrots' by all farmers in 'New York' and 'New Jersey'? | SELECT SUM(Quantity) FROM Production JOIN Farmers ON Production.FarmerID = Farmers.FarmerID WHERE Product = 'Carrots' AND (Location = 'New York' OR Location = 'New Jersey'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_material (id INT PRIMARY KEY, permit_id INT, material_name VARCHAR(50), FOREIGN KEY (permit_id) REFERENCES building_permit(id)); INSERT INTO sustainable_material (id, permit_id, material_name) VALUES (1, 1, 'Recycled Steel'); | List projects that have used recycled materials and their permit numbers | SELECT p.name, bp.permit_number FROM project p INNER JOIN building_permit bp ON p.id = bp.project_id INNER JOIN sustainable_material sm ON bp.id = sm.permit_id WHERE sm.material_name = 'Recycled Steel'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibits (exhibit_id INT, country VARCHAR(50), city VARCHAR(50)); INSERT INTO Exhibits (exhibit_id, country, city) VALUES (1, 'USA', 'New York'), (2, 'USA', 'Los Angeles'), (3, 'Canada', 'Toronto'); | Find the total number of art exhibits for each country, ordered by the number of exhibits in descending order. | SELECT country, COUNT(*) as num_exhibits FROM Exhibits GROUP BY country ORDER BY num_exhibits DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, well_being_score INT, gender VARCHAR(50)); | What is the average well-being score for athletes who identify as female? | SELECT AVG(athletes.well_being_score) FROM athletes WHERE athletes.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE NetworkDevices (id INT, device_name VARCHAR(50), severity VARCHAR(10), discovered_date DATE); INSERT INTO NetworkDevices (id, device_name, severity, discovered_date) VALUES (1, 'Router1', 'High', '2021-08-01'), (2, 'Switch1', 'Medium', '2021-07-15'), (3, 'Firewall1', 'Low', '2021-06-01'); | What is the total number of vulnerabilities found in the 'NetworkDevices' table, grouped by severity? | SELECT severity, COUNT(*) as total_vulnerabilities FROM NetworkDevices GROUP BY severity; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions_europe (country VARCHAR(20), year INT, ghg_emissions INT); INSERT INTO emissions_europe VALUES ('DE', 2019, 1000), ('FR', 2019, 800), ('IT', 2019, 600), ('ES', 2019, 700); | What is the total greenhouse gas emissions for each country in Europe in 2019? | SELECT country, SUM(ghg_emissions) AS total_emissions FROM emissions_europe WHERE year = 2019 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Brands (brand_id INT, brand_name TEXT, uses_organic_cotton BOOLEAN); INSERT INTO Brands (brand_id, brand_name, uses_organic_cotton) VALUES (1, 'BrandA', true), (2, 'BrandB', false); CREATE TABLE Sales (sale_id INT, brand_id INT, revenue INT); INSERT INTO Sales (sale_id, brand_id, revenue) VALUES (1, 1, 100... | What is the total revenue generated by brands that use organic cotton? | SELECT SUM(revenue) FROM Sales INNER JOIN Brands ON Sales.brand_id = Brands.brand_id WHERE Brands.uses_organic_cotton = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory(id INT, material TEXT, quantity INT); INSERT INTO Inventory(id, material, quantity) VALUES (1, 'Hemp', 500), (2, 'Organic Cotton', 300); | What is the total quantity of sustainable material 'Hemp' in stock? | SELECT SUM(quantity) FROM Inventory WHERE material = 'Hemp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE attractions (id INT PRIMARY KEY, name TEXT, type TEXT); INSERT INTO attractions (id, name, type) VALUES (1, 'Louvre Museum', 'museum'); INSERT INTO attractions (id, name, type) VALUES (2, 'Eiffel Tower', 'monument'); | Delete all records from the "attractions" table where the attraction type is 'museum' | DELETE FROM attractions WHERE type = 'museum'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainability (id INT, product VARCHAR(255), sustainable BOOLEAN, rating FLOAT, region VARCHAR(255)); INSERT INTO sustainability (id, product, sustainable, rating, region) VALUES (1, 'Moisturizer', true, 4.5, 'Asia'), (2, 'Toner', false, 3.0, 'Asia'), (3, 'Cleanser', true, 4.0, 'Asia'); | What is the minimum rating of sustainable beauty products sold in Asia? | SELECT MIN(rating) FROM sustainability WHERE sustainable = true AND region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtSales (id INT, title VARCHAR(255), price DECIMAL(10,2), sale_year INT, artist_country VARCHAR(255)); INSERT INTO ArtSales (id, title, price, sale_year, artist_country) VALUES (1, 'Artwork1', 600, 2006, 'Spain'); | What is the minimum price of artworks sold by Spanish artists after 2005? | SELECT MIN(price) FROM ArtSales WHERE artist_country = 'Spain' AND sale_year > 2005; | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyIncidents (id INT, location VARCHAR(255), year INT, incident_count INT); INSERT INTO SafetyIncidents (id, location, year, incident_count) VALUES (1, 'west coast', 2021, 7), (2, 'east coast', 2020, 5); | How many safety incidents were reported in the west coast in 2021? | SELECT SUM(incident_count) FROM SafetyIncidents WHERE location = 'west coast' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, grade_level INT, mental_health_score INT); INSERT INTO student_mental_health (student_id, grade_level, mental_health_score) VALUES (1, 8, 75), (2, 9, 80), (3, 8, 70), (4, 7, 85), (5, 9, 90); | Find the average mental health score for students in each grade level. | SELECT grade_level, AVG(mental_health_score) FROM student_mental_health GROUP BY grade_level; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents_by_sector (id INT, sector VARCHAR(255), incident_date DATE, resolution_date DATE); INSERT INTO security_incidents_by_sector (id, sector, incident_date, resolution_date) VALUES (1, 'manufacturing', '2022-01-01', '2022-01-15'); | What is the total number of security incidents in the manufacturing sector in the last 3 months, for incidents that were resolved within 60 days? | SELECT COUNT(*) FROM security_incidents_by_sector WHERE sector = 'manufacturing' AND resolution_date <= DATE_ADD(incident_date, INTERVAL 60 DAY) AND incident_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (sale_id INT, product_id INT, sale_location TEXT, sale_date DATE, quantity INT, price DECIMAL(5,2)); INSERT INTO sales_data (sale_id, product_id, sale_location, sale_date, quantity, price) VALUES (1, 1, 'Canada', '2021-01-01', 50, 12.99), (2, 3, 'USA', '2021-02-01', 75, 18.99), (3, 2, 'Canada', ... | Find the total sales of lipstick products in Canada. | SELECT SUM(quantity * price) FROM sales_data JOIN products ON sales_data.product_id = products.product_id WHERE sale_location = 'Canada' AND product_category = 'Lipstick'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Adventure_Game_B (player_id INT, name VARCHAR(50), age INT, gender VARCHAR(10)); INSERT INTO Adventure_Game_B (player_id, name, age, gender) VALUES (1, 'John Doe', 25, 'Male'), (2, 'Jane Smith', 30, 'Female'), (7, 'David Kim', 29, 'Male'); | Find the number of players who have played "Adventure Game B" and identify their gender. | SELECT COUNT(*), gender FROM Adventure_Game_B GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier_dim (supplier_id INT, supplier_name VARCHAR, supplier_country VARCHAR); | Show the total sales for each supplier country, from the order_fact and sales_fact tables, grouped by supplier_country, for the month of March 2022. | SELECT s.supplier_country, SUM(sf.sale_quantity * sf.sale_price) as total_sales FROM sales_fact sf JOIN order_fact o ON sf.sale_id = o.sale_id JOIN supplier_dim s ON o.supplier_id = s.supplier_id JOIN time_dim t ON sf.sale_date = t.time_date WHERE t.time_month = 3 AND t.time_year = 2022 GROUP BY s.supplier_country; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(50), category VARCHAR(50), price DECIMAL(5,2), calories INT); INSERT INTO menus (menu_id, menu_name, category, price, calories) VALUES (1, 'Quinoa Salad', 'Vegetarian', 9.99, 300), (2, 'Margherita Pizza', 'Non-Vegetarian', 12.99, 800), (3, 'Chickpea Curry', 'Vegan', 10... | Which menu item has the highest calories? | SELECT menu_name, MAX(calories) FROM menus; | gretelai_synthetic_text_to_sql |
CREATE TABLE Department (id INT, name VARCHAR(50), num_employees INT); INSERT INTO Department (id, name, num_employees) VALUES (1, 'Public Works', 12); INSERT INTO Department (id, name, num_employees) VALUES (2, 'Health', 8); INSERT INTO Department (id, name, num_employees) VALUES (3, 'Education', 20); | Which government departments have more than 10 employees? | SELECT name FROM Department WHERE num_employees > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, element VARCHAR(10), year INT, quantity INT); | Insert a record of 100kg europium production in 2018 in the table 'production' | INSERT INTO production (id, element, year, quantity) VALUES (5, 'europium', 2018, 100); | gretelai_synthetic_text_to_sql |
CREATE TABLE bookings (id INT, accommodation_id INT, revenue FLOAT); INSERT INTO bookings (id, accommodation_id, revenue) VALUES (1, 1, 100), (2, 1, 120), (3, 2, 80); CREATE TABLE accommodations (id INT, name TEXT, country TEXT, is_eco_friendly BOOLEAN); INSERT INTO accommodations (id, name, country, is_eco_friendly) V... | What is the total revenue generated from eco-friendly accommodations in France? | SELECT SUM(b.revenue) FROM bookings b JOIN accommodations a ON b.accommodation_id = a.id WHERE a.country = 'France' AND a.is_eco_friendly = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists hotel_bookings (booking_id INT, hotel_type VARCHAR(20), country VARCHAR(50), booking_date DATE); INSERT INTO hotel_bookings (booking_id, hotel_type, country, booking_date) VALUES (1, 'Luxury', 'India', '2022-01-01'), (2, 'Budget', 'India', '2022-02-01'), (3, 'Luxury', 'Japan', '2022-03-01'); | Total number of luxury hotel bookings in India for the year 2022 | SELECT COUNT(*) as total_luxury_bookings FROM hotel_bookings WHERE hotel_type = 'Luxury' AND country = 'India' AND EXTRACT(YEAR FROM booking_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name TEXT, city TEXT, state TEXT, beds INT); INSERT INTO hospitals (id, name, city, state, beds) VALUES (1, 'General Hospital', 'Miami', 'Florida', 500); INSERT INTO hospitals (id, name, city, state, beds) VALUES (2, 'Memorial Hospital', 'Boston', 'Massachusetts', 600); | What is the total number of hospitals and total number of beds for each city? | SELECT city, COUNT(*) as hospital_count, SUM(beds) as total_beds FROM hospitals GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, ProgramID INT, VolunteerDate DATE); INSERT INTO Volunteers (VolunteerID, ProgramID, VolunteerDate) VALUES (1, 1, '2022-04-10'), (2, 1, '2022-05-15'), (3, 2, '2022-07-01'), (4, 1, '2022-06-20'), (5, 3, '2022-05-05'); CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(50))... | How many volunteers participated in each program in Q2 of 2022? | SELECT p.ProgramName, COUNT(v.VolunteerID) as VolunteerCount FROM Volunteers v JOIN Programs p ON v.ProgramID = p.ProgramID WHERE YEAR(v.VolunteerDate) = 2022 AND MONTH(v.VolunteerDate) BETWEEN 2 AND 4 GROUP BY p.ProgramName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (CountryID INT, CountryName VARCHAR(50), Continent VARCHAR(50)); CREATE TABLE Suppliers (SupplierID INT, CountryID INT, SupplierName VARCHAR(50), Material VARCHAR(50), Quantity INT); INSERT INTO Countries VALUES (1,'Indonesia','Southeast Asia'),(2,'Malaysia','Southeast Asia'),(3,'Thailand','South... | Identify the total quantity of sustainable materials sourced from Southeast Asian countries in the last quarter. | SELECT SUM(Quantity) FROM Suppliers s JOIN Countries c ON s.CountryID = c.CountryID WHERE c.Continent = 'Southeast Asia' AND s.Material = 'Sustainable Material' AND s.SupplierID IN (SELECT SupplierID FROM Suppliers WHERE ProductionDate >= DATEADD(quarter, -1, GETDATE())); | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, severity INT, timestamp TIMESTAMP); INSERT INTO vulnerabilities (id, severity, timestamp) VALUES (1, 8, '2022-02-10 16:30:00'), (2, 5, '2022-02-08 09:00:00'); | What are the vulnerabilities that were found in the past month and have a severity rating of 6 or higher? | SELECT * FROM vulnerabilities WHERE severity >= 6 AND timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Veteran_Employment (Id INT, State VARCHAR(50), Veterans_Employed INT); INSERT INTO Veteran_Employment (Id, State, Veterans_Employed) VALUES (1, 'California', 500000); INSERT INTO Veteran_Employment (Id, State, Veterans_Employed) VALUES (2, 'Texas', 450000); | List all veteran employment stats by state, ordered by the highest number of veterans employed. | SELECT * FROM Veteran_Employment ORDER BY Veterans_Employed DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE public.sales_by_region(id serial PRIMARY KEY, sale_date date, make varchar(255), model varchar(255), region varchar(255), ev_type varchar(255)); | How many electric vehicles were sold in 'California'? | SELECT COUNT(*) FROM public.sales_by_region WHERE region = 'California' AND ev_type = 'Electric'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name TEXT, country TEXT); INSERT INTO ports (port_id, port_name, country) VALUES (1, 'Los Angeles', 'USA'); CREATE TABLE shipments (shipment_id INT, port_id INT, cargo_weight INT); INSERT INTO shipments (shipment_id, port_id, cargo_weight) VALUES (1, 1, 5000), (2, 1, 5500); | What is the average cargo weight for shipments from port 'Los Angeles'? | SELECT AVG(cargo_weight) FROM shipments WHERE port_id = (SELECT port_id FROM ports WHERE port_name = 'Los Angeles') | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningOperations (id INT, name VARCHAR(255), type VARCHAR(255), co2_emissions INT); INSERT INTO MiningOperations (id, name, type, co2_emissions) VALUES (1, 'Open Pit Mining', 'Surface', 500), (2, 'Underground Mining', 'Surface', 300), (3, 'Mountaintop Removal Mining', 'Surface', 700), (4, 'Placer Mining', ... | Calculate the total CO2 emissions for each type of mining operation | SELECT type, SUM(co2_emissions) as total_emissions FROM MiningOperations GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE LongestMissions (MissionID INT, Name VARCHAR(50), Duration INT); INSERT INTO LongestMissions (MissionID, Name, Duration) VALUES (1, 'Apollo 17', 302); INSERT INTO LongestMissions (MissionID, Name, Duration) VALUES (2, 'Apollo 11', 196); INSERT INTO LongestMissions (MissionID, Name, Duration) VALUES (3, 'Ge... | Identify the top 3 longest-duration missions, along with their mission names and duration in days. | SELECT Name, Duration FROM LongestMissions ORDER BY Duration DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, city TEXT, rating FLOAT); | What is the percentage of 5-star hotels in 'Sydney'? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM hotels WHERE city = 'Sydney')) as percentage FROM hotels WHERE rating = 5.0 AND city = 'Sydney'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableProperties (Id INT, City VARCHAR(50), Size FLOAT); INSERT INTO SustainableProperties (Id, City, Size) VALUES (1, 'Portland', 1200.5), (2, 'Seattle', 1500.2), (3, 'Portland', 1350.7); | What is the average size of sustainable properties in Portland, OR? | SELECT AVG(Size) FROM SustainableProperties WHERE City = 'Portland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ops_countries (id INT, country VARCHAR(50), operation_type VARCHAR(50)); INSERT INTO ops_countries (id, country, operation_type) VALUES (1, 'USA', 'Surveillance'); INSERT INTO ops_countries (id, country, operation_type) VALUES (2, 'UK', 'Hacking'); INSERT INTO ops_countries (id, country, operation_type) VA... | Identify the number of countries involved in intelligence operations, with at least 3 operations of type 'Surveillance'. | SELECT country, COUNT(*) as operation_count FROM ops_countries WHERE operation_type = 'Surveillance' GROUP BY country HAVING operation_count >= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(255), region VARCHAR(255), production FLOAT); | Show the total production for all wells in the 'North Sea' | SELECT SUM(production) FROM wells WHERE region = 'North Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT, system_name VARCHAR(255), location VARCHAR(255), daily_passengers INT); | What is the average daily ridership of public transportation systems in the 'public_transportation' table, grouped by their 'system_name'? | SELECT system_name, AVG(daily_passengers) FROM public_transportation GROUP BY system_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_visits (id INT, visit_date DATE, rural_ga BOOLEAN); INSERT INTO medical_visits (id, visit_date, rural_ga) VALUES (1, '2023-01-01', true), (2, '2023-01-15', true); | How many medical visits were there in the last month in rural Georgia? | SELECT COUNT(*) FROM medical_visits WHERE rural_ga = true AND visit_date >= DATEADD(month, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts (id INT, name VARCHAR(50), tribe VARCHAR(50), description TEXT); | Add a new traditional art record for 'Dance of the Eagle' in 'Tribe Z' to the 'traditional_arts' table | INSERT INTO traditional_arts (id, name, tribe, description) VALUES (4, 'Dance of the Eagle', 'Tribe Z', 'A sacred dance performed during ceremonial events.'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Excavation_Sites (Site_ID INT, Site_Name TEXT, Country TEXT);CREATE TABLE Artifacts (Artifact_ID INT, Site_ID INT, Artifact_Type TEXT);INSERT INTO Excavation_Sites (Site_ID, Site_Name, Country) VALUES (1, 'Pompeii', 'Italy');INSERT INTO Excavation_Sites (Site_ID, Site_Name, Country) VALUES (2, 'Tutankhamun... | What is the distribution of artifact types across excavation sites? | SELECT E.Site_Name, A.Artifact_Type, COUNT(A.Artifact_ID) FROM Excavation_Sites E JOIN Artifacts A ON E.Site_ID = A.Site_ID GROUP BY E.Site_Name, A.Artifact_Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE bank (id INT, name VARCHAR(50), type VARCHAR(50)); INSERT INTO bank (id, name, type) VALUES (1, 'Green Bank', 'Shariah-compliant'), (2, 'Fair Lending Bank', 'Socially Responsible'); CREATE TABLE loans (bank_id INT, amount DECIMAL(10,2)); INSERT INTO loans (bank_id, amount) VALUES (1, 5000.00), (1, 6000.00)... | What is the total amount of socially responsible loans issued by each bank, ordered by the total amount? | SELECT bank_id, SUM(amount) as total_amount FROM loans GROUP BY bank_id ORDER BY total_amount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (name TEXT, revenue FLOAT); INSERT INTO restaurants (name, revenue) VALUES ('Pizzeria Spumoni', 15000.0), ('Pizzeria Yum', 18000.0); | What is the minimum revenue of any restaurant? | SELECT MIN(revenue) FROM restaurants; | 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.