context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE clinical_trials(trial_id TEXT, country TEXT, approval_date DATE); INSERT INTO clinical_trials (trial_id, country, approval_date) VALUES ('Trial1', 'CountryA', '2020-03-15'), ('Trial2', 'CountryB', '2019-12-20'), ('Trial3', 'CountryC', '2020-06-30'), ('Trial4', 'CountryB', '2020-08-01'); | What is the number of clinical trials approved in 'CountryB' in 2020? | SELECT COUNT(*) FROM clinical_trials WHERE country = 'CountryB' AND EXTRACT(YEAR FROM approval_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_funding (id INT, allocation FLOAT, initiative_type TEXT, region_id INT); CREATE TABLE regions (id INT, region TEXT); INSERT INTO climate_funding (id, allocation, initiative_type, region_id) VALUES (1, 500000.00, 'Mitigation', 1), (2, 750000.00, 'Adaptation', 2), (3, 300000.00, 'Communication', 1), ... | What is the average allocation for all climate initiatives in 'Asia'? | SELECT AVG(allocation) FROM climate_funding INNER JOIN regions ON climate_funding.region_id = regions.id WHERE regions.region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_stock (species VARCHAR(50), location VARCHAR(50), water_temp DECIMAL(5,2)); | What is the average water temperature for each species in the fish_stock table? | SELECT species, AVG(water_temp) as avg_temp FROM fish_stock GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE effective_altruism (id INT PRIMARY KEY, name VARCHAR(100), amount INT, cause VARCHAR(20)); | Insert new record into effective_altruism table | INSERT INTO effective_altruism (id, name, amount, cause) VALUES (5, 'Donation to Animal Welfare', 300000, 'Animal Welfare'); | gretelai_synthetic_text_to_sql |
CREATE TABLE savings (customer_id INT, name TEXT, state TEXT, savings DECIMAL(10, 2)); INSERT INTO savings (customer_id, name, state, savings) VALUES (5, 'Emma Wilson', 'California', 9000.00), (6, 'Oliver Brown', 'California', 10000.00); | How many customers live in 'California'? | SELECT COUNT(*) FROM savings WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE studio (studio_id INT, name VARCHAR(100)); INSERT INTO studio (studio_id, name) VALUES (1, 'Afro Entertainment'); CREATE TABLE tv_show (tv_show_id INT, title VARCHAR(100), studio_id INT, episodes INT); | Insert a new TV show 'Nubian Tales' by Afro Entertainment with 12 episodes. | INSERT INTO tv_show (tv_show_id, title, studio_id, episodes) VALUES (1, 'Nubian Tales', 1, 12); | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, artist_name VARCHAR(50), country_id INT); CREATE TABLE countries (country_id INT, country_name VARCHAR(50)); | How many artists from each country participated in the "artists" table, joined with the "countries" table, for artists who joined between 2016 and 2021? | SELECT c.country_name, COUNT(a.artist_id) as total_artists FROM artists a INNER JOIN countries c ON a.country_id = c.country_id WHERE a.artist_date BETWEEN '2016-01-01' AND '2021-12-31' GROUP BY c.country_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name TEXT, birth_year INT); CREATE TABLE sales (id INT, artwork_id INT, sale_price INT); INSERT INTO artists (id, name, birth_year) VALUES (1, 'Vincent Van Gogh', 1853), (2, 'Pablo Picasso', 1881), (3, 'Claude Monet', 1840); INSERT INTO sales (id, artwork_id, sale_price) VALUES (1, 1, 8200... | What are the total sales for artworks created by artists born before 1900? | SELECT SUM(sale_price) FROM sales sa INNER JOIN artworks a ON sa.artwork_id = a.id INNER JOIN artists ar ON a.artist_id = ar.id WHERE ar.birth_year < 1900; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_ingredients (ingredient_id INT, ingredient_name TEXT, is_organic BOOLEAN); CREATE TABLE dish_ingredients (dish_id INT, ingredient_id INT, weight REAL); | Display the total weight (in kg) of organic ingredients for each dish in the organic_ingredients and dish_ingredients tables. | SELECT dish_ingredients.dish_id, SUM(dish_ingredients.weight) FROM dish_ingredients INNER JOIN organic_ingredients ON dish_ingredients.ingredient_id = organic_ingredients.ingredient_id WHERE organic_ingredients.is_organic = TRUE GROUP BY dish_ingredients.dish_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (shipment_id INT, shipment_date DATE, warehouse_id INT); INSERT INTO shipments (shipment_id, shipment_date, warehouse_id) VALUES (1, '2021-01-01', 1), (2, '2021-01-02', 2), (3, '2021-01-03', 3); | What is the earliest shipment date for each warehouse? | SELECT warehouse_id, MIN(shipment_date) FROM shipments GROUP BY warehouse_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_projects (region VARCHAR(255), year INT, project_type VARCHAR(255), funded BOOLEAN); | How many climate mitigation projects were initiated in Asia and Africa from 2015 to 2020, and how many of those projects received funding? | SELECT project_type, COUNT(*) AS num_projects, SUM(funded) AS num_funded FROM climate_projects WHERE year BETWEEN 2015 AND 2020 AND region IN ('Asia', 'Africa') GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), department VARCHAR(50), age INT); | What is the average age of employees in the "mining_operations" table, who are working in the "sustainability" department? | SELECT AVG(age) FROM mining_operations WHERE department = 'sustainability'; | gretelai_synthetic_text_to_sql |
CREATE TABLE asian_salmon_farms (farm_id INT, year INT, biomass FLOAT); INSERT INTO asian_salmon_farms (farm_id, year, biomass) VALUES (1, 2020, 800.2), (2, 2021, 900.1), (3, 2020, 700.3); | Find the total biomass of Salmon farmed in Asia by year. | SELECT year, SUM(biomass) total_biomass FROM asian_salmon_farms GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Department (id INT, Name VARCHAR(255), City_id INT, Head VARCHAR(255), Country VARCHAR(255)); INSERT INTO Department (id, Name, City_id, Head, Country) VALUES (1, 'DeptA', 1, 'DeptHeadA', 'France'); INSERT INTO Department (id, Name, City_id, Head, Country) VALUES (2, 'DeptB', 2, 'DeptHeadB', 'Germany'); | What is the total budget for departments in 'France'? | SELECT Name, SUM(Amount) FROM Department INNER JOIN Budget ON Department.id = Budget.Department_id WHERE Country = 'France' GROUP BY Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists Cities (id int, name text); INSERT INTO Cities (id, name) VALUES (1, 'Los Angeles'), (2, 'New York'); CREATE TABLE if not exists Vehicles (id int, type text, capacity int, city_id int); INSERT INTO Vehicles (id, type, capacity, city_id) VALUES (1, 'Electric Bus', 50, 1), (2, 'Diesel Bus', 60,... | What is the maximum trip duration for shared bicycles in 'New York'? | SELECT MAX(duration) FROM Trips JOIN Vehicles ON Trips.vehicle_id = Vehicles.id WHERE Vehicles.type = 'Shared Bicycle' AND Vehicles.city_id = (SELECT id FROM Cities WHERE name = 'New York'); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, industry TEXT); CREATE TABLE investments (id INT, startup_id INT, funding_amount INT); | What is the total funding raised by startups in the healthcare industry? | SELECT SUM(investments.funding_amount) FROM startups JOIN investments ON startups.id = investments.startup_id WHERE startups.industry = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_handling (port_id INT, port_name VARCHAR(50), teu_count INT, handling_date DATE); INSERT INTO cargo_handling (port_id, port_name, teu_count, handling_date) VALUES (1, 'Port_A', 35000, '2022-01-01'), (2, 'Port_B', 40000, '2022-01-02'), (3, 'Port_C', 20000, '2022-01-03'); | What is the difference in TEU handling between the ports with the highest and lowest handling counts in the cargo_handling table? | SELECT MAX(teu_count) - MIN(teu_count) FROM cargo_handling; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, Name VARCHAR(50), Nationality VARCHAR(50)); INSERT INTO Artists (ArtistID, Name, Nationality) VALUES (1, 'Vincent Van Gogh', 'Dutch'); INSERT INTO Artists (ArtistID, Name, Nationality) VALUES (2, 'Pablo Picasso', 'Spanish'); CREATE TABLE Exhibitions (ExhibitionID INT, Gallery VARCHAR... | Which artists have their art exhibited in the 'ModernArt' gallery? | SELECT Name FROM Artists JOIN Exhibitions ON Artists.ArtistID = Exhibitions.ArtistID WHERE Gallery = 'ModernArt'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_facilities (facility_id INT, location TEXT, score INT); INSERT INTO mental_health_facilities (facility_id, location, score) VALUES (1, 'Arctic', 70), (2, 'Tropics', 80), (3, 'Temperate', 85); | What is the minimum cultural competency score for mental health facilities in Arctic regions? | SELECT MIN(score) FROM mental_health_facilities WHERE location = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DonorCountries (Country VARCHAR(20), DonationID INT, DonationAmount DECIMAL(10,2)); INSERT INTO DonorCountries (Country, DonationID, DonationAmount) VALUES ('USA', 1, 500.00), ('Canada', 2, 750.00), ('Mexico', 3, 250.00), ('Brazil', 4, 1000.00), ('Argentina', 5, 1250.00); | What is the total amount of donations received from each country? | SELECT Country, SUM(DonationAmount) as TotalDonations FROM DonorCountries GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorName VARCHAR(50), DonationAmount DECIMAL(10,2)); INSERT INTO Donors (DonorName, DonationAmount) VALUES ('John Smith', 5000.00), ('Jane Doe', 3000.00), ('Mike Johnson', 7000.00), ('Sara Connor', 6000.00); | Which donors have donated more than the average donation amount? | SELECT DonorName FROM Donors WHERE DonationAmount > (SELECT AVG(DonationAmount) FROM Donors); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name VARCHAR(255), country VARCHAR(255), rating FLOAT, sustainable_package BOOLEAN); INSERT INTO hotels (hotel_id, name, country, rating, sustainable_package) VALUES (1, 'Canada Eco Hotel', 'Canada', 4.2, true), (2, 'Green Lodge', 'Canada', 4.5, false), (3, 'Sustainable Inn', 'Canada'... | What is the minimum rating of hotels in Canada offering sustainable tourism packages? | SELECT MIN(rating) FROM hotels WHERE country = 'Canada' AND sustainable_package = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Authors (id INT, name VARCHAR(50)); CREATE TABLE Articles (id INT, author_id INT, topic VARCHAR(50), published_date DATE); INSERT INTO Authors (id, name) VALUES (1, 'John Doe'); INSERT INTO Authors (id, name) VALUES (2, 'Jane Smith'); INSERT INTO Articles (id, author_id, topic, published_date) VALUES (1, 1... | List the names of authors who have only published articles on a single topic | SELECT a.name FROM Authors a INNER JOIN (SELECT author_id, COUNT(DISTINCT topic) as topic_count FROM Articles GROUP BY author_id) b ON a.id = b.author_id WHERE b.topic_count = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, country_name VARCHAR(255), region VARCHAR(50));CREATE TABLE manufacturers (manufacturer_id INT, manufacturer_name VARCHAR(255), country_id INT); | What is the total number of manufacturers producing garments in the European Union? | SELECT COUNT(DISTINCT m.manufacturer_id) AS total_manufacturers FROM manufacturers m JOIN countries c ON m.country_id = c.country_id WHERE c.region = 'European Union'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselOrganizations (vessel VARCHAR(255), organization VARCHAR(255)); INSERT INTO VesselOrganizations (vessel, organization) VALUES ('Vessel1', 'FisheryEnforcement'), ('Vessel2', 'MaritimeSecurity'), ('Vessel3', 'FisheryEnforcement'), ('Vessel4', 'MaritimeSecurity'), ('Vessel5', 'MaritimeSecurity'); | Identify the unique vessels between 'FisheryEnforcement' and 'MaritimeSecurity' organizations | (SELECT vessel FROM VesselOrganizations WHERE organization = 'FisheryEnforcement' EXCEPT SELECT vessel FROM VesselOrganizations WHERE organization = 'MaritimeSecurity') UNION (SELECT vessel FROM VesselOrganizations WHERE organization = 'MaritimeSecurity' EXCEPT SELECT vessel FROM VesselOrganizations WHERE organization ... | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_rounds (round_name VARCHAR(50), investment_year INT, investment_amount INT, investment_type VARCHAR(50)); | Update the investment amount for "Series C" to 20000000 in the "investment_rounds" table | UPDATE investment_rounds SET investment_amount = 20000000 WHERE round_name = 'Series C'; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (id INT, name TEXT); INSERT INTO districts (id, name) VALUES (1, 'Watts'), (2, 'Compton'), (3, 'Inglewood'); CREATE TABLE crimes (id INT, district_id INT, report_date DATE); INSERT INTO crimes (id, district_id, report_date) VALUES (1, 1, '2023-01-01'), (2, 1, '2023-01-15'), (3, 1, '2023-02-10'), ... | What is the total number of reported crimes in the Watts district in the last 6 months? | SELECT COUNT(*) FROM crimes WHERE district_id = 1 AND report_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists destinations (destination_id int, destination_name varchar(50), region_id int); INSERT INTO destinations (destination_id, destination_name, region_id) VALUES (1, 'Seattle', 1), (2, 'Portland', 1), (3, 'London', 2); CREATE TABLE if not exists visitor_stats (visitor_id int, destination_id int, ... | Which destinations were visited on the first and last days of the month? | SELECT vs.destination_id, d.destination_name, vs.visit_date FROM visitor_stats vs JOIN destinations d ON vs.destination_id = d.destination_id WHERE DATE_TRUNC('month', vs.visit_date) = DATE_TRUNC('month', vs.visit_date) AND (vs.visit_date = (SELECT MIN(visit_date) FROM visitor_stats WHERE DATE_TRUNC('month', visit_date... | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (id INT, country VARCHAR(50), region VARCHAR(50), capacity FLOAT); INSERT INTO renewable_energy_projects (id, country, region, capacity) VALUES (1, 'Germany', 'europe', 3000.00), (2, 'France', 'europe', 2500.00), (3, 'Spain', 'europe', 3500.00); | What is the maximum installed capacity (in MW) of renewable energy projects in the 'europe' region, partitioned by country? | SELECT region, country, MAX(capacity) as max_capacity FROM renewable_energy_projects WHERE region = 'europe' GROUP BY country, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE hockey_games (id INT, home_team VARCHAR(50), away_team VARCHAR(50), date DATE, assists_home INT, assists_away INT); INSERT INTO hockey_games (id, home_team, away_team, date, assists_home, assists_away) VALUES (1, 'Montreal Canadiens', 'Toronto Maple Leafs', '2022-03-01', 5, 2); INSERT INTO hockey_games (id... | What is the maximum number of assists by a single player in a hockey game in the 'hockey_games' table? | SELECT MAX(GREATEST(assists_home, assists_away)) FROM hockey_games; | gretelai_synthetic_text_to_sql |
CREATE TABLE org_donation (org_id INT, donation_id INT, donation_amount INT); INSERT INTO org_donation (org_id, donation_id, donation_amount) VALUES (1, 1, 500), (1, 2, 750), (2, 3, 1000), (3, 4, 250), (4, 5, 300); | What is the total donation amount for each organization? | SELECT org_id, SUM(donation_amount) as total_donations FROM org_donation GROUP BY org_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(50), hire_date DATE); | Delete an employee record from the 'employees' table | DELETE FROM employees WHERE id = 101; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, client_state VARCHAR(20), close_date DATE); INSERT INTO cases (case_id, client_state, close_date) VALUES (1, 'California', NULL), (2, 'Texas', '2022-05-15'), (3, 'California', '2022-02-28'); | List all cases where the client is from the state of 'California' and the case is still open. | SELECT case_id, client_state, close_date FROM cases WHERE client_state = 'California' AND close_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensary_sales (id INT, strain VARCHAR(255), quantity INT, revenue FLOAT); | What is the total quantity of each strain sold in 'dispensary_sales' table? | SELECT strain, SUM(quantity) as total_quantity FROM dispensary_sales GROUP BY strain; | gretelai_synthetic_text_to_sql |
CREATE TABLE InfectiousDiseases (Country VARCHAR(255), Disease VARCHAR(255), Cases DECIMAL(10,2)); INSERT INTO InfectiousDiseases (Country, Disease, Cases) VALUES ('Country A', 'Disease A', 1200.00), ('Country A', 'Disease B', 800.00), ('Country A', 'Disease C', 500.00), ('Country B', 'Disease A', 1500.00), ('Country B... | What are the top 3 infectious diseases by number of cases, and which countries have the highest incidence rates? | SELECT Disease, SUM(Cases) AS TotalCases FROM InfectiousDiseases GROUP BY Disease ORDER BY TotalCases DESC LIMIT 3; SELECT Country, IncidenceRate FROM IncidenceRates WHERE IncidenceRate IN (SELECT MAX(IncidenceRate) FROM IncidenceRates) ORDER BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (PolicyID INT, PolicyholderID INT, Product VARCHAR(10)); INSERT INTO Policy (PolicyID, PolicyholderID, Product) VALUES (1, 1, 'Auto'), (2, 1, 'Auto'), (3, 2, 'Home'), (4, 3, 'Auto'), (5, 4, 'Home'), (6, 4, 'Home'); | Add a new product type to the Policy table. | ALTER TABLE Policy ADD COLUMN Product2 VARCHAR(10); UPDATE Policy SET Product2 = 'Motorcycle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_papers (title VARCHAR(255), publication_year INT, authors INT); INSERT INTO research_papers (title, publication_year, authors) VALUES ('Paper1', 2020, 4), ('Paper2', 2021, 3), ('Paper3', 2019, 2), ('Paper4', 2022, 5); | Which AI safety research papers were published in the last 3 years, ordered by the number of authors in descending order? | SELECT title FROM (SELECT title, ROW_NUMBER() OVER (ORDER BY authors DESC) as rn FROM research_papers WHERE publication_year >= YEAR(CURRENT_DATE) - 3) t WHERE rn <= 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_strategies (strategy_id INT, strategy_name VARCHAR(50), AUM DECIMAL(10, 2)); INSERT INTO investment_strategies (strategy_id, strategy_name, AUM) VALUES (1, 'Equity', 5000000.00), (2, 'Bond', 3000000.00), (3, 'Real Estate', 7000000.00); | What is the total assets under management (AUM) for each investment strategy? | SELECT strategy_name, SUM(AUM) FROM investment_strategies GROUP BY strategy_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE GraduateStudentPublications(StudentID INT, PublicationDate DATE); INSERT INTO GraduateStudentPublications (StudentID, PublicationDate) VALUES (1, '2021-01-01'), (2, '2020-01-01'); | List the graduate students who have not published any research in the past year. | SELECT g.StudentID, g.Name FROM GraduateStudents g LEFT JOIN GraduateStudentPublications p ON g.StudentID = p.StudentID WHERE p.PublicationDate IS NULL AND YEAR(p.PublicationDate) = YEAR(CURRENT_DATE()) - 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_development (name TEXT, cost FLOAT, launch_location TEXT); INSERT INTO biosensor_development (name, cost, launch_location) VALUES ('BioSensor1', 25000, 'Tokyo'); INSERT INTO biosensor_development (name, cost, launch_location) VALUES ('BioSensor2', 30000, 'Seoul'); | Identify the average development cost of biosensors launched in Asia. | SELECT AVG(cost) FROM biosensor_development WHERE launch_location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, name VARCHAR(50), hectares DECIMAL(5,2), year_planted INT, avg_carbon_sequestration DECIMAL(5,2), PRIMARY KEY (id)); INSERT INTO forests (id, name, hectares, year_planted, avg_carbon_sequestration) VALUES (1, 'Forest A', 123.45, 1990, 2.5), (2, 'Forest B', 654.32, 2005, 3.2), (3, 'Forest C... | Calculate the average carbon sequestration for forests planted after a certain year | SELECT AVG(f.avg_carbon_sequestration) FROM forests f WHERE f.year_planted > 1999; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name VARCHAR(255), region VARCHAR(255), water_salinity FLOAT, water_depth FLOAT, water_temperature FLOAT); INSERT INTO fish_farms (id, name, region, water_salinity, water_depth, water_temperature) VALUES (1, 'Farm G', 'Africa', 20.5, 7.6, 26.2), (2, 'Farm H', 'Africa', 22.3, 6.1, 27.8),... | What is the minimum water salinity (in ppt) in fish farms located in Africa, with a water depth greater than 5 meters and a water temperature below 28 degrees Celsius? | SELECT MIN(water_salinity) FROM fish_farms WHERE region = 'Africa' AND water_depth > 5 AND water_temperature < 28; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ports (PortID INT, PortName VARCHAR(100), City VARCHAR(100), Country VARCHAR(100)); INSERT INTO Ports (PortID, PortName, City, Country) VALUES (1, 'Port of Singapore', 'Singapore', 'Singapore'); INSERT INTO Ports (PortID, PortName, City, Country) VALUES (2, 'Port of Rotterdam', 'Rotterdam', 'Netherlands');... | List the names of ports where the Kota Pertama has docked. | SELECT Ports.PortName FROM Ports INNER JOIN Vessels ON Ports.PortID = Vessels.PortID WHERE Vessels.VesselName = 'Kota Pertama'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wildlife_habitat (id INT, species VARCHAR(255), population INT); INSERT INTO wildlife_habitat (id, species, population) VALUES (1, 'Bear', 35), (2, 'Deer', 78), (3, 'Raccoon', 42); | What is the average population of animals in the wildlife_habitat table for the species 'Raccoon'? | SELECT AVG(population) FROM wildlife_habitat WHERE species = 'Raccoon'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (vehicle_id INT, model VARCHAR(20), manufacture VARCHAR(20), horsepower INT); CREATE VIEW sports_cars AS SELECT vehicle_id, horsepower FROM vehicles WHERE manufacture = 'Italy' AND vehicle_type = 'sports_car'; | What is the average horsepower for sports cars produced in Italy? | SELECT AVG(horsepower) FROM sports_cars; | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (id INT, amount DECIMAL(10, 2), issuance_date DATE, institution_id INT, is_socially_responsible BOOLEAN); INSERT INTO loans (id, amount, issuance_date, institution_id, is_socially_responsible) VALUES (1, 10000, '2022-01-01', 1, true); CREATE TABLE financial_institutions (id INT, name VARCHAR(50), reg... | What is the total amount of socially responsible loans issued by financial institutions in the Asia-Pacific region? | SELECT SUM(loans.amount) FROM loans INNER JOIN financial_institutions ON loans.institution_id = financial_institutions.id WHERE loans.is_socially_responsible = true AND financial_institutions.region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName VARCHAR(50), DonationAmount DECIMAL(10,2), Gender VARCHAR(10), CauseID INT);CREATE VIEW DonorGender AS SELECT DonorID, DonorName, Gender FROM Donors;CREATE TABLE Causes (CauseID INT, CauseName VARCHAR(50)); | Which causes received the most donations from female donors? | SELECT C.CauseName, SUM(D.DonationAmount) FROM Donors D JOIN DonorGender DG ON D.DonorID = DG.DonorID JOIN Causes C ON D.CauseID = C.CauseID WHERE DG.Gender = 'Female' GROUP BY C.CauseName ORDER BY SUM(D.DonationAmount) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (id INT, hotel_id INT, engagement_count INT, engagement_date DATE); CREATE TABLE hotels (id INT, name TEXT, city TEXT, country TEXT); | What is the maximum number of virtual tours engaged with in a single day for hotels in Rome, Italy? | SELECT MAX(engagement_count) FROM virtual_tours vt INNER JOIN hotels h ON vt.hotel_id = h.id WHERE h.city = 'Rome' AND h.country = 'Italy' GROUP BY engagement_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, location VARCHAR(20), quantity INT, price DECIMAL(5,2)); INSERT INTO sales (id, location, quantity, price) VALUES (1, 'Northeast', 50, 12.99), (2, 'Midwest', 75, 19.99), (3, 'West', 120, 14.49); | what is the total quantity of seafood sold in the west | SELECT SUM(quantity) FROM sales WHERE location = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterConservationInitiatives (initiative_id INT, city VARCHAR(20), water_saved_liters INT); INSERT INTO WaterConservationInitiatives (initiative_id, city, water_saved_liters) VALUES (1, 'Chicago', 1200000), (2, 'Chicago', 1500000); | What is the total amount of water saved in liters through water conservation initiatives in the city of Chicago? | SELECT SUM(water_saved_liters) FROM WaterConservationInitiatives WHERE city = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_year INT, founder_background TEXT); INSERT INTO company (id, name, founding_year, founder_background) VALUES (1, 'Acme Inc', 2010, 'minority'); INSERT INTO company (id, name, founding_year, founder_background) VALUES (2, 'Beta Corp', 2015, 'non-minority'); | What is the number of companies founded by individuals from underrepresented backgrounds? | SELECT COUNT(*) FROM company WHERE founder_background = 'minority'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, city TEXT, virtual_tour_views INT); INSERT INTO hotels (hotel_id, hotel_name, city, virtual_tour_views) VALUES (1, 'The Plaza Hotel', 'New York', 700), (2, 'The Mandarin Oriental', 'New York', 600), (3, 'The Bowery Hotel', 'New York', 500); | What is the average number of virtual tour views per hotel in New York? | SELECT city, AVG(virtual_tour_views) as avg_views FROM hotels WHERE city = 'New York' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselMovements (vessel_id INT, movement_date DATE, speed INT); | Find the vessel with the highest average speed for a specific month | SELECT vessel_id, AVG(speed) FROM VesselMovements WHERE movement_date >= '2022-01-01' AND movement_date <= '2022-01-31' GROUP BY vessel_id ORDER BY AVG(speed) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftManufacturing(model VARCHAR(20), total_cost INT); INSERT INTO AircraftManufacturing VALUES('Falcon 1', 500000),('Falcon 9', 600000); | What is the minimum cost of manufacturing the aircraft models 'Falcon 9' and 'Falcon 1'? | SELECT MIN(total_cost) FROM AircraftManufacturing WHERE model IN ('Falcon 9', 'Falcon 1'); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (country VARCHAR(50), year INT, events INT); INSERT INTO defense_diplomacy (country, year, events) VALUES ('Canada', 2019, 15), ('Canada', 2020, 12), ('Canada', 2021, 18); | What is the total number of defense diplomacy events held in 'canada' between 2019 and 2021? | SELECT country, SUM(events) as total_events FROM defense_diplomacy WHERE country = 'Canada' AND year BETWEEN 2019 AND 2021 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE permits_by_company (company VARCHAR(255), region VARCHAR(255), permit_number INT); | List all companies with onshore drilling permits in Wyoming and Montana. | SELECT DISTINCT company FROM permits_by_company WHERE region IN ('Wyoming', 'Montana') INTERSECT SELECT company FROM permits_by_company WHERE region IN ('Colorado', 'New Mexico'); | gretelai_synthetic_text_to_sql |
CREATE TABLE precipitation_ethiopia (region VARCHAR(50), year INT, avg_precipitation FLOAT); INSERT INTO precipitation_ethiopia (region, year, avg_precipitation) VALUES ('Rural Ethiopia', 2016, 800), ('Rural Ethiopia', 2017, 900), ('Rural Ethiopia', 2018, 1000), ('Rural Ethiopia', 2019, 1100), ('Rural Ethiopia', 2020, ... | What was the average annual precipitation in rural Ethiopia between 2016 and 2020? | SELECT AVG(avg_precipitation) FROM precipitation_ethiopia WHERE region = 'Rural Ethiopia' AND year BETWEEN 2016 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Buildings (id INT, city VARCHAR(20), construction_year INT, co2_emission FLOAT); INSERT INTO Buildings (id, city, construction_year, co2_emission) VALUES (1, 'Seattle', 1999, 350.5), (2, 'Seattle', 1995, 400.2), (3, 'Portland', 2005, 250.1); | What is the average CO2 emission of buildings constructed before 2000 in the city of Seattle? | SELECT AVG(co2_emission) FROM Buildings WHERE city = 'Seattle' AND construction_year < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousVehicles (Id INT, TestLocation VARCHAR(50), TestDate DATE, VehicleCount INT); INSERT INTO AutonomousVehicles (Id, TestLocation, TestDate, VehicleCount) VALUES (1, 'Arizona', '2018-01-01', 200), (2, 'Arizona', '2019-01-01', 400), (3, 'Arizona', '2020-01-01', 600), (4, 'Arizona', '2021-01-01', 800)... | What is the total number of autonomous vehicles tested in Arizona? | SELECT SUM(VehicleCount) FROM AutonomousVehicles WHERE TestLocation = 'Arizona'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exploration (ExplorationID VARCHAR(10), Location VARCHAR(20), StartDate DATE, EndDate DATE); | Insert new records into 'Exploration' table for the following data: (ExplorationID, Location, StartDate, EndDate) - ('Exp01', 'Gulf of Mexico', '2020-01-01', '2020-12-31') | INSERT INTO Exploration (ExplorationID, Location, StartDate, EndDate) VALUES ('Exp01', 'Gulf of Mexico', '2020-01-01', '2020-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO Exhibitions (exhibition_id, name, start_date, end_date) VALUES (1, 'Impressionist', '2020-05-01', '2021-01-01'), (2, 'Cubism', '2019-08-15', '2020-03-30'), (3, 'Surrealism', '2018-12-15', '2019-09-15'); CREATE TA... | What is the percentage of visitors who identified as male or female out of total visitors? | SELECT (SUM(CASE WHEN gender IN ('male', 'female') THEN 1 ELSE 0 END)/COUNT(*))*100 FROM Visitors; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (program_id INT, program_name VARCHAR(255), initiation_date DATE, co2_savings INT); INSERT INTO carbon_offset_programs (program_id, program_name, initiation_date, co2_savings) VALUES (1, 'Carbon Offset Program A', '2012-04-01', 12000); INSERT INTO carbon_offset_programs (program_id, ... | Display the carbon offset programs initiated in 2015 and their respective CO2 savings, and the total CO2 savings for all programs initiated in 2015 | SELECT program_name, co2_savings FROM carbon_offset_programs WHERE initiation_date = '2015-01-01' AND initiation_date = '2015-12-31' GROUP BY program_name; SELECT SUM(co2_savings) FROM carbon_offset_programs WHERE initiation_date BETWEEN '2015-01-01' AND '2015-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicles (Id INT, Make VARCHAR(50), Model VARCHAR(50), Year INT, Horsepower INT); | What is the maximum horsepower of electric vehicles in the 'GreenAutos' database? | SELECT MAX(Horsepower) FROM ElectricVehicles WHERE FuelType = 'Electric'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eiffel_tower_visitors (id INT, year INT, visitors INT); INSERT INTO eiffel_tower_visitors (id, year, visitors) VALUES (1, 2019, 7000000), (2, 2020, 3000000); | How many tourists visited the Eiffel Tower in 2020? | SELECT visitors FROM eiffel_tower_visitors WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (game_id INT, title VARCHAR(100), release_year INT, copies_sold INT, revenue INT); INSERT INTO Games (game_id, title, release_year, copies_sold, revenue) VALUES (1, 'Mario Kart 64', 1996, 150000, 500000), (2, 'Tetris', 1984, 50000000, 15000000); | What is the total revenue for games released before 2010 that have more than 100k copies sold? | SELECT SUM(revenue) FROM Games g WHERE g.release_year < 2010 AND g.copies_sold > 100000; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_technology (tech_id INT, tech_name VARCHAR(100), adoption_date DATE); INSERT INTO smart_city_technology (tech_id, tech_name, adoption_date) VALUES (1, 'Smart Grid', '2020-03-15'), (2, 'Smart Lighting', '2019-08-01'), (3, 'Smart Waste', '2021-02-01'); | What is the total number of smart city technology adoptions in the 'smart_city_technology' table? | SELECT COUNT(*) FROM smart_city_technology; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainability_ratings (org_id INT, explainability_score FLOAT); INSERT INTO explainability_ratings (org_id, explainability_score) VALUES (1, 0.85), (2, 0.92), (3, 0.88), (4, 0.9), (5, 0.8); | List the top 3 organizations with the highest explainability ratings. | SELECT org_id, explainability_score FROM explainability_ratings ORDER BY explainability_score DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_name VARCHAR(255), state_id INT); INSERT INTO states (state_name, state_id) VALUES ('California', 1); CREATE TABLE schools (school_name VARCHAR(255), state_id INT, PRIMARY KEY (school_name, state_id)); CREATE TABLE teachers (teacher_id INT, teacher_age INT, school_name VARCHAR(255), state_id ... | What is the average age of teachers who have participated in professional development programs in the last year, in the state of California? | SELECT AVG(teachers.teacher_age) FROM teachers INNER JOIN professional_development ON teachers.teacher_id = professional_development.teacher_id INNER JOIN schools ON teachers.school_name = schools.school_name WHERE schools.state_id = 1 AND professional_development.pd_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, Name VARCHAR(50), Manufacturer VARCHAR(50));CREATE TABLE SpaceMissions (MissionID INT, SpacecraftID INT, Name VARCHAR(50), Destination VARCHAR(50)); INSERT INTO Spacecraft (SpacecraftID, Name, Manufacturer) VALUES (1, 'Spirit', 'NASA'), (2, 'Curiosity', 'NASA'), (3, 'Persevera... | How many spacecraft were part of space missions to Mars? | SELECT COUNT(s.SpacecraftID) FROM Spacecraft s INNER JOIN SpaceMissions sm ON s.SpacecraftID = sm.SpacecraftID WHERE sm.Destination = 'Mars'; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, well_being_score INT, community_representation VARCHAR(50)); | What is the average well-being score for athletes from underrepresented communities? | SELECT AVG(athletes.well_being_score) FROM athletes WHERE athletes.community_representation = 'Underrepresented'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_hospitals_2 (id INT, name TEXT, location TEXT, capacity INT); INSERT INTO rural_hospitals_2 (id, name, location, capacity) VALUES (1, 'Hospital C', 'City3', 75), (2, 'Hospital D', 'City4', 60); | How many rural hospitals are in the "rural_hospitals_2" table? | SELECT COUNT(*) FROM rural_hospitals_2; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT, ai_voice_assistant BOOLEAN); INSERT INTO hotels VALUES (6, 'Hotel G', 'India', true); | What is the percentage of hotels in India that have adopted AI voice assistants? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM hotels WHERE country = 'India')) AS percentage FROM hotels WHERE country = 'India' AND ai_voice_assistant = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE TV_Shows (show_id INT PRIMARY KEY, name VARCHAR(100), genre VARCHAR(50)); INSERT INTO TV_Shows (show_id, name, genre) VALUES (1, 'Breaking Bad', 'Drama'), (2, 'Stranger Things', 'Sci-fi'); | Update the genre of the TV show 'Breaking Bad' to 'Crime' in the 'TV_Shows' table. | UPDATE TV_Shows SET genre = 'Crime' WHERE name = 'Breaking Bad'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production(year INT, region VARCHAR(20), element VARCHAR(10), quantity INT); INSERT INTO production VALUES(2020, 'North America', 'Dysprosium', 1200), (2020, 'South America', 'Dysprosium', 800), (2020, 'Australia', 'Dysprosium', 400); | What is the total production of Dysprosium in the 'North America' region for 2020? | SELECT SUM(quantity) FROM production WHERE element = 'Dysprosium' AND region = 'North America' AND year = 2020 | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_engineering_by_location(location VARCHAR(255), menu_item VARCHAR(255), food_cost DECIMAL(10,2), selling_price DECIMAL(10,2)); INSERT INTO menu_engineering_by_location(location, menu_item, food_cost, selling_price) VALUES('Location 1', 'Burger', 1.50, 7.95), ('Location 1', 'Fries', 0.35, 2.50), ('Locat... | What is the total food cost for each menu item, broken down by restaurant location? | SELECT menu_item, location, SUM(food_cost) FROM menu_engineering_by_location GROUP BY menu_item, location; | gretelai_synthetic_text_to_sql |
CREATE TABLE actor (id INT PRIMARY KEY, name VARCHAR(255), gender VARCHAR(255)); CREATE TABLE movie (id INT PRIMARY KEY, title VARCHAR(255), year INT, country VARCHAR(255), leading_actor_id INT, leading_actress_id INT); INSERT INTO actor (id, name, gender) VALUES (1, 'ActorA', 'Male'), (2, 'ActorB', 'Male'), (3, 'Actor... | Who are the top 5 actors with the highest number of leading roles in French movies? | SELECT a.name, COUNT(*) AS num_leading_roles FROM actor a JOIN movie m ON a.id IN (m.leading_actor_id, m.leading_actress_id) GROUP BY a.id ORDER BY num_leading_roles DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriber_data (subscriber_id INT, subscriber_type VARCHAR(20), tech_type VARCHAR(20)); INSERT INTO subscriber_data (subscriber_id, subscriber_type, tech_type) VALUES (1, 'Regular', '4G'), (2, 'Test', '3G'), (3, 'Regular', '5G'); | Identify the total number of subscribers for each technology type, excluding subscribers with a 'test' account type | SELECT tech_type, COUNT(*) as total_subscribers FROM subscriber_data WHERE subscriber_type != 'Test' GROUP BY tech_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_rainfall (crop_type VARCHAR(255), rainfall DECIMAL(5,2), record_date DATE); INSERT INTO crop_rainfall (crop_type, rainfall, record_date) VALUES ('corn', 25.0, '2022-01-01'), ('soybeans', 30.0, '2022-01-02'), ('corn', 22.0, '2022-01-03'), ('soybeans', 28.0, '2022-01-04'); | Find the total rainfall for each crop type in the past 30 days. | SELECT c.crop_type, SUM(rainfall) AS total_rainfall FROM crop_rainfall c JOIN (SELECT CURDATE() - INTERVAL 30 DAY AS start_date) d ON c.record_date >= d.start_date GROUP BY c.crop_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency_scores (id INT, country_id INT, year INT, score FLOAT); | What is the correlation between energy efficiency scores and GDP per capita? | SELECT c.name, e.score, c.gdp_per_capita, CORR(e.score, c.gdp_per_capita) as correlation FROM energy_efficiency_scores e JOIN countries c ON e.country_id = c.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_research_projects (project_name VARCHAR(255), region VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO marine_research_projects (project_name, region, start_date, end_date) VALUES ('Antarctic Ice Shelf Study', 'Antarctic', '2022-01-01', '2024-12-31'), ('Antarctic Krill Census', 'Antarctic',... | What is the total number of marine research projects in the Antarctic region? | SELECT COUNT(*) FROM marine_research_projects WHERE region = 'Antarctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, GameType VARCHAR(20), Location VARCHAR(20)); INSERT INTO Players (PlayerID, GameType, Location) VALUES (1, 'Sports', 'North America'), (2, 'RPG', 'Europe'), (3, 'Strategy', 'Asia'), (4, 'Sports', 'North America'), (5, 'RPG', 'North America'); | How many players play each game type in North America? | SELECT GameType, Location, COUNT(*) as NumPlayers FROM Players GROUP BY GameType, Location | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, Name TEXT); CREATE TABLE VolunteerPrograms (VolunteerID INT, Program TEXT, Hours DECIMAL); INSERT INTO Volunteers VALUES (1, 'John Doe'), (2, 'Jane Smith'); INSERT INTO VolunteerPrograms VALUES (1, 'Program A', 10.00), (1, 'Program B', 15.00), (2, 'Program A', 20.00); | Summarize the total hours worked per volunteer. | SELECT Volunteers.Name, SUM(VolunteerPrograms.Hours) as TotalHours FROM Volunteers INNER JOIN VolunteerPrograms ON Volunteers.VolunteerID = VolunteerPrograms.VolunteerID GROUP BY Volunteers.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), sport VARCHAR(20), height INT, country VARCHAR(50)); | What is the average height of cricket players from Australia? | SELECT AVG(height) FROM players WHERE sport = 'Cricket' AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy_initiatives (id INT, region VARCHAR(50), initiative VARCHAR(100)); | List all circular economy initiatives in 'Asia' from the 'circular_economy_initiatives' table | SELECT initiative FROM circular_economy_initiatives WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hotels (hotel_id INT, hotel_name VARCHAR(100), category VARCHAR(50), rating FLOAT); INSERT INTO Hotels (hotel_id, hotel_name, category, rating) VALUES (1, 'Hotel A', 'Boutique', 4.6), (2, 'Hotel B', 'Boutique', 4.3), (3, 'Hotel C', 'Luxury', 5.0); | How many 5-star hotels are there in the 'Luxury' category? | SELECT COUNT(*) FROM Hotels WHERE category = 'Luxury' AND rating = 5.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name TEXT, location TEXT); INSERT INTO factories (factory_id, name, location) VALUES (1, 'Factory A', 'Florida'), (2, 'Factory B', 'Georgia'), (3, 'Factory C', 'California'); CREATE TABLE productions (factory_id INT, chemical TEXT); INSERT INTO productions (factory_id, chemical) ... | Show me all the chemicals produced in factories located in Florida or Georgia? | SELECT p.chemical FROM factories f JOIN productions p ON f.factory_id = p.factory_id WHERE f.location IN ('Florida', 'Georgia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE exploration_funding (id INT, project TEXT, location TEXT, amount FLOAT); INSERT INTO exploration_funding (id, project, location, amount) VALUES (1, 'Project A', 'Arctic Circle', 5000000); INSERT INTO exploration_funding (id, project, location, amount) VALUES (2, 'Project B', 'Antarctic Circle', 7000000); | What is the average deep-sea exploration funding for projects in the Arctic Circle? | SELECT AVG(amount) FROM exploration_funding WHERE location = 'Arctic Circle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_institutions (institution_id INT, institution_name TEXT, region TEXT);CREATE TABLE loans (loan_id INT, institution_id INT, loan_amount DECIMAL, is_socially_responsible BOOLEAN); | What is the average amount of socially responsible loans issued by financial institutions in Africa? | SELECT AVG(loan_amount) FROM loans JOIN financial_institutions ON loans.institution_id = financial_institutions.institution_id WHERE is_socially_responsible = TRUE AND region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (id INT, name VARCHAR(50), professional_development_course VARCHAR(50), course_date DATE); | Which professional development courses were taken by teachers in the last 3 years? | SELECT professional_development_course FROM teachers WHERE course_date >= DATEADD(year, -3, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_for_social_good (id INT PRIMARY KEY, project VARCHAR(100), description TEXT); | Insert a new record into the 'tech_for_social_good' table with an id of 3, a 'project' name of 'Accessible coding resources', and a 'description' of 'Free coding resources for people with disabilities' | INSERT INTO tech_for_social_good (id, project, description) VALUES (3, 'Accessible coding resources', 'Free coding resources for people with disabilities'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (product_id INT, product_name TEXT, vegan BOOLEAN, organic BOOLEAN, country TEXT); INSERT INTO Products (product_id, product_name, vegan, organic, country) VALUES (1, 'Green Concealer', TRUE, TRUE, 'USA'), (2, 'Vegan Blush', TRUE, TRUE, 'USA'), (3, 'Organic Bronzer', FALSE, TRUE, 'USA'), (4, 'Pure... | What is the total revenue for products that are both vegan and organic in the USA? | SELECT SUM(price * quantity_sold) AS revenue FROM Products WHERE country = 'USA' AND vegan = TRUE AND organic = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE RuralInfrastructure (id INT, project VARCHAR(255), country VARCHAR(255), budget FLOAT); INSERT INTO RuralInfrastructure (id, project, country, budget) VALUES (1, 'Water Supply', 'Colombia', 250000.00), (2, 'Road Construction', 'Colombia', 500000.00); | What is the average budget for rural infrastructure projects in Colombia? | SELECT AVG(budget) FROM RuralInfrastructure WHERE country = 'Colombia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, RestaurantName varchar(50), City varchar(50), State varchar(50), Country varchar(50)); INSERT INTO Restaurants (RestaurantID, RestaurantName, City, State, Country) VALUES (1, 'Tasty Thai', 'New York', 'NY', 'USA'), (2, 'Pizzeria Napoli', 'Rome', 'Italy', 'Italy'), (3, 'Sushi ... | What is the total organic revenue for each restaurant, ordered by total organic revenue in descending order? | SELECT RestaurantName, SUM(Revenue) as TotalOrganicRevenue FROM Restaurants JOIN Revenue ON Restaurants.RestaurantID = Revenue.RestaurantID WHERE IsOrganic = 1 GROUP BY RestaurantName ORDER BY TotalOrganicRevenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_name TEXT, length FLOAT, flag_state TEXT); | What is the total length of all vessels in the maritime safety database, grouped by their flag states? | SELECT flag_state, SUM(length) AS total_length FROM vessels GROUP BY flag_state; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_id INT, name VARCHAR(255), approval_date DATE);CREATE TABLE clinical_trials (trial_id INT, drug_id INT, outcome VARCHAR(255)); | What are the number of clinical trials and their outcomes for each drug that has been approved by the EMA, including the drug name and approval date? | SELECT d.name, d.approval_date, COUNT(ct.trial_id) as num_trials, STRING_AGG(ct.outcome, ',') as outcomes FROM drugs d JOIN clinical_trials ct ON d.drug_id = ct.drug_id GROUP BY d.name, d.approval_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE EVStationCounts (id INT, country VARCHAR(20), num_stations INT); INSERT INTO EVStationCounts (id, country, num_stations) VALUES (1, 'Germany', 3000), (2, 'Spain', 1500), (3, 'France', 2000); | How many electric vehicle charging stations are there in Germany and Spain combined? | SELECT COUNT(*) FROM EVStationCounts WHERE country IN ('Germany', 'Spain'); | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (menu_item_id INT, name VARCHAR(255), price DECIMAL(5,2), restaurant_id INT); INSERT INTO menu_items (menu_item_id, name, price, restaurant_id) VALUES (1, 'Big Burger', 12.99, 1); INSERT INTO menu_items (menu_item_id, name, price, restaurant_id) VALUES (2, 'Chicken Teriyaki', 15.99, 2); INSERT I... | What are the names and prices of the menu items that are not offered at any restaurant? | SELECT name, price FROM menu_items WHERE menu_item_id NOT IN (SELECT restaurant_id FROM restaurants); | gretelai_synthetic_text_to_sql |
CREATE TABLE ResidentialWaste (id INT, sector VARCHAR(20), waste_generation_rate FLOAT, population INT); INSERT INTO ResidentialWaste (id, sector, waste_generation_rate, population) VALUES (1, 'Residential', 1.2, 500000); | What is the average waste generation rate per capita in the 'Residential' sector? | SELECT AVG(waste_generation_rate) FROM ResidentialWaste WHERE sector = 'Residential'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE); INSERT INTO Spacecraft (id, name, country, launch_date) VALUES (1, 'Falcon 9', 'USA', '2010-06-04'); INSERT INTO Spacecraft (id, name, country, launch_date) VALUES (2, 'Soyuz-FG', 'Russia', '2001-11-02'); CREATE TABLE Satellite... | What is the name and type of all satellites launched by spacecraft from Russia? | SELECT s.name, s.type FROM Satellites s JOIN Spacecraft sp ON s.spacecraft_id = sp.id WHERE sp.country = 'Russia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, country TEXT, participants INT); INSERT INTO virtual_tours (tour_id, country, participants) VALUES (1, 'Japan', 200), (2, 'Japan', 300), (3, 'South Korea', 100); | Identify the number of virtual tours taken in Japan and South Korea. | SELECT SUM(participants) FROM virtual_tours WHERE country IN ('Japan', 'South Korea'); | 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.