context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28 values |
|---|---|---|---|
CREATE TABLE vr_technologies (id INT, name VARCHAR(255), release_date DATE); | Add new VR technology records to the 'vr_technologies' table. | INSERT INTO vr_technologies (id, name, release_date) VALUES (1, 'Oculus Rift S', '2019-04-01'), (2, 'HTC Vive Pro 2', '2021-05-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Market (Year INT, GasPrice DECIMAL(5,2), OilPrice DECIMAL(5,2)); | Delete records from 'Market' table where 'Year' is '2018' and 'GasPrice' is less than 3 | DELETE FROM Market WHERE Year = 2018 AND GasPrice < 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_tech (record_id INT, location VARCHAR(20), tech_used VARCHAR(20), date DATE); INSERT INTO legal_tech (record_id, location, tech_used, date) VALUES (1, 'NY', 'AI', '2021-01-01'), (2, 'NY', 'Natural_Language_Processing', '2021-01-02'), (3, 'CA', 'AI', '2021-01-01'), (4, 'CA', 'Natural_Language_Processing', '2021-01-02'), (5, 'CA', 'AI', '2021-01-01'), (6, 'CA', 'Natural_Language_Processing', '2021-01-02'), (7, 'CA', 'AI', '2021-01-01'), (8, 'CA', 'Natural_Language_Processing', '2021-01-02'), (9, 'CA', 'AI', '2021-01-01'), (10, 'CA', 'Natural_Language_Processing', '2021-01-02'), (11, 'IL', 'AI', '2021-01-01'), (12, 'IL', 'Natural_Language_Processing', '2021-01-02'); | What is the total number of unique tech_used values in the legal_tech table, grouped by location? | SELECT location, COUNT(DISTINCT tech_used) FROM legal_tech GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE regulations (regulation_id INT, regulation_name VARCHAR(100), regulator VARCHAR(100), enforcement_date DATE); | Insert a new regulatory record for the 'Australian Securities and Investments Commission' related to digital assets in the blockchain domain. | INSERT INTO regulations (regulation_id, regulation_name, regulator, enforcement_date) VALUES (4, 'Regulation4', 'Australian Securities and Investments Commission', CURDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE GeopoliticalRiskAssessments (assessmentID INT, contractor VARCHAR(255), region VARCHAR(255)); INSERT INTO GeopoliticalRiskAssessments (assessmentID, contractor, region) VALUES (1, 'Lockheed Martin', 'Arctic'); INSERT INTO GeopoliticalRiskAssessments (assessmentID, contractor, region) VALUES (2, 'Raytheon Technologies', 'Arctic'); | Who are the defense contractors involved in the Arctic geopolitical risk assessment? | SELECT DISTINCT contractor FROM GeopoliticalRiskAssessments WHERE region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, community_name TEXT, community_size INT, region TEXT, funding FLOAT); | What is the total amount of funding received by 'community_development' table where the 'region' is 'south_america'? | SELECT SUM(funding) FROM community_development WHERE region = 'south_america'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_prices (id INT, date DATE, price FLOAT); INSERT INTO carbon_prices (id, date, price) VALUES (1, '2022-01-01', 30.0), (2, '2022-01-02', 31.0), (3, '2022-01-03', 29.0); | What is the average carbon price in the European Union Emissions Trading System over the last month? | SELECT AVG(price) FROM carbon_prices WHERE date >= DATEADD(day, -30, CURRENT_DATE) AND region = 'European Union Emissions Trading System'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (id INT, mission_name VARCHAR(50), mission_agency VARCHAR(50), cost INT); INSERT INTO space_missions (id, mission_name, mission_agency, cost) VALUES (1, 'Mission1', 'SpaceX', 1000000), (2, 'Mission2', 'SpaceX', 1500000), (3, 'Mission3', 'NASA', 2000000); | What is the average cost of a space mission for SpaceX? | SELECT AVG(cost) FROM space_missions WHERE mission_agency = 'SpaceX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(20), salary DECIMAL(10, 2)); INSERT INTO employees (id, name, department, salary) VALUES (1, 'John Doe', 'manufacturing', 50000.00), (2, 'Jane Smith', 'engineering', 60000.00), (3, 'Alice Johnson', 'HR', 55000.00); | What is the total number of employees in the 'manufacturing' and 'engineering' departments? | SELECT SUM(salary) FROM employees WHERE department IN ('manufacturing', 'engineering'); | gretelai_synthetic_text_to_sql |
CREATE TABLE bikeshare (station_id INT, city VARCHAR(20), num_bikes INT); INSERT INTO bikeshare (station_id, city, num_bikes) VALUES (1, 'Chicago', 25), (2, 'Chicago', 18), (3, 'Chicago', 30); | Count the number of bike-share stations in the city of Chicago that have more than 20 bikes available. | SELECT COUNT(*) FROM bikeshare WHERE city = 'Chicago' AND num_bikes > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE Daily_Bookings (booking_date DATE, bookings INT); INSERT INTO Daily_Bookings (booking_date, bookings) VALUES ('2022-01-01', 50), ('2022-01-02', 55), ('2022-01-03', 60); | What is the average number of bookings per day for the 'Daily_Bookings' table? | SELECT AVG(bookings) FROM Daily_Bookings; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, region VARCHAR(20), production_rate FLOAT); INSERT INTO wells (well_id, region, production_rate) VALUES (1, 'North Sea', 1000), (2, 'North Sea', 1200), (3, 'Gulf of Mexico', 1500); | What is the minimum production rate (bbl/day) for wells in the 'North Sea'? | SELECT MIN(production_rate) FROM wells WHERE region = 'North Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RouteExtreme (route_id INT, shipment_id INT, distance FLOAT, delivery_date DATE); INSERT INTO RouteExtreme (route_id, shipment_id, distance, delivery_date) VALUES (1, 1, 100, '2022-01-01'), (2, 2, 200, '2022-02-01'), (3, 3, 150, '2022-03-01'); | What is the maximum distance traveled for a single shipment in the freight forwarding data? | SELECT MAX(distance) as max_distance FROM RouteExtreme; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_practices (practice_name VARCHAR(50), description VARCHAR(100)); | Add new record to 'sustainable_practices' table with 'practice_name' as 'Rainwater Harvesting' and 'description' as 'Collecting and storing rainwater for later use' | INSERT INTO sustainable_practices (practice_name, description) VALUES ('Rainwater Harvesting', 'Collecting and storing rainwater for later use'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cardano_stablecoins (stablecoin_type VARCHAR(30), total_supply BIGINT); | What is the total supply of stablecoins in the Cardano network, grouped by stablecoin type? | SELECT stablecoin_type, SUM(total_supply) as total_stablecoin_supply FROM cardano_stablecoins GROUP BY stablecoin_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (post_id INT, user_id INT, followers INT, likes INT, post_date DATE); CREATE TABLE users (user_id INT, country TEXT); | What is the total number of likes on posts about clean energy, published by users in Australia, in the month of March 2022? | SELECT SUM(likes) FROM posts p JOIN users u ON p.user_id = u.user_id WHERE p.content LIKE '%clean energy%' AND u.country = 'Australia' AND p.post_date >= '2022-03-01' AND p.post_date < '2022-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(50), location VARCHAR(50), avg_depth FLOAT); INSERT INTO marine_protected_areas (id, name, location, avg_depth) VALUES (1, 'MPA1', 'Pacific Ocean', 3500), (2, 'MPA2', 'Atlantic Ocean', 4200), (3, 'MPA3', 'Atlantic Ocean', 2700); | Delete the record of the marine protected area 'MPA3' in the Atlantic Ocean from the marine_protected_areas table. | DELETE FROM marine_protected_areas WHERE name = 'MPA3' AND location = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (event_id INT, event_name VARCHAR(255), event_date DATE, participating_countries VARCHAR(255)); | List all defense diplomacy events in the 'defense_diplomacy' table, ordered by the 'event_date' column in descending order | SELECT * FROM defense_diplomacy ORDER BY event_date DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, program VARCHAR(255), graduation_year INT, grant_recipient BOOLEAN); INSERT INTO students (id, program, graduation_year, grant_recipient) VALUES (1, 'Computer Science', 2020, TRUE), (2, 'Computer Science', 2019, FALSE), (3, 'Mathematics', 2018, TRUE), (4, 'Computer Science', 2021, TRUE); | What is the average time to graduation for students in the Computer Science program who received research grants? | SELECT AVG(graduation_year - enrollment_year) as avg_time_to_graduation FROM (SELECT s.id, s.program, s.graduation_year, (SELECT MIN(enrollment_year) FROM enrollments WHERE student_id = s.id) as enrollment_year FROM students s WHERE s.grant_recipient = TRUE) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE us_readers (id INT, age INT, state VARCHAR(255), news_preference VARCHAR(255)); INSERT INTO us_readers (id, age, state, news_preference) VALUES (1, 35, 'NY', 'politics'), (2, 45, 'CA', 'sports'); | What is the average age of readers who prefer politics news, grouped by their state in the USA? | SELECT r.state, AVG(r.age) FROM us_readers r WHERE r.news_preference = 'politics' GROUP BY r.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(50), Identity VARCHAR(50)); | What is the total number of employees who identify as LGBTQ+, by department? | SELECT e.Department, COUNT(DISTINCT e.EmployeeID) FROM Employees e WHERE e.Identity = 'LGBTQ+' GROUP BY e.Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions(id INT, country VARCHAR(255), mission VARCHAR(255), year INT, success BOOLEAN); INSERT INTO SpaceMissions(id, country, mission, year, success) VALUES (1, 'China', 'Mission 1', 2021, true), (2, 'USA', 'Mission 2', 2022, false), (3, 'China', 'Mission 3', 2022, true), (4, 'Russia', 'Mission 4', 2021, true); | How many space missions were carried out by China in 2022? | SELECT COUNT(*) FROM SpaceMissions WHERE country = 'China' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS hotels (id INT PRIMARY KEY, name TEXT, country TEXT, is_eco_friendly BOOLEAN, rating FLOAT); INSERT INTO hotels (id, name, country, is_eco_friendly, rating) VALUES (1, 'Eco-Retreat', 'Australia', true, 4.6), (2, 'GreenHotel', 'Australia', true, 4.3), (3, 'ResortAus', 'Australia', false, 4.9); | What is the average hotel rating for eco-friendly accommodations in Australia? | SELECT AVG(rating) FROM hotels WHERE is_eco_friendly = true AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Revenues (revenue_id INT, event_id INT, amount DECIMAL(10,2), revenue_date DATE); INSERT INTO Revenues (revenue_id, event_id, amount, revenue_date) VALUES (1, 6, 800.00, '2022-01-05'), (2, 7, 1200.00, '2022-03-20'); | What was the total revenue generated from 'Poetry Slam' and 'Film Screening' events in Q1 2022? | SELECT SUM(amount) FROM Revenues WHERE event_id IN (6, 7) AND QUARTER(revenue_date) = 1 AND YEAR(revenue_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA labor_rights; CREATE TABLE employees (id INT, name VARCHAR, union_member BOOLEAN); INSERT INTO employees VALUES (1, 'Jane Smith', TRUE); CREATE TABLE unions (id INT, name VARCHAR); INSERT INTO unions VALUES (1, 'Union X'); | What is the percentage of employees in the 'labor_rights' schema who are members of a union? | SELECT 100.0 * AVG(CASE WHEN union_member THEN 1 ELSE 0 END) AS union_membership_percentage FROM labor_rights.employees; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_emissions (company_name VARCHAR(255), year INT, carbon_emissions INT); INSERT INTO company_emissions (company_name, year, carbon_emissions) VALUES ('Company A', 2019, 5000), ('Company B', 2019, 6000), ('Company C', 2019, 7000), ('Company D', 2019, 8000), ('Company E', 2019, 9000), ('Company F', 2019, 10000); | Identify the top 3 REE mining companies with the highest carbon emissions in 2019. | SELECT company_name, carbon_emissions FROM company_emissions WHERE year = 2019 AND company_name IN (SELECT company_name FROM company_emissions WHERE year = 2019 GROUP BY company_name ORDER BY SUM(carbon_emissions) DESC LIMIT 3) ORDER BY carbon_emissions DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_types (crop_type TEXT, farm_name TEXT); INSERT INTO crop_types (crop_type, farm_name) VALUES ('Corn', 'Farm A'), ('Soybeans', 'Farm A'), ('Cotton', 'Farm B'); | Count the number of crop types per farm | SELECT farm_name, COUNT(crop_type) FROM crop_types GROUP BY farm_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE MuseumX (artwork VARCHAR(50), artist VARCHAR(50)); INSERT INTO MuseumX (artwork, artist) VALUES ('The Persistence of Memory', 'Dali'), ('The Scream', 'Munch'); | How many artworks are there in 'Museum X'? | SELECT COUNT(artwork) FROM MuseumX; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, donor_name TEXT, donation_amount FLOAT, donation_date DATE, state TEXT); INSERT INTO Donations (id, donor_name, donation_amount, donation_date, state) VALUES (1, 'Aria', 500, '2022-01-01', 'NY'), (2, 'Benjamin', 1000, '2022-02-02', 'CA'); | What is the total donation amount and the number of donations made by top 5 donors? | SELECT donor_name, SUM(donation_amount), COUNT(*) FROM Donations GROUP BY donor_name ORDER BY SUM(donation_amount) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Research_Vessels (id INT, vessel_name VARCHAR(50), type VARCHAR(50), year INT); INSERT INTO Research_Vessels (id, vessel_name, type, year) VALUES (1, 'Discovery', 'research', 1985); | List research vessels that are older than 25 years and their types | SELECT vessel_name, type FROM Research_Vessels WHERE year < 1997; | gretelai_synthetic_text_to_sql |
CREATE TABLE WildlifeHabitats (id INT, name VARCHAR(255), region VARCHAR(255), description TEXT, area FLOAT); INSERT INTO WildlifeHabitats (id, name, region, description, area) VALUES (1, 'Yasuni National Park', 'Amazon Rainforest', 'Home to many endangered species...', 98200); | How many wildlife habitats are present in the Amazon rainforest? | SELECT COUNT(*) FROM WildlifeHabitats WHERE region = 'Amazon Rainforest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, artist_name VARCHAR(255), birthdate DATE); INSERT INTO Artists (id, artist_name, birthdate) VALUES (1, 'Yayoi Kusama', 'March 22, 1930'); | Update the birthdate of 'Yayoi Kusama' to 'March 22, 1929' | UPDATE Artists SET birthdate = 'March 22, 1929' WHERE artist_name = 'Yayoi Kusama'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityH_Vehicles (vehicle_id INT, vehicle_type VARCHAR(20), is_electric BOOLEAN); INSERT INTO CityH_Vehicles (vehicle_id, vehicle_type, is_electric) VALUES (1, 'Car', true), (2, 'Bike', false), (3, 'Car', true), (4, 'Bus', false); | How many electric cars are there in CityH? | SELECT COUNT(*) FROM CityH_Vehicles WHERE vehicle_type = 'Car' AND is_electric = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor_depths (location TEXT, depth FLOAT); INSERT INTO ocean_floor_depths (location, depth) VALUES ('Arctic', 4000.0), ('Atlantic Ocean', 8000.0), ('Pacific Ocean', 11000.0); | What is the minimum depth of the ocean floor in the Arctic? | SELECT MIN(depth) FROM ocean_floor_depths WHERE location = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, treatment_type VARCHAR(10)); INSERT INTO patients (patient_id, age, treatment_type) VALUES (1, 30, 'medication'), (2, 45, 'therapy'), (3, 50, 'medication'), (4, 25, 'therapy'); | What is the average age of patients who received medication-based treatment? | SELECT AVG(age) FROM patients WHERE treatment_type = 'medication'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Age INT, Genre VARCHAR(50)); INSERT INTO Artists VALUES (1, 'Artist1', 35, 'Rock'); INSERT INTO Artists VALUES (2, 'Artist2', 45, 'Rock'); CREATE TABLE Festivals (FestivalID INT, FestivalName VARCHAR(100), ArtistID INT); INSERT INTO Festivals VALUES (1, 'Festival1', 1); INSERT INTO Festivals VALUES (2, 'Festival2', 2); INSERT INTO Festivals VALUES (3, 'Festival3', 1); | Which artists have performed at more than one music festival? | SELECT A.ArtistName FROM Artists A INNER JOIN Festivals F ON A.ArtistID = F.ArtistID GROUP BY A.ArtistID HAVING COUNT(DISTINCT F.FestivalID) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_performance (vessel_id INT, speed FLOAT, timestamp TIMESTAMP); | Calculate the average speed of vessels in the 'vessel_performance' table | SELECT AVG(speed) FROM vessel_performance; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, RestaurantName varchar(255), Cuisine varchar(255)); CREATE TABLE MenuItems (MenuID int, MenuName varchar(255), RestaurantID int, Sales int); CREATE TABLE AdditionalCharges (ChargeID int, ChargeName varchar(255), RestaurantID int, ChargeAmt int); | What is the total revenue for each cuisine type, including the sum of sales for all menu items and additional charges? | SELECT R.Cuisine, SUM(M.Sales + AC.ChargeAmt) as TotalRevenue FROM Restaurants R INNER JOIN MenuItems M ON R.RestaurantID = M.RestaurantID INNER JOIN AdditionalCharges AC ON R.RestaurantID = AC.RestaurantID GROUP BY R.Cuisine; | gretelai_synthetic_text_to_sql |
CREATE TABLE NYT_Investigative(id INT, name VARCHAR(20), age INT, job VARCHAR(20));CREATE TABLE LAT_Investigative(id INT, name VARCHAR(20), age INT, job VARCHAR(20)); | What are the ages of investigative journalists in 'New York Times' and 'Los Angeles Times'? | SELECT ny.age FROM NYT_Investigative ny JOIN LAT_Investigative lat ON ny.name = lat.name WHERE ny.job = 'investigative journalist' AND lat.job = 'investigative journalist'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_tours (tour_id INT, name TEXT, city TEXT, country TEXT); INSERT INTO cultural_tours (tour_id, name, city, country) VALUES (1, 'Roman Colosseum Tour', 'Rome', 'Italy'), (2, 'Uffizi Gallery Tour', 'Florence', 'Italy'), (3, 'Pompeii Tour', 'Naples', 'Italy'); | Find the top 3 cities with the highest number of cultural heritage tours in Italy. | SELECT city, COUNT(*) as tour_count FROM cultural_tours WHERE country = 'Italy' GROUP BY city ORDER BY tour_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_packages (package_id INT, type TEXT, region TEXT); INSERT INTO tourism_packages (package_id, type, region) VALUES (1, 'Sustainable', 'Africa'), (2, 'Standard', 'Europe'); | How many sustainable tourism packages are available in Africa? | SELECT region, COUNT(*) FROM tourism_packages WHERE type = 'Sustainable' AND region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(255), gender VARCHAR(10), enrollment_date DATE); INSERT INTO graduate_students (id, name, gender, enrollment_date) VALUES (1, 'Ivan', 'Male', '2019-08-24'), (2, 'Judy', 'Female', '2020-08-25'), (3, 'Kevin', 'Male', '2021-08-26'), (4, 'Lily', 'Female', '2021-08-27'); | How many graduate students have enrolled each year, broken down by year? | SELECT YEAR(enrollment_date) as year, COUNT(*) as enrollment_count FROM graduate_students GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sectors (id INT, sector VARCHAR(255)); INSERT INTO Sectors (id, sector) VALUES (1, 'Energy'), (2, 'Manufacturing'), (3, 'Agriculture'); CREATE TABLE Initiatives (id INT, name VARCHAR(255), sector_id INT); INSERT INTO Initiatives (id, name, sector_id) VALUES (1, 'ProjectA', 1), (2, 'ProjectB', 2), (3, 'ProjectC', 3), (4, 'ProjectD', 3); | List all circular economy initiatives in the 'Agriculture' sector. | SELECT Initiatives.name FROM Initiatives JOIN Sectors ON Initiatives.sector_id = Sectors.id WHERE Sectors.sector = 'Agriculture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (Location VARCHAR(100), Date DATE, Depth INT, Speed FLOAT); INSERT INTO WeatherData (Location, Date, Depth, Speed) VALUES ('Location C', '2022-06-01', 20, 15.5); INSERT INTO WeatherData (Location, Date, Depth, Speed) VALUES ('Location D', '2022-06-05', 25, 16.5); | What is the maximum snow depth and minimum wind speed recorded for each location in the past month? | SELECT Location, MAX(Depth) OVER (PARTITION BY Location ORDER BY Location ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MaxDepth, MIN(Speed) OVER (PARTITION BY Location ORDER BY Location ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MinSpeed FROM WeatherData WHERE Date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Firm VARCHAR(255)); INSERT INTO Attorneys (AttorneyID, Firm) VALUES (1, 'Doe Law Firm'), (2, 'Smith Law Firm'), (3, 'Doe Law Firm'); CREATE TABLE Cases (CaseID INT, AttorneyID INT, Outcome VARCHAR(255)); INSERT INTO Cases (CaseID, AttorneyID, Outcome) VALUES (101, 1, 'Won'), (102, 1, 'Lost'), (103, 2, 'Won'), (104, 3, 'Won'); | How many cases were won by attorneys from the 'Doe' law firm? | SELECT COUNT(*) FROM Cases INNER JOIN Attorneys ON Cases.AttorneyID = Attorneys.AttorneyID WHERE Attorneys.Firm = 'Doe Law Firm' AND Outcome = 'Won'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityPerformances (City VARCHAR(20), ArtPerformances INT); INSERT INTO CityPerformances VALUES ('New York', 3), ('Los Angeles', 2); CREATE VIEW ArtPerformanceCount AS SELECT City, COUNT(*) AS ArtPerformances FROM CityPerformances GROUP BY City; | What's the number of traditional art performances per city? | SELECT v.City, v.ArtPerformances FROM CityPerformances c JOIN ArtPerformanceCount v ON c.City = v.City; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (id INT, region VARCHAR(255), temperature INT, timestamp TIMESTAMP); INSERT INTO weather_data (id, region, temperature, timestamp) VALUES (1, 'North America', 25, '2022-01-01 10:00:00'), (2, 'South America', 30, '2022-01-01 10:00:00'); | What is the maximum temperature recorded for each region in the past week? | SELECT region, MAX(temperature) FROM weather_data WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 WEEK) GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE buses (route_id INT, fare DECIMAL(5,2), city VARCHAR(20)); CREATE TABLE routes (route_id INT, city VARCHAR(20)); | What is the maximum fare for buses in each city? | SELECT r.city, MAX(b.fare) FROM buses b JOIN routes r ON b.route_id = r.route_id GROUP BY r.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Directors (id INT, director_name VARCHAR(100), ethnicity VARCHAR(50)); CREATE TABLE Movies (id INT, title VARCHAR(100), director_id INT, release_year INT); INSERT INTO Directors (id, director_name, ethnicity) VALUES (1, 'Director1', 'Latinx'), (2, 'Director2', 'African American'), (3, 'Director3', 'Caucasian'); INSERT INTO Movies (id, title, director_id, release_year) VALUES (1, 'Movie1', 1, 2011), (2, 'Movie2', 1, 2013), (3, 'Movie3', 2, 2015), (4, 'Movie4', 3, 2017); | How many movies were directed by individuals who identify as Latinx and released after 2010? | SELECT COUNT(*) FROM Movies WHERE director_id IN (SELECT id FROM Directors WHERE ethnicity = 'Latinx') AND release_year > 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE AstrophysicsResearch (id INT, spacecraft VARCHAR(255), altitude FLOAT); INSERT INTO AstrophysicsResearch (id, spacecraft, altitude) VALUES (1, 'Hubble Space Telescope', 569000000.0), (2, 'Spitzer Space Telescope', 548000000.0); | What is the maximum altitude reached by the 'Hubble Space Telescope'? | SELECT MAX(altitude) FROM AstrophysicsResearch WHERE spacecraft = 'Hubble Space Telescope'; | gretelai_synthetic_text_to_sql |
CREATE TABLE africa_sales(manufacturer VARCHAR(50), location VARCHAR(20), quantity INT, sale_date DATE); INSERT INTO africa_sales (manufacturer, location, quantity, sale_date) VALUES ('EcoStitch', 'Africa', 150, '2022-07-01'); INSERT INTO africa_sales (manufacturer, location, quantity, sale_date) VALUES ('GreenThreads', 'Africa', 120, '2022-07-02'); | Who is the top garment manufacturer by quantity sold in 'Africa' in Q3 2022? | SELECT manufacturer, SUM(quantity) as total_quantity FROM africa_sales WHERE location = 'Africa' AND sale_date BETWEEN '2022-07-01' AND '2022-09-30' GROUP BY manufacturer ORDER BY total_quantity DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10,2), LeftCompany BOOLEAN); | Delete records of employees who left the company | DELETE FROM Employees WHERE LeftCompany = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_awareness_campaigns (id INT PRIMARY KEY, name VARCHAR(255), description TEXT, start_date DATE, end_date DATE); | Create a table for public awareness campaigns | CREATE TABLE public_awareness_campaigns (id INT PRIMARY KEY, name VARCHAR(255), description TEXT, start_date DATE, end_date DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE lolgames (game_id INT, champion VARCHAR(50), winner BOOLEAN); INSERT INTO lolgames (game_id, champion, winner) VALUES (1, 'Ashe', true); | Identify the win rate of players based on the champion they use in LoL | SELECT champion, AVG(winner) as win_rate, RANK() OVER (ORDER BY AVG(winner) DESC) as rank FROM lolgames GROUP BY champion | gretelai_synthetic_text_to_sql |
CREATE TABLE network (network_id INT, country VARCHAR(255), latency INT); INSERT INTO network (network_id, country, latency) VALUES (1, 'US', 30), (2, 'Canada', 40), (3, 'Mexico', 50), (4, 'Brazil', 60); | What is the average network latency for each country? | SELECT country, AVG(latency) as avg_latency FROM network GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtPieces (id INT, title VARCHAR(50), galleryId INT, year INT, style VARCHAR(20)); INSERT INTO ArtPieces (id, title, galleryId, year, style) VALUES (1, 'Piece 1', 1, 2000, 'Modern'), (2, 'Piece 2', 1, 2010, 'Contemporary'), (3, 'Piece 3', 2, 2020, 'Contemporary'), (4, 'Piece 4', 3, 1990, 'Modern'), (5, 'Piece 5', NULL, 1874, 'Impressionism'); | What is the oldest contemporary art piece? | SELECT title, year FROM ArtPieces WHERE style = 'Contemporary' AND year = (SELECT MIN(year) FROM ArtPieces WHERE style = 'Contemporary') LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_hospitals( hospital_id INT PRIMARY KEY, name VARCHAR(255), bed_count INT, rural_urban_classification VARCHAR(50)) | List all hospitals in rural areas | SELECT * FROM rural_hospitals WHERE rural_urban_classification = 'Rural' | gretelai_synthetic_text_to_sql |
CREATE TABLE olympic_athletes (athlete_id INT, name VARCHAR(50), sport VARCHAR(20), country VARCHAR(50), gold_medals INT); INSERT INTO olympic_athletes (athlete_id, name, sport, country, gold_medals) VALUES (1, 'Usain Bolt', 'Track and Field', 'Jamaica', 8); INSERT INTO olympic_athletes (athlete_id, name, sport, country, gold_medals) VALUES (2, 'Michael Phelps', 'Swimming', 'USA', 23); | List the total number of gold medals won by athletes from the United States in the olympic_athletes table. | SELECT SUM(gold_medals) FROM olympic_athletes WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, name TEXT, program TEXT, hours_volunteered INT); | What is the number of volunteers and total hours volunteered for each program? | SELECT program, COUNT(*), SUM(hours_volunteered) FROM volunteers GROUP BY program; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Age INT, MembershipType VARCHAR(10)); INSERT INTO Members (MemberID, Age, MembershipType) VALUES (1, 35, 'Premium'), (2, 28, 'Basic'), (3, 42, 'Premium'), (4, 22, 'Basic'), (5, 55, 'Premium'); | What is the maximum age of members who have a 'Basic' membership? | SELECT MAX(Age) FROM Members WHERE MembershipType = 'Basic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), job_title VARCHAR(50), hire_date DATE); INSERT INTO mining_operations (id, name, job_title, hire_date) VALUES (1, 'John Doe', 'Miner', '2011-01-01'); INSERT INTO mining_operations (id, name, job_title, hire_date) VALUES (2, 'Jane Smith', 'Engineer', '2015-05-15'); | What is the total number of employees in the 'mining_operations' table, grouped by their job titles, who were hired after 2010? | SELECT job_title, COUNT(*) FROM mining_operations WHERE hire_date >= '2010-01-01' GROUP BY job_title; | gretelai_synthetic_text_to_sql |
CREATE TABLE lending_trend (application_date DATE, approved BOOLEAN); INSERT INTO lending_trend (application_date, approved) VALUES ('2021-04-02', FALSE), ('2021-05-15', TRUE), ('2021-06-01', FALSE), ('2021-07-01', TRUE), ('2021-08-15', FALSE), ('2021-09-01', TRUE), ('2021-10-15', FALSE), ('2021-11-01', TRUE), ('2021-12-15', FALSE); | Show the trend of approved and rejected socially responsible lending applications in the last 6 months. | SELECT MONTH(application_date) as month, YEAR(application_date) as year, SUM(approved) as num_approved, SUM(NOT approved) as num_rejected FROM lending_trend WHERE application_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) GROUP BY YEAR(application_date), MONTH(application_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_components (id INT, company VARCHAR(255), country VARCHAR(255), component_type VARCHAR(255), weight FLOAT); INSERT INTO spacecraft_components (id, company, country, component_type, weight) VALUES (1, 'SpaceTech', 'France', 'Propulsion System', 500.0), (2, 'SpaceTech', 'France', 'Structure', 3000.0); | What is the average weight of spacecraft components manufactured by SpaceTech in France? | SELECT AVG(weight) FROM spacecraft_components WHERE company = 'SpaceTech' AND country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (location VARCHAR(50), current_capacity INT, projected_capacity INT, year INT); INSERT INTO landfill_capacity (location, current_capacity, projected_capacity, year) VALUES ('Texas', 50000, 60000, 2030); | What is the current landfill capacity in Texas and the projected capacity in 2030? | SELECT location, current_capacity, projected_capacity FROM landfill_capacity WHERE location = 'Texas' AND year = 2030; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (EvaluationID INT, State VARCHAR(255), EvaluationDate DATE); INSERT INTO HealthEquityMetrics (EvaluationID, State, EvaluationDate) VALUES (1, 'California', '2022-01-10'), (2, 'Texas', '2022-03-15'), (3, 'New York', '2022-05-05'), (4, 'Florida', '2022-07-01'), (5, 'Illinois', '2022-09-12'); | How many health equity metric evaluations were conducted in each state over the past six months? | SELECT State, COUNT(*) as EvaluationCount FROM HealthEquityMetrics WHERE EvaluationDate >= DATEADD(month, -6, GETDATE()) GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather (location VARCHAR(50), temperature INT, record_date DATE); INSERT INTO weather VALUES ('Seattle', 45, '2022-01-01'); INSERT INTO weather VALUES ('Seattle', 50, '2022-02-01'); INSERT INTO weather VALUES ('Seattle', 55, '2022-03-01'); INSERT INTO weather VALUES ('New York', 30, '2022-01-01'); INSERT INTO weather VALUES ('New York', 35, '2022-02-01'); INSERT INTO weather VALUES ('New York', 40, '2022-03-01'); | What is the average temperature per month and location in 'weather' table? | SELECT location, EXTRACT(MONTH FROM record_date) AS month, AVG(temperature) AS avg_temp FROM weather GROUP BY location, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dishes (DishID INT, DishName VARCHAR(50), Cuisine VARCHAR(50), Calories INT); INSERT INTO Dishes (DishID, DishName, Cuisine, Calories) VALUES (1, 'Hummus', 'Mediterranean', 250), (2, 'Falafel', 'Mediterranean', 350), (3, 'Pizza', 'Italian', 800), (4, 'Pasta', 'Italian', 700), (5, 'Burger', 'American', 600), (6, 'Fries', 'American', 400); | List the top 3 cuisines with the highest average calorie content? | SELECT Cuisine, AVG(Calories) FROM Dishes GROUP BY Cuisine ORDER BY AVG(Calories) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE StreamingData (StreamID INT, UserID INT, SongID INT, StreamDate DATE, Revenue DECIMAL(10,2)); INSERT INTO StreamingData VALUES (1, 1, 1001, '2022-01-01', 0.10); INSERT INTO StreamingData VALUES (2, 2, 1002, '2022-01-02', 0.15); CREATE TABLE Songs (SongID INT, SongName VARCHAR(100), ArtistID INT); INSERT INTO Songs VALUES (1001, 'Shake It Off', 1); INSERT INTO Songs VALUES (1002, 'Dynamite', 1); | What is the total revenue generated from music streaming for a specific artist? | SELECT SUM(Revenue) FROM StreamingData JOIN Songs ON StreamingData.SongID = Songs.SongID WHERE Songs.ArtistID = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_status (id INT, species_name VARCHAR(255), conservation_status VARCHAR(255)); INSERT INTO marine_species_status (id, species_name, conservation_status) VALUES (1, 'Blue Whale', 'Endangered'); CREATE TABLE oceanography (id INT, species_name VARCHAR(255), location VARCHAR(255)); INSERT INTO oceanography (id, species_name, location) VALUES (1, 'Blue Whale', 'Southern Ocean'); | What are the conservation statuses of marine species that are unique to the Southern Ocean? | SELECT conservation_status FROM marine_species_status WHERE species_name NOT IN (SELECT species_name FROM oceanography WHERE location IN ('Atlantic Ocean', 'Pacific Ocean', 'Indian Ocean', 'Arctic Ocean')) AND species_name IN (SELECT species_name FROM oceanography WHERE location = 'Southern Ocean'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Dishes (DishID INT, DishName VARCHAR(50), Type VARCHAR(20), Calories INT); INSERT INTO Dishes (DishID, DishName, Type, Calories) VALUES (1, 'Beef Lasagna', 'Meat-dairy', 800), (2, 'Cheese Pizza', 'Dairy', 600), (3, 'Chicken Caesar Salad', 'Meat-dairy', 500), (4, 'Veggie Pizza', 'Dairy', 700); | What is the total calorie count for dishes that contain both meat and dairy products? | SELECT SUM(Calories) FROM Dishes WHERE Type = 'Meat-dairy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, FirstName TEXT, LastName TEXT, Country TEXT); INSERT INTO Volunteers (VolunteerID, FirstName, LastName, Country) VALUES (1, 'Alice', 'Williams', 'USA'), (2, 'Bob', 'Jones', 'USA'), (3, 'Charlie', 'Brown', 'USA'); CREATE TABLE VolunteerPrograms (VolunteerID INT, ProgramID INT, Location TEXT); INSERT INTO VolunteerPrograms (VolunteerID, ProgramID, Location) VALUES (1, 101, 'NY'), (1, 102, 'CA'), (2, 101, 'NY'), (3, 102, 'CA'); | List all volunteers who have participated in programs in both New York and California, along with their contact information. | SELECT V.FirstName, V.LastName, V.Country FROM Volunteers V INNER JOIN VolunteerPrograms VP1 ON V.VolunteerID = VP1.VolunteerID AND VP1.Location = 'NY' INNER JOIN VolunteerPrograms VP2 ON V.VolunteerID = VP2.VolunteerID AND VP2.Location = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (innovation_id INT, country1 TEXT, country2 TEXT, project TEXT, start_date DATE, end_date DATE); INSERT INTO military_innovation (innovation_id, country1, country2, project, start_date, end_date) VALUES (1, 'USA', 'UK', 'Stealth Coating', '2010-01-01', '2012-12-31'), (2, 'USA', 'Germany', 'AI-Driven Drones', '2015-01-01', '2017-12-31'); | Which countries have participated in more than 5 military innovation projects with the USA since 2010? | SELECT military_innovation.country2, COUNT(military_innovation.innovation_id) as project_count FROM military_innovation WHERE military_innovation.country1 = 'USA' AND military_innovation.start_date >= '2010-01-01' GROUP BY military_innovation.country2 HAVING project_count > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE training (id INT, employee_id INT, course_name VARCHAR(50), completed_date DATE); | Insert a new training record into the "training" table | INSERT INTO training (id, employee_id, course_name, completed_date) VALUES (1001, 101, 'Python Programming', '2022-07-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE flights (flight_id INT, airline TEXT, origin TEXT, destination TEXT, distance INT, co2_emission INT); INSERT INTO flights (flight_id, airline, origin, destination, distance, co2_emission) VALUES (1, 'Delta', 'USA', 'China', 12000, 900), (2, 'Air China', 'China', 'USA', 12000, 900); | What is the average carbon footprint of flights from the USA to Asia? | SELECT AVG(co2_emission) FROM flights WHERE origin = 'USA' AND destination LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, content TEXT, timestamp TIMESTAMP, comments INT); | What is the average number of comments per post in the 'social_media' database? | SELECT AVG(COUNT(posts.comments)) AS avg_comments_per_post FROM posts GROUP BY posts.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_tourism (country VARCHAR(20), year INT, num_businesses INT); INSERT INTO sustainable_tourism (country, year, num_businesses) VALUES ('New Zealand', 2020, 3500), ('Australia', 2020, 5000); | Find the number of sustainable tourism businesses in New Zealand in 2020. | SELECT num_businesses FROM sustainable_tourism WHERE country = 'New Zealand' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, sector VARCHAR(255), severity VARCHAR(255)); INSERT INTO vulnerabilities (id, sector, severity) VALUES (1, 'financial', 'high'), (2, 'healthcare', 'medium'), (3, 'financial', 'low'); | What is the total number of high severity vulnerabilities reported in the financial sector? | SELECT COUNT(*) FROM vulnerabilities WHERE sector = 'financial' AND severity = 'high'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProjectCosts (id INT, project VARCHAR(100), company VARCHAR(100), cost FLOAT); INSERT INTO ProjectCosts (id, project, company, cost) VALUES (1, 'Starship', 'SpaceX', 10000000); INSERT INTO ProjectCosts (id, project, company, cost) VALUES (2, 'Raptor Engine', 'SpaceX', 2000000); | What is the total cost of SpaceX's Starship program? | SELECT SUM(cost) FROM ProjectCosts WHERE project = 'Starship' AND company = 'SpaceX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE attractions (id INT, name TEXT, country TEXT, sustainable BOOLEAN); | Insert a new sustainable attraction in Canada into the attractions table. | INSERT INTO attractions (name, country, sustainable) VALUES ('Niagara Falls Eco-Park', 'Canada', 'true'); | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganicCottonClothing (id INT, production_cost DECIMAL(5,2)); INSERT INTO OrganicCottonClothing VALUES (1, 25.50), (2, 30.00), (3, 28.75); | What is the average production cost of clothing items made with organic cotton? | SELECT AVG(production_cost) FROM OrganicCottonClothing; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name VARCHAR(100), gender VARCHAR(10), training_completed INT, country VARCHAR(50)); INSERT INTO farmers (id, name, gender, training_completed, country) VALUES (1, 'Abena', 'female', 1, 'Ghana'); | What is the total number of female farmers who have received training in Ghana? | SELECT SUM(training_completed) FROM farmers WHERE gender = 'female' AND country = 'Ghana'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teams (TeamID INT, TeamName VARCHAR(50), Stadium VARCHAR(50)); INSERT INTO Teams (TeamID, TeamName, Stadium) VALUES (1, 'TeamA', 'StadiumA'), (2, 'TeamB', 'StadiumB'); CREATE TABLE Games (GameID INT, TeamID INT, TicketPrice DECIMAL(5,2)); INSERT INTO Games (GameID, TeamID, TicketPrice) VALUES (1, 1, 50.00), (2, 1, 55.00), (3, 2, 45.00), (4, 2, 50.00); | What is the average ticket price for each team's home games, ordered by the highest average price? | SELECT TeamID, AVG(TicketPrice) as AvgTicketPrice FROM Games GROUP BY TeamID ORDER BY AvgTicketPrice DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT PRIMARY KEY, name VARCHAR(50), location VARCHAR(50), budget FLOAT); INSERT INTO projects (id, name, location, budget) VALUES (1, 'Solar Farm Construction', 'Brazil', 900000.00); INSERT INTO projects (id, name, location, budget) VALUES (2, 'Wind Turbine Installation', 'Canada', 750000.00); INSERT INTO projects (id, name, location, budget) VALUES (3, 'Hydroelectric Dam Construction', 'China', 1500000.00); | What are the names and budgets of projects in 'Asia' with a budget greater than 1000000.00? | SELECT projects.name, projects.location, projects.budget FROM projects WHERE projects.location = 'Asia' AND projects.budget > 1000000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (mission_name VARCHAR(255), astronaut_id INT); CREATE TABLE AstronautMedicalData (astronaut_id INT, last_checkup DATE, country VARCHAR(255)); INSERT INTO SpaceMissions (mission_name, astronaut_id) VALUES ('Artemis I', 1001), ('Artemis I', 1002), ('Shenzhou 9', 2001); INSERT INTO AstronautMedicalData (astronaut_id, last_checkup, country) VALUES (1001, '2022-01-01', 'US'), (1002, '2022-02-01', 'US'), (2001, '2022-03-01', 'China'); | List all space missions that include astronauts from the US and China with their medical records' last_checkup date. | SELECT SpaceMissions.mission_name, AstronautMedicalData.last_checkup FROM SpaceMissions INNER JOIN AstronautMedicalData ON SpaceMissions.astronaut_id = AstronautMedicalData.astronaut_id WHERE AstronautMedicalData.country = 'US' OR AstronautMedicalData.country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WorkingHoursData (EmployeeID INT, Gender VARCHAR(10), WeeklyHours DECIMAL(10, 2)); INSERT INTO WorkingHoursData (EmployeeID, Gender, WeeklyHours) VALUES (1, 'Female', 40.00), (2, 'Male', 45.00), (3, 'Female', 50.00); | What is the maximum weekly working hours for female workers? | SELECT MAX(WeeklyHours) FROM WorkingHoursData WHERE Gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (SiteID int, SiteName varchar(255), SiteLocation varchar(255), CultureDomain varchar(255)); INSERT INTO HeritageSites (SiteID, SiteName, SiteLocation, CultureDomain) VALUES (1, 'Mesa Verde National Park', 'Colorado, USA', 'Native American'); | What is the name and location of the top 3 heritage sites with the highest number of visitors in the Native American culture domain? | SELECT SiteName, SiteLocation FROM HeritageSites WHERE CultureDomain = 'Native American' ORDER BY COUNT(*) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE TEAMS (team_name VARCHAR(50), division VARCHAR(50)); INSERT INTO TEAMS (team_name, division) VALUES ('Golden State Warriors', 'Pacific'); CREATE TABLE games (team_name VARCHAR(50), sale_year INT, num_tickets_sold INT, is_home_game BOOLEAN); INSERT INTO games (team_name, sale_year, num_tickets_sold, is_home_game) VALUES ('Golden State Warriors', 2020, 20000, TRUE); | Find the average number of tickets sold and total number of home games played by the 'Golden State Warriors' in the 'Pacific' division for the year 2020. Assume the 'games' table has columns 'team_name', 'sale_year', 'num_tickets_sold', 'is_home_game'. | SELECT AVG(num_tickets_sold), COUNT(*) FROM games WHERE team_name = 'Golden State Warriors' AND sale_year = 2020 AND is_home_game = TRUE AND division = (SELECT division FROM TEAMS WHERE team_name = 'Golden State Warriors'); | gretelai_synthetic_text_to_sql |
CREATE TABLE FABRICS(city VARCHAR(20), fabric VARCHAR(20)); INSERT INTO FABRICS(city, fabric) VALUES('Paris', 'Organic Cotton'), ('Paris', 'Tencel'), ('Paris', 'Hemp'), ('Rome', 'Polyester'), ('Rome', 'Viscose'); | How many different types of sustainable fabrics are used in Paris? | SELECT COUNT(DISTINCT fabric) FROM FABRICS WHERE city = 'Paris'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, ocean TEXT, affected_by_safety_issues BOOLEAN); INSERT INTO marine_species (id, name, ocean, affected_by_safety_issues) VALUES (1, 'Krill', 'Southern', TRUE), (2, 'Blue Whale', 'Atlantic', FALSE), (3, 'Penguin', 'Southern', TRUE), (4, 'Squid', 'Atlantic', TRUE); | What is the total number of marine species in the Atlantic Ocean that are affected by maritime safety issues? | SELECT COUNT(*) FROM marine_species WHERE ocean = 'Atlantic' AND affected_by_safety_issues = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT PRIMARY KEY, name VARCHAR(50), hours_contributed INT, contribution_year INT); CREATE TABLE projects (id INT PRIMARY KEY, project_name VARCHAR(50), project_type VARCHAR(50)); | What is the total number of hours contributed by volunteers to the 'Art Therapy' program? | SELECT SUM(hours_contributed) AS total_volunteer_hours FROM volunteers INNER JOIN projects ON volunteers.id = projects.id WHERE project_type = 'Art Therapy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Blue_Capital (id INT, region VARCHAR(20), impact_investment FLOAT); INSERT INTO Blue_Capital (id, region, impact_investment) VALUES (1, 'Africa', 200000), (2, 'Asia', 300000); | How many impact investments were made by Blue Capital in regions with high poverty rates? | SELECT SUM(impact_investment) FROM Blue_Capital WHERE region IN ('Africa', 'Asia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE PollutionSources (id INT, source_name VARCHAR(50), location VARCHAR(50), type VARCHAR(50)); | Add a new 'PollutionSources' table with 3 columns and insert 3 records | INSERT INTO PollutionSources (id, source_name, location, type) VALUES (1, 'Oil Rig A', 'Atlantic Ocean', 'Oil Spill'), (2, 'Factory Plant B', 'Pacific Ocean', 'Plastic Waste'), (3, 'Research Vessel C', 'Indian Ocean', 'Chemical Leakage'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Trainings (TrainingID INT, Department VARCHAR(20), Cost FLOAT); INSERT INTO Trainings (TrainingID, Department, Cost) VALUES (1, 'Sales', 5000), (2, 'IT', 7000), (3, 'Sales', 6000), (4, 'HR', 4000); | What is the minimum training cost? | SELECT MIN(Cost) FROM Trainings; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_tech (id INT, project_name VARCHAR(100), location VARCHAR(50)); INSERT INTO biosensor_tech (id, project_name, location) VALUES (1, 'BioSense X', 'Southeast Asia'); INSERT INTO biosensor_tech (id, project_name, location) VALUES (2, 'Genomic Y', 'North America'); INSERT INTO biosensor_tech (id, project_name, location) VALUES (3, 'BioMarker Z', 'Europe'); | Find biosensor technology development projects in Southeast Asia. | SELECT * FROM biosensor_tech WHERE location = 'Southeast Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileWorkers (WorkerID INT, Salary DECIMAL(5,2), ApprenticeshipProgram BOOLEAN); | Update the salaries for workers in the 'TextileWorkers' table who have completed an apprenticeship program by 5% | UPDATE TextileWorkers SET Salary = Salary * 1.05 WHERE ApprenticeshipProgram = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Grants (GrantID INT, OrgID INT, Amount FLOAT, GrantDate DATE); INSERT INTO Grants (GrantID, OrgID, Amount, GrantDate) VALUES (1, 3, 15000.00, '2020-01-01'); | What is the average grant amount for a specific organization in a given year? | SELECT OrgID, AVG(Amount) FROM Grants WHERE YEAR(GrantDate) = 2020 AND OrgID = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE flight_safety (flight_number VARCHAR(50) PRIMARY KEY, safety_rating VARCHAR(20), last_inspection_date DATE); | Delete all records from the flight_safety table where the last_inspection_date is before 2015-01-01 | DELETE FROM flight_safety WHERE last_inspection_date < '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_sustainability (id INT, city VARCHAR(255), co_ownership_cost DECIMAL(10, 2), size INT); INSERT INTO urban_sustainability (id, city, co_ownership_cost, size) VALUES (1, 'Seattle', 550000, 1200), (2, 'Portland', 420000, 1500); | What is the average co-ownership cost per square foot in the 'urban_sustainability' table, ordered by cost? | SELECT AVG(co_ownership_cost / size) OVER (ORDER BY co_ownership_cost) AS avg_cost_per_sqft FROM urban_sustainability; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation(region VARCHAR(10), year INT, amount INT); INSERT INTO waste_generation VALUES('urban', 2019, 1500), ('urban', 2020, 1800), ('rural', 2019, 800), ('rural', 2020, 900); | What's the total waste generation in the 'urban' region for 2020? | SELECT SUM(amount) FROM waste_generation WHERE region = 'urban' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (StudentID int, Department varchar(50)); INSERT INTO Students (StudentID, Department) VALUES (1, 'Computer Science'); INSERT INTO Students (StudentID, Department) VALUES (2, 'Electrical Engineering'); CREATE TABLE Grants (GrantID int, StudentID int, Amount int); INSERT INTO Grants (GrantID, StudentID, Amount) VALUES (1, 1, 1000); INSERT INTO Grants (GrantID, StudentID, Amount) VALUES (2, 2, 2000); | What is the total amount of research grants awarded to graduate students in the 'Electrical Engineering' department? | SELECT SUM(Grants.Amount) FROM Students INNER JOIN Grants ON Students.StudentID = Grants.StudentID WHERE Students.Department = 'Electrical Engineering'; | 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.