context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Suppliers (SupplierID INT, Product VARCHAR(20), Quantity INT, Country VARCHAR(20)); INSERT INTO Suppliers VALUES (1, 'Organic Cotton', 100, 'Vietnam'); INSERT INTO Suppliers VALUES (2, 'Organic Cotton', 200, 'Vietnam'); INSERT INTO Suppliers VALUES (3, 'Organic Cotton', 150, 'Vietnam'); | Who are the top 3 suppliers of organic cotton to Vietnam? | SELECT SupplierID, Product, Quantity FROM Suppliers WHERE Product = 'Organic Cotton' AND Country = 'Vietnam' ORDER BY Quantity DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue(restaurant_id INT, sourcing_practices VARCHAR(255), revenue DECIMAL(10,2), revenue_date DATE); CREATE VIEW restaurant_region AS SELECT restaurant_id, 'Asia-Pacific' AS region FROM restaurant WHERE region = 'Asia-Pacific'; | What is the total revenue generated by restaurants with 'Organic' sourcing practices in the 'Asia-Pacific' region for the month of May 2022? | SELECT SUM(revenue) FROM restaurant_revenue INNER JOIN restaurant_region ON restaurant_revenue.restaurant_id = restaurant_region.restaurant_id WHERE sourcing_practices = 'Organic' AND revenue_date BETWEEN '2022-05-01' AND '2022-05-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Coaches (CoachID INT, Name VARCHAR(50), Sport VARCHAR(20), Age INT, Country VARCHAR(50)); INSERT INTO Coaches (CoachID, Name, Sport, Age, Country) VALUES (1, 'Jane Smith', 'Soccer', 45, 'England'), (2, 'Mateo Garcia', 'Basketball', 52, 'Argentina'), (3, 'Svetlana Petrova', 'Basketball', 48, 'Russia'); | Which coaches are older than 50 and coach basketball? | SELECT * FROM Coaches WHERE Age > 50 AND Sport = 'Basketball'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incarceration_records (id INT, facility_type TEXT, num_prior_offenses INT, incarceration_date DATE); | How many individuals have been incarcerated in the past month, broken down by the type of facility and the number of prior offenses? | SELECT facility_type, num_prior_offenses, COUNT(*) FROM incarceration_records WHERE incarceration_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY facility_type, num_prior_offenses; | gretelai_synthetic_text_to_sql |
CREATE TABLE freight_costs (freight_forwarder VARCHAR(20), total_cost DECIMAL(10,2)); INSERT INTO freight_costs (freight_forwarder, total_cost) VALUES ('FF1', 1000.00), ('FF2', 2000.00), ('FF3', 1500.00), ('FF4', 500.00), ('FF5', 2500.00); | What is the total cost for each freight forwarder? | SELECT freight_forwarder, total_cost FROM freight_costs; | gretelai_synthetic_text_to_sql |
CREATE TABLE Auto_Show (id INT, name VARCHAR(50), year INT, location VARCHAR(50), attendance INT); INSERT INTO Auto_Show (id, name, year, location, attendance) VALUES (1, 'New York Auto Show', 2022, 'USA', 500000), (2, 'Chicago Auto Show', 2022, 'USA', 300000), (3, 'Tokyo Auto Show', 2022, 'Japan', 700000), (4, 'Paris ... | Which auto shows had the highest attendance in 2022 and were not held in the USA? | SELECT name, attendance FROM Auto_Show WHERE year = 2022 AND location <> 'USA' ORDER BY attendance DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50));CREATE TABLE SustainableSourcing (SourcingID int, RestaurantID int, SourcingMethod varchar(50), TotalRevenue decimal(10,2)); | What is the total revenue for each sustainable sourcing method used by restaurant F for the quarter of Q1 2022? | SELECT SS.SourcingMethod, SUM(SS.TotalRevenue) as TotalRevenuePerMethod FROM SustainableSourcing SS INNER JOIN Restaurants R ON SS.RestaurantID = R.RestaurantID WHERE R.Name = 'F' AND QUARTER(SS.OrderDate) = 1 AND YEAR(SS.OrderDate) = 2022 GROUP BY SS.SourcingMethod; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investor_id INT, company_id INT, risk_score INT); INSERT INTO investments (investor_id, company_id, risk_score) VALUES (1, 1, 9), (2, 2, 7), (3, 3, 8); CREATE TABLE companies (id INT, risk_score INT); INSERT INTO companies (id, risk_score) VALUES (1, 10), (2, 6), (3, 8); | List all investors who have invested in companies with a high risk score (greater than 8). | SELECT DISTINCT i.name FROM investments AS i JOIN companies AS c ON i.company_id = c.id WHERE c.risk_score > 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_projects (project_id INT, area FLOAT, city_id INT, PRIMARY KEY (project_id)); INSERT INTO sustainable_projects (project_id, area, city_id) VALUES (1, 5000.0, 2), (2, 7000.0, 2), (3, 3000.0, 3); CREATE TABLE cities (city_id INT, city_name TEXT, PRIMARY KEY (city_id)); INSERT INTO cities (city_id... | What is the total area of sustainable urban projects in the city of "Chicago"? | SELECT SUM(area) FROM sustainable_projects JOIN cities ON sustainable_projects.city_id = cities.city_id WHERE cities.city_name = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (region VARCHAR(50), year INT, rate DECIMAL(4,2)); INSERT INTO recycling_rates (region, year, rate) VALUES ('Africa', 2020, 0.35), ('Asia', 2020, 0.47), ('Europe', 2020, 0.60), ('North America', 2020, 0.48), ('South America', 2020, 0.42), ('Oceania', 2020, 0.53); | Recycling rates for all regions in 2020? | SELECT region, rate FROM recycling_rates WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest_types (type_id INT, type_name VARCHAR(50)); INSERT INTO forest_types (type_id, type_name) VALUES (1, 'Pine'), (2, 'Oak'), (3, 'Maple'); CREATE TABLE carbon_sequestration (sequestration_id INT, type_id INT, year INT, sequestration DECIMAL(10,2)); INSERT INTO carbon_sequestration (sequestration_id, ty... | List all the forest types and their average carbon sequestration in 2019 | SELECT ft.type_name, AVG(cs.sequestration) as avg_sequestration FROM forest_types ft INNER JOIN carbon_sequestration cs ON ft.type_id = cs.type_id WHERE cs.year = 2019 GROUP BY ft.type_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, city VARCHAR(50), response_time INT); INSERT INTO emergency_calls (id, city, response_time) VALUES (1, 'Austin', 8); INSERT INTO emergency_calls (id, city, response_time) VALUES (2, 'Austin', 10); | What is the average response time for emergency calls in the city of Austin? | SELECT AVG(response_time) FROM emergency_calls WHERE city = 'Austin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT, crop_type VARCHAR(255), temperature FLOAT); INSERT INTO crops (id, crop_type, temperature) VALUES (1, 'corn', 20.5), (2, 'soybean', 18.3), (3, 'wheat', 16.7); | Find the average temperature for each crop type in the 'crops' table. | SELECT crop_type, AVG(temperature) FROM crops GROUP BY crop_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (id INT, name TEXT, location TEXT);CREATE TABLE production (mine_id INT, date DATE, quantity INT); INSERT INTO mine VALUES (1, 'Mine A', 'Country A'); INSERT INTO mine VALUES (2, 'Mine B', 'Country B'); INSERT INTO production VALUES (1, '2021-01-01', 100); INSERT INTO production VALUES (1, '2021-02-01... | Calculate the total quantity of gold mined by each mine in Q1 2021 | SELECT mine.name, SUM(production.quantity) AS total_qty FROM mine INNER JOIN production ON mine.id = production.mine_id WHERE production.date BETWEEN '2021-01-01' AND '2021-03-31' GROUP BY mine.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE philanthropy.donation_amount_by_cause (donation_id INT, donor_id INT, cause_id INT, donation_amount DECIMAL); | What is the maximum donation amount for each cause in the 'philanthropy.causes' table? | SELECT c.cause_name, MAX(dam.donation_amount) FROM philanthropy.causes c JOIN philanthropy.donation_amount_by_cause dam ON c.cause_id = dam.cause_id GROUP BY c.cause_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (student_id INT, name VARCHAR(50), gender VARCHAR(50)); INSERT INTO graduate_students (student_id, name, gender) VALUES (1, 'Alice', 'Female'), (2, 'Bob', 'Male'), (3, 'Carlos', 'Male'); CREATE TABLE research_grants (grant_id INT, student_id INT, amount INT); INSERT INTO research_grants (... | What is the total amount of research grants awarded to female graduate students? | SELECT SUM(rg.amount) FROM research_grants rg JOIN graduate_students gs ON rg.student_id = gs.student_id WHERE gs.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_pollution_control (id INT, initiative_name TEXT, region TEXT);INSERT INTO marine_pollution_control (id, initiative_name, region) VALUES (1, 'Ocean Cleanup Project', 'Arctic'), (2, 'Coastal Waste Management', 'Antarctic'), (3, 'Plastic Pollution Reduction', 'Atlantic'); | What is the total number of marine pollution control initiatives in the 'Arctic' and 'Antarctic' regions? | SELECT COUNT(*) FROM marine_pollution_control WHERE region IN ('Arctic', 'Antarctic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Department VARCHAR(50), Salary FLOAT); INSERT INTO Employees (EmployeeID, Name, Department, Salary) VALUES (1, 'John Doe', 'IT', 75000.00), (2, 'Jane Smith', 'IT', 80000.00), (3, 'Mike Johnson', 'HR', 60000.00); | List the top 2 employees with the highest salaries in the company. | SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY Salary DESC) AS rn, EmployeeID, Name, Department, Salary FROM Employees) t WHERE rn <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_streaming (user_id INT, song_id INT, duration FLOAT, date DATE); | How many users streamed a song per day in 'music_streaming' table? | SELECT date, COUNT(DISTINCT user_id) as users_per_day FROM music_streaming GROUP BY date ORDER BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtPieces (id INT, title VARCHAR(255), type VARCHAR(255), price DECIMAL(10,2), sale_year INT, artist_nationality VARCHAR(255)); INSERT INTO ArtPieces (id, title, type, price, sale_year, artist_nationality) VALUES (1, 'Pottery1', 'Pottery', 300, 2021, 'Canada - Indigenous'); | What is the average price of pottery from Indigenous artists in Canada? | SELECT AVG(price) FROM ArtPieces WHERE type = 'Pottery' AND artist_nationality LIKE '%Canada - Indigenous%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPersonnel (id INT, name VARCHAR(100), rank VARCHAR(50), service VARCHAR(50)); INSERT INTO MilitaryPersonnel (id, name, rank, service) VALUES (1, 'John Doe', 'Colonel', 'Air Force'); INSERT INTO MilitaryPersonnel (id, name, rank, service) VALUES (2, 'Jane Smith', 'Captain', 'Navy'); | What is the total number of military personnel in the 'Air Force'? | SELECT COUNT(*) FROM MilitaryPersonnel WHERE service = 'Air Force'; | gretelai_synthetic_text_to_sql |
CREATE TABLE loan (loan_id INT, client_id INT, age INT, loan_amount DECIMAL(10,2), loan_date DATE); INSERT INTO loan (loan_id, client_id, age, loan_amount, loan_date) VALUES (3, 3, 23, 6000.00, '2022-03-01'), (4, 4, 31, 8000.00, '2022-04-01'); | What is the total value of Shariah-compliant loans issued to clients in the age group 20-30, ordered by loan date? | SELECT SUM(loan_amount) total_loan_amount FROM loan WHERE age BETWEEN 20 AND 30 ORDER BY loan_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, name TEXT, country TEXT, hours FLOAT, quarter TEXT, year INT); INSERT INTO Volunteers (id, name, country, hours, quarter, year) VALUES (1, 'Alice', 'USA', 5.0, 'Q3', 2021), (2, 'Bob', 'Canada', 7.5, 'Q3', 2021), (3, 'Eve', 'Canada', 3.0, 'Q3', 2021), (4, 'Frank', 'USA', 6.0, 'Q2', 2021)... | What is the total number of volunteer hours contributed by volunteers in each quarter of 2021? | SELECT quarter, SUM(hours) FROM Volunteers GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(30), mass FLOAT); INSERT INTO Spacecraft (id, name, mass) VALUES (1, 'Apollo', 14000.0); INSERT INTO Spacecraft (id, name, mass) VALUES (2, 'Saturn V', 16000.0); INSERT INTO Spacecraft (id, name, mass) VALUES (3, 'Space Shuttle', 12000.0); | Identify spacecraft with mass above 16000 kg | SELECT name FROM Spacecraft WHERE mass > 16000; | gretelai_synthetic_text_to_sql |
CREATE TABLE PreRollPrices (state VARCHAR(255), price DECIMAL(10,2), product VARCHAR(255)); INSERT INTO PreRollPrices (state, price, product) VALUES ('CA', 7.5, 'Pre-roll'), ('CO', 6.5, 'Pre-roll'), ('OR', 8.0, 'Pre-roll'), ('WA', 7.0, 'Pre-roll'), ('NV', 8.5, 'Pre-roll'); | What is the average price of a pre-roll in each state, rounded to the nearest dollar? | SELECT state, ROUND(AVG(price)) as average_price FROM PreRollPrices WHERE product = 'Pre-roll' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_count (id INT, vehicle_make VARCHAR(50), mpg INT, is_domestic BOOLEAN); INSERT INTO vehicle_count (id, vehicle_make, mpg, is_domestic) VALUES (1, 'Toyota', 32, false), (2, 'Honda', 35, false), (3, 'Ford', 31, true), (4, 'Chevy', 28, true), (5, 'Tesla', null, true); | Count the number of domestic and foreign vehicles, with a minimum mpg of 30 | SELECT is_domestic, COUNT(*) as count FROM vehicle_count WHERE mpg >= 30 GROUP BY is_domestic; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists phishing_targets (target_id INT, target_name VARCHAR, attack_count INT); INSERT INTO phishing_targets (target_id, target_name, attack_count) VALUES (1, 'David', 12), (2, 'Eva', 18), (3, 'Frank', 8); | Who are the top 3 targets of phishing attacks in the current month and their total number of attacks? | SELECT target_id, target_name, SUM(attack_count) as total_attacks FROM phishing_targets WHERE attack_date >= DATEADD(month, 0, GETDATE()) AND target_name IN ('David', 'Eva', 'Frank') GROUP BY target_id, target_name ORDER BY total_attacks DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name TEXT, well_depth FLOAT, drill_year INT, region TEXT); INSERT INTO wells (well_id, well_name, well_depth, drill_year, region) VALUES (1, 'Well A', 10000, 2018, 'Caspian Sea'), (2, 'Well B', 15000, 2019, 'Caspian Sea'), (3, 'Well C', 8000, 2020, 'Caspian Sea'); | What is the average well depth for wells in the Caspian Sea, grouped by the year they were drilled? | SELECT drill_year, AVG(well_depth) as avg_well_depth FROM wells WHERE region = 'Caspian Sea' GROUP BY drill_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_trends (content_id INT, user_id INT, user_country VARCHAR(50), user_engagement INT, engagement_date DATE); | Find the number of unique users who have engaged with content in 'content_trends' table for the last week? | SELECT COUNT(DISTINCT user_id) FROM content_trends WHERE engagement_date >= CURDATE() - INTERVAL 7 DAY AND user_engagement > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditures (country VARCHAR(50), industry VARCHAR(50), amount NUMERIC, year INT); INSERT INTO rd_expenditures (country, industry, amount, year) VALUES ('USA', 'Pharmaceuticals', 80000, 2020), ('Germany', 'Pharmaceuticals', 55000, 2020), ('Japan', 'Pharmaceuticals', 42000, 2020); | What are the top 3 countries with the highest R&D expenditures in the pharmaceuticals industry in 2020? | SELECT country, SUM(amount) AS total_expenditure FROM rd_expenditures WHERE industry = 'Pharmaceuticals' AND year = 2020 GROUP BY country ORDER BY total_expenditure DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (id INT, project_name VARCHAR(50), location VARCHAR(50), budget DECIMAL(10,2)); INSERT INTO infrastructure_projects (id, project_name, location, budget) VALUES (1, 'Highway 101 Expansion', 'California', 5000000), (2, 'Bridge Replacement', 'New York', 3000000), (3, 'Transit System Up... | What is the minimum budget for an infrastructure project? | SELECT MIN(budget) as min_budget FROM infrastructure_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), investment FLOAT); CREATE TABLE fund_investments (client_id INT, fund_name VARCHAR(50), investment FLOAT); | How many clients have an investment greater than $3,000 in the "Equity" fund? | SELECT COUNT(DISTINCT clients.client_id) FROM clients INNER JOIN fund_investments ON clients.client_id = fund_investments.client_id WHERE clients.investment > 3000 AND fund_investments.fund_name = 'Equity'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, name VARCHAR(255), type VARCHAR(255), location VARCHAR(255), resilience_score INT); CREATE TABLE Maintenance (id INT, infrastructure_id INT, maintenance_date DATE); INSERT INTO Infrastructure (id, name, type, location, resilience_score) VALUES (1, 'Road A', 'Road', 'New York', 55); ... | Find the names and maintenance dates of structures in New York with resilience scores below 60 | SELECT Infrastructure.name, Maintenance.maintenance_date FROM Infrastructure INNER JOIN Maintenance ON Infrastructure.id = Maintenance.infrastructure_id WHERE Infrastructure.location = 'New York' AND Infrastructure.resilience_score < 60; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_followers(username VARCHAR(30), region VARCHAR(20), followers INT, follow_date DATE); INSERT INTO user_followers(username, region, followers, follow_date) VALUES('Obi', 'Africa', 1000, '2021-10-01'), ('Pat', 'Africa', 1200, '2021-10-02'), ('Quin', 'Africa', 1400, '2021-10-03'), ('Ria', 'Africa', 1600,... | Who is the user with the most followers in Africa in the last week? | SELECT username, MAX(followers) as max_followers FROM (SELECT username, followers, ROW_NUMBER() OVER (PARTITION BY username ORDER BY follow_date DESC) as rn FROM user_followers WHERE region = 'Africa' AND follow_date >= DATEADD(week, -1, CURRENT_DATE)) t GROUP BY username | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(50), email VARCHAR(50), subscribed_to_newsletter BOOLEAN); | Update the email addresses of users who have subscribed to the newsletter in the last week in the users table | UPDATE users SET email = CONCAT(email, '_new') WHERE subscribed_to_newsletter = true AND signup_date > DATE_SUB(CURDATE(), INTERVAL 1 WEEK); | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(255)); CREATE TABLE mental_health_training (id INT, student_id INT, completed_date DATE); INSERT INTO students (id, name) VALUES (1, 'Student A'), (2, 'Student B'), (3, 'Student C'); INSERT INTO mental_health_training (id, student_id, completed_date) VALUES (1, 1, '2021-06-01... | Which students have not completed their mandatory mental health training? | SELECT s.name FROM students s LEFT JOIN mental_health_training m ON s.id = m.student_id WHERE m.completed_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE FrenchMunicipalities (municipality VARCHAR(50), recycling_rate FLOAT); INSERT INTO FrenchMunicipalities (municipality, recycling_rate) VALUES ('Paris', 28.5), ('Lyon', 35.7), ('Marseille', 29.6), ('Toulouse', 32.8), ('Nice', 31.2); | How many municipalities in France have a recycling rate below 30%? | SELECT COUNT(*) FROM FrenchMunicipalities WHERE recycling_rate < 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE NFL_Matches (MatchID INT, HomeTeam VARCHAR(50), AwayTeam VARCHAR(50), HomeTeamScore INT, AwayTeamScore INT); INSERT INTO NFL_Matches (MatchID, HomeTeam, AwayTeam, HomeTeamScore, AwayTeamScore) VALUES (1, 'Chicago Bears', 'Washington Redskins', 73, 0); | What is the highest number of points scored in a single game in NFL history? | SELECT MAX(HomeTeamScore + AwayTeamScore) FROM NFL_Matches; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (claim_number INT, policy_number INT, claim_amount INT, claim_date DATE); INSERT INTO claims (claim_number, policy_number, claim_amount, claim_date) VALUES (1, 8, 1000, '2018-06-20'); INSERT INTO claims (claim_number, policy_number, claim_amount, claim_date) VALUES (2, 8, 2000, '2019-01-01'); | Delete all claim records for policy number 8 from the claims table | DELETE FROM claims WHERE policy_number = 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthFacilities (Id INT, State VARCHAR(255), HealthEquityRating INT); INSERT INTO MentalHealthFacilities (Id, State, HealthEquityRating) VALUES (1, 'California', 9); INSERT INTO MentalHealthFacilities (Id, State, HealthEquityRating) VALUES (2, 'Texas', 7); INSERT INTO MentalHealthFacilities (Id, Sta... | What is the total number of mental health facilities in each state that have a health equity rating below 5? | SELECT State, COUNT(*) FROM MentalHealthFacilities WHERE HealthEquityRating < 5 GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE RecyclingCenters (region VARCHAR(50), center_id INT); INSERT INTO RecyclingCenters (region, center_id) VALUES ('Region1', 101), ('Region1', 102), ('Region2', 201), ('Region2', 202), ('Region2', 203); | How many recycling centers are there in each region? | SELECT region, COUNT(DISTINCT center_id) FROM RecyclingCenters GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE IntelligenceOperations (ID INT, Country VARCHAR(20), Operation VARCHAR(50), Year INT); INSERT INTO IntelligenceOperations (ID, Country, Operation, Year) VALUES (1, 'India', 'Operation Rainbow', 2016); | What are the intelligence operations undertaken by India since 2015? | SELECT Operation, Year FROM IntelligenceOperations WHERE Country = 'India' AND Year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_deliveries (delivery_id INT, item_count INT, delivery_date DATE, city VARCHAR(50)); INSERT INTO city_deliveries (delivery_id, item_count, delivery_date, city) VALUES (1, 10, '2021-01-01', 'New York'), (2, 20, '2021-01-02', 'Los Angeles'); | What is the average number of items delivered per day for 'city_deliveries' table for 'North America' in Q1 2021? | SELECT AVG(item_count) FROM city_deliveries WHERE EXTRACT(QUARTER FROM delivery_date) = 1 AND city = 'North America' GROUP BY delivery_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, employee_name TEXT, gender TEXT, job_title TEXT); | Get the number of employees by gender and job_title from the "employees" table | SELECT gender, job_title, COUNT(*) as count FROM employees GROUP BY gender, job_title; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, founder_gender TEXT, industry TEXT, exit_strategy TEXT); | What is the total number of startups founded by women in the healthcare industry that have had a successful exit strategy? | SELECT COUNT(DISTINCT id) FROM startups WHERE founder_gender = 'Female' AND industry = 'Healthcare' AND exit_strategy = 'Successful'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, City TEXT); INSERT INTO Volunteers (VolunteerID, City) VALUES (1, 'New York'), (2, 'Toronto'), (3, 'Los Angeles'), (4, 'New York'); | How many unique cities are associated with volunteers? | SELECT COUNT(DISTINCT City) FROM Volunteers; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(100), country VARCHAR(50)); INSERT INTO suppliers (id, name, country) VALUES (1, 'supplierA', 'USA'), (2, 'supplierB', 'Canada'); | Delete all records from the "suppliers" table where the "country" is "USA" | DELETE FROM suppliers WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(255), nationality VARCHAR(255)); INSERT INTO Artists (id, name, nationality) VALUES (1, 'Pablo Picasso', 'Spain'); | How many artworks were created by artists from Spain in the 'Artists' table? | SELECT COUNT(*) FROM Artists WHERE nationality = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_recycling (year INT, month INT, sector VARCHAR(20), recycling_volume FLOAT); INSERT INTO wastewater_recycling (year, month, sector, recycling_volume) VALUES (2021, 8, 'commercial', 10000); | How much water was recycled from the wastewater treatment plant in the commercial sector in August 2021? | SELECT recycling_volume FROM wastewater_recycling WHERE year = 2021 AND month = 8 AND sector = 'commercial'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_production_7 (site VARCHAR(10), chemical VARCHAR(10), quantity INT); INSERT INTO chemical_production_7 VALUES ('I', 'G', 800), ('I', 'H', 900), ('J', 'I', 1000), ('J', 'J', 1100), ('K', 'K', 1200); | What is the total production quantity for chemical 'G' in site 'I'? | SELECT SUM(quantity) FROM chemical_production_7 WHERE site = 'I' AND chemical = 'G'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_code CHAR(3), port_name VARCHAR(20)); INSERT INTO ports (port_code, port_name) VALUES ('LA', 'Los Angeles'); CREATE TABLE carriers (carrier_code CHAR(3), carrier_name VARCHAR(20)); INSERT INTO carriers (carrier_code, carrier_name) VALUES ('ABC', 'ABC Shipping'); CREATE TABLE shipments (carrier_... | What are the total quantities of goods shipped from port 'LA' grouped by carrier? | SELECT carriers.carrier_name, SUM(shipments.quantity) as total_quantity FROM shipments JOIN ports ON shipments.port_code = ports.port_code JOIN carriers ON shipments.carrier_code = carriers.carrier_code WHERE ports.port_name = 'LA' GROUP BY carriers.carrier_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty(faculty_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(20)); INSERT INTO faculty VALUES (1, 'Ella', 'Female', 'Physics'); INSERT INTO faculty VALUES (2, 'Frank', 'Male', 'Physics'); CREATE TABLE research_grants(grant_id INT, faculty_id INT, amount DECIMAL(10, 2)); INSERT INTO rese... | Calculate the average research grant amount for male faculty members in the Physics department | SELECT AVG(amount) FROM faculty f INNER JOIN research_grants g ON f.faculty_id = g.faculty_id WHERE f.gender = 'Male' AND f.department = 'Physics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(50), disability_type VARCHAR(50), accommodation_provided VARCHAR(50), accommodation_date DATE); | Add a new student with hearing impairment, ID 8 | INSERT INTO students (id, name, disability_type, accommodation_provided, accommodation_date) VALUES (8, 'Oliver Lee', 'Hearing Impairment', 'Sign Language Interpreter', '2022-08-15'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists engineering;CREATE TABLE if not exists engineering.projects(id INT, name TEXT, lead_researcher TEXT, project_type TEXT);INSERT INTO engineering.projects (id, name, lead_researcher, project_type) VALUES (1, 'ProjectX', 'Dr. Ahmed Khan', 'Bioprocess Engineering'), (2, 'ProjectY', 'Dr. Maria Ro... | Who are the lead researchers for bioprocess engineering projects? | SELECT lead_researcher FROM engineering.projects WHERE project_type = 'Bioprocess Engineering'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fantasy_Force (player_id INT, player_name VARCHAR(50), score INT); INSERT INTO Fantasy_Force (player_id, player_name, score) VALUES (1, 'Peter Kim', 1200), (2, 'Olivia Johnson', 1400), (3, 'William Brown', 1500); | What is the minimum score achieved by players with the last name 'Kim' or 'Johnson' in the game 'Fantasy Force'? | SELECT MIN(score) FROM Fantasy_Force WHERE player_name LIKE '%Kim%' OR player_name LIKE '%Johnson%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, region VARCHAR(10), billing_amount INT); INSERT INTO cases (id, region, billing_amount) VALUES (1, 'Eastern', 5000), (2, 'Western', 7000), (3, 'Eastern', 6000), (4, 'Southern', 8000), (5, 'Southern', 4000); | What is the total billing amount for cases in the 'Southern' region, excluding cases with a billing amount less than $5000? | SELECT SUM(billing_amount) FROM cases WHERE region = 'Southern' AND billing_amount > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (title varchar(255), release_year int, IMDb_rating float, director_gender varchar(10), director_ethnicity varchar(25)); INSERT INTO movies (title, release_year, IMDb_rating, director_gender, director_ethnicity) VALUES ('The Farewell', 2019, 7.6, 'Female', 'Asian-American'); INSERT INTO movies (title... | Which movies directed by Asian-American women received a rating above 7.5 on IMDb? | SELECT title FROM movies WHERE director_gender = 'Female' AND director_ethnicity = 'Asian-American' AND IMDb_rating > 7.5; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA seas; CREATE TABLE fish_farms (id INT, size FLOAT, location VARCHAR(50)); INSERT INTO fish_farms (id, size, location) VALUES (1, 22.2, 'atlantic ocean'), (2, 31.5, 'pacific ocean'), (3, 45.3, 'caribbean sea'); | What is the average size of fish farms in 'seas' schema located in 'americas'? | SELECT AVG(size) FROM seas.fish_farms WHERE location LIKE '%americas%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tuberculosis (CaseID INT, PatientAge INT, Date DATE); INSERT INTO Tuberculosis (CaseID, PatientAge, Date) VALUES (1, 30, '2021-10-01'); | What is the total number of tuberculosis cases, broken down by the age group of the patients? | SELECT CASE WHEN PatientAge < 18 THEN 'Under 18' ELSE '18 and Over' END AS AgeGroup, COUNT(*) FROM Tuberculosis GROUP BY AgeGroup; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50)); INSERT INTO teams (team_id, team_name) VALUES (1, 'Warriors'); CREATE TABLE games (game_id INT, home_team_id INT, away_team_id INT, home_team_score INT, away_team_score INT, home_team_rebounds INT, away_team_rebounds INT); INSERT INTO games (game_id, home_team_id... | What is the average number of rebounds per game for the Warriors? | SELECT AVG(home_team_rebounds + away_team_rebounds) as avg_rebounds FROM games WHERE home_team_id = (SELECT team_id FROM teams WHERE team_name = 'Warriors') OR away_team_id = (SELECT team_id FROM teams WHERE team_name = 'Warriors'); | gretelai_synthetic_text_to_sql |
CREATE TABLE therapists (therapist_id INT, experience INT, name VARCHAR(50), gender VARCHAR(20)); INSERT INTO therapists (therapist_id, experience, name, gender) VALUES (1, 7, 'Alice', 'Female'); CREATE TABLE treatments (treatment_id INT, therapist_id INT, patient_id INT, therapy_type VARCHAR(50), duration INT, success... | What is the success rate of therapy sessions conducted by male therapists? | SELECT COUNT(treatments.treatment_id) / COUNT(DISTINCT therapists.therapist_id) FROM therapists JOIN treatments ON therapists.therapist_id = treatments.therapist_id WHERE therapists.gender = 'Male' AND treatments.success = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE skincare_sales (country VARCHAR(255), product VARCHAR(255), sale_date DATE, sales_quantity INT); INSERT INTO skincare_sales (country, product, sale_date, sales_quantity) VALUES ('USA', 'Organic Cleanser', '2021-01-01', 1000), ('Canada', 'Organic Moisturizer', '2021-01-02', 750); | List the top 5 countries with the highest sales of organic skincare products in 2021 | SELECT country, SUM(sales_quantity) FROM skincare_sales WHERE product LIKE 'Organic%' GROUP BY country ORDER BY SUM(sales_quantity) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (id INT, name TEXT, type TEXT); INSERT INTO Projects (id, name, type) VALUES (1, 'Highway Construction', 'Road'), (2, 'Dam Construction', 'Water'), (3, 'Bridge Construction', 'Road'); | Show the number of construction projects for each project type in the database. | SELECT type, COUNT(*) FROM Projects GROUP BY type | gretelai_synthetic_text_to_sql |
CREATE TABLE RetailerProducts (RetailerID int, ProductID int); | How many unique retailers sell each eco-friendly material product? | SELECT ProductID, COUNT(DISTINCT RetailerID) AS RetailerCount FROM RetailerProducts GROUP BY ProductID; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(255)); CREATE TABLE posts (id INT, user_id INT, page_name VARCHAR(255), content TEXT); CREATE TABLE likes (id INT, user_id INT, post_id INT); CREATE TABLE hashtags (id INT, post_id INT, tag VARCHAR(255)); | Which users liked posts with hashtag #music and interacted with posts from the 'music' page? | SELECT DISTINCT users.id, users.name FROM users JOIN likes ON users.id = likes.user_id JOIN posts ON likes.post_id = posts.id JOIN hashtags ON posts.id = hashtags.post_id WHERE hashtags.tag = 'music' AND posts.page_name = 'music'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA mental_health; USE mental_health; CREATE TABLE patients (patient_id INT, diagnosis VARCHAR(50), age INT, country VARCHAR(50)); CREATE TABLE treatments (treatment_id INT, patient_id INT, treatment_type VARCHAR(50), treatment_date DATE, country VARCHAR(50)); INSERT INTO patients VALUES (7, 'PTSD', 32, 'Aust... | What is the average age of patients who were treated with medication in Australia? | SELECT AVG(patients.age) FROM patients JOIN treatments ON patients.patient_id = treatments.patient_id WHERE treatments.treatment_type = 'medication' AND patients.country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (title VARCHAR(255), genre VARCHAR(50), budget INT, rating INT); INSERT INTO tv_shows (title, genre, budget, rating) VALUES ('Show1', 'Comedy', 6000000, 6), ('Show2', 'Drama', 4000000, 8), ('Show3', 'Action', 15000000, 5); | Delete all TV shows with a budget over 10 million and a rating below 6 | DELETE FROM tv_shows WHERE budget > 10000000 AND rating < 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE visits (visit_id INT, patient_id INT, visit_date DATE, visit_type VARCHAR(20), location VARCHAR(20)); INSERT INTO visits (visit_id, patient_id, visit_date, visit_type, location) VALUES (1, 1, '2022-01-01', 'Mental Health', 'Urban'), (2, 2, '2022-02-01', 'Mental Health', 'Rural'), (3, 3, '2022-03-01', 'Ment... | What is the total number of mental health visits in urban areas, compared to rural areas, in the past year? | SELECT SUM(CASE WHEN location = 'Urban' THEN 1 ELSE 0 END) AS urban_visits, SUM(CASE WHEN location = 'Rural' THEN 1 ELSE 0 END) AS rural_visits FROM visits WHERE visit_date BETWEEN '2021-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(255), type VARCHAR(255), price DECIMAL(5,2)); INSERT INTO menus (menu_id, menu_name, type, price) VALUES (1, 'Quinoa Salad', 'Vegetarian', 12.99), (2, 'Margherita Pizza', 'Non-Vegetarian', 9.99), (3, 'Falafel Wrap', 'Vegetarian', 8.99), (4, 'Steak Sandwich', 'Non-Veget... | What is the maximum price of vegetarian menu items? | SELECT MAX(price) FROM menus WHERE type = 'Vegetarian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ClothingItems (ItemID INT, ItemName TEXT, Color TEXT, Price INT); INSERT INTO ClothingItems (ItemID, ItemName, Color, Price) VALUES (1, 'Top', 'Red', 50), (2, 'Pants', 'Blue', 30), (3, 'Dress', 'Green', 75); | What is the average price of clothing sold in each color? | SELECT Color, AVG(Price) as AvgPrice FROM ClothingItems GROUP BY Color; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, gender TEXT, condition TEXT, therapy_type TEXT, therapy_start_date DATE); INSERT INTO patients (patient_id, age, gender, condition, therapy_type, therapy_start_date) VALUES (1, 35, 'Female', 'Depression', 'CBT', '2022-06-01'); INSERT INTO patients (patient_id, age, gender... | What is the number of patients with depression who received therapy in the last 6 months? | SELECT COUNT(*) FROM patients WHERE condition = 'Depression' AND therapy_start_date >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists city; CREATE TABLE if not exists city.emergency_responses (id INT, response_time TIME); INSERT INTO city.emergency_responses (id, response_time) VALUES (1, '01:34:00'), (2, '02:15:00'), (3, '01:52:00'); | What is the average response time for emergency calls in the 'city' schema? | SELECT AVG(TIME_TO_SEC(response_time)) FROM city.emergency_responses; | gretelai_synthetic_text_to_sql |
CREATE TABLE workouts (workout_id INT, member_id INT, device VARCHAR(20), distance FLOAT, date DATE); INSERT INTO workouts VALUES (8,12,'Fitbit',5.6,'2022-03-05'); INSERT INTO workouts VALUES (9,13,'Garmin',7.2,'2022-03-10'); | What is the total distance covered by members who use a specific wearable device in the past week? | SELECT SUM(workouts.distance) FROM workouts WHERE workouts.device = 'Fitbit' AND workouts.date >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE IndianOceanProjects (organization TEXT, project_name TEXT); INSERT INTO IndianOceanProjects (organization, project_name) VALUES ('National Oceanic and Atmospheric Administration', 'Oceanic Observations'), ('UNESCO', 'Marine Life Protection'), ('Greenpeace', 'Ocean Plastic Reduction'); CREATE TABLE Organiza... | How many marine research projects were conducted in the Indian Ocean by each organization? | SELECT Organizations.organization, Organizations.research_count FROM Organizations INNER JOIN IndianOceanProjects ON Organizations.organization = IndianOceanProjects.organization WHERE IndianOceanProjects.project_name LIKE '%Indian Ocean%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE open_pedagogy_projects (project_id INT, institution_id INT, project_status VARCHAR(10)); | What is the total number of open pedagogy projects per institution? | SELECT institution_id, COUNT(project_id) FROM open_pedagogy_projects WHERE project_status = 'completed' GROUP BY institution_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (supplier_id INT, name VARCHAR(255), country VARCHAR(255), transportation_cost FLOAT); INSERT INTO Suppliers (supplier_id, name, country, transportation_cost) VALUES (1, 'FairTradeAfrica', 'Kenya', 200.0), (2, 'EcoFriendlyAsia', 'China', 350.0), (3, 'GreenEurope', 'Germany', 120.0); | Find the average transportation cost for suppliers from Africa. | SELECT AVG(Suppliers.transportation_cost) FROM Suppliers WHERE Suppliers.country IN ('Kenya', 'Nigeria', 'SouthAfrica'); | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerSignups (VolunteerSignupID INT, VolunteerID INT, SignUpDate DATE); INSERT INTO VolunteerSignups (VolunteerSignupID, VolunteerID, SignUpDate) VALUES (1, 1, '2023-01-05'), (2, 2, '2023-04-10'), (3, 3, '2023-07-20'); | How many volunteers signed up in H1 and H2 of 2023? | SELECT CONCAT('H', FLOOR(MONTH(SignUpDate) / 6)) AS Half, COUNT(*) as VolunteerCount FROM VolunteerSignups WHERE YEAR(SignUpDate) = 2023 GROUP BY Half; | gretelai_synthetic_text_to_sql |
CREATE TABLE Art_Categories(art_id INT, category VARCHAR(20)); INSERT INTO Art_Categories VALUES (1, 'Impressionism'), (2, 'Renaissance'), (3, 'Impressionism'), (4, 'Renaissance'), (5, 'Baroque'), (6, 'Modern Art'), (7, 'Impressionism'), (8, 'Cubism'); CREATE TABLE Artworks(art_id INT, art_name VARCHAR(20), art_categ... | List all 'Impressionist' artworks that are not in the 'Modern Art' category. | SELECT art_name FROM Artworks WHERE art_category = 'Impressionism' AND art_id NOT IN (SELECT art_id FROM Art_Categories WHERE category = 'Modern Art'); | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai_research (research_id INT PRIMARY KEY, contributor_name VARCHAR(255), contribution_date DATE); | Who are the top 5 contributors to explainable AI research in the past 12 months? | SELECT contributor_name, COUNT(*) AS contribution_count FROM explainable_ai_research WHERE contribution_date >= DATE_SUB(CURRENT_DATE, INTERVAL 12 MONTH) GROUP BY contributor_name ORDER BY contribution_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE disability_accommodations_org (accom_id INT, accom_name TEXT, budget DECIMAL(10,2), org_id INT);CREATE TABLE organizations (org_id INT, org_name TEXT); | What is the average budget allocation for disability accommodations by organization? | SELECT o.org_name, AVG(da.budget) AS avg_budget FROM disability_accommodations_org da INNER JOIN organizations o ON da.org_id = o.org_id GROUP BY o.org_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_plants (id INT PRIMARY KEY, country VARCHAR(50), name VARCHAR(50), capacity FLOAT); INSERT INTO solar_plants (id, country, name, capacity) VALUES (1, 'South Africa', 'Solar Plant A', 25.5), (2, 'South Africa', 'Solar Plant B', 30.6); | How many solar power plants are in South Africa? | SELECT COUNT(*) FROM solar_plants WHERE country = 'South Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_responses (id INT, incident_type VARCHAR(50), status VARCHAR(20), responded_by VARCHAR(100)); INSERT INTO incident_responses (id, incident_type, status, responded_by) VALUES (1, 'Phishing', 'Resolved', 'Security Analyst 1'), (2, 'Malware', 'In Progress', 'Security Analyst 2'); | What is the total number of security incidents in the 'incident_responses' table? | SELECT COUNT(*) FROM incident_responses; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), supply_chain VARCHAR(20)); INSERT INTO products (product_id, product_name, supply_chain) VALUES (1, 'Shoes', 'Circular'), (2, 'Shirt', 'Linear'), (3, 'Jacket', 'Circular'); | List all products with circular supply chains? | SELECT * FROM products WHERE supply_chain = 'Circular'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workplaces (id INT, name TEXT, state TEXT, safety_violation BOOLEAN); | Insert a new record for a workplace in the state of Washington with safety violations. | INSERT INTO workplaces (id, name, state, safety_violation) VALUES (1, 'OPQ Company', 'Washington', true); | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INT, name TEXT, coastline TEXT); INSERT INTO country (id, name, coastline) VALUES (1, 'Russia', 'Arctic Ocean'); INSERT INTO country (id, name, coastline) VALUES (2, 'Canada', 'Atlantic Ocean'); | How many countries have a coastline along the Arctic Ocean? | SELECT COUNT(*) FROM country WHERE coastline = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy(country VARCHAR(20), sector VARCHAR(20), percentage DECIMAL(5,4)); INSERT INTO circular_economy VALUES ('Germany', 'Waste Management', 0.75), ('France', 'Waste Management', 0.60); | What is the percentage of circular economy initiatives in the waste management sector in Germany and France?' | SELECT country, AVG(percentage) FROM circular_economy WHERE country IN ('Germany', 'France') AND sector = 'Waste Management' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE european_health_conditions (id INT, name VARCHAR(255), patients INT); INSERT INTO european_health_conditions (id, name, patients) VALUES (1, 'Stress Disorder', 45000); INSERT INTO european_health_conditions (id, name, patients) VALUES (2, 'PTSD', 70000); INSERT INTO european_health_conditions (id, name, pa... | What are the mental health conditions with a patient count greater than 50000 in Europe? | SELECT name FROM european_health_conditions WHERE patients > 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiverseCompanies (id INT, name TEXT, country TEXT); CREATE TABLE InnovationAwards (id INT, company_id INT, award_type TEXT); INSERT INTO DiverseCompanies (id, name, country) VALUES (1, 'African Co', 'South Africa'); INSERT INTO DiverseCompanies (id, name, country) VALUES (2, 'Southeast Asian Co', 'Indonesi... | List the names of companies founded in Africa or Southeast Asia that have received innovation awards. | SELECT DiverseCompanies.name FROM DiverseCompanies INNER JOIN InnovationAwards ON DiverseCompanies.id = InnovationAwards.company_id WHERE DiverseCompanies.country IN ('South Africa', 'Indonesia', 'Malaysia', 'Vietnam', 'Thailand') AND (InnovationAwards.award_type = 'Technology' OR InnovationAwards.award_type = 'Design'... | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_heritage_sites (site_id INT, name VARCHAR(255), location VARCHAR(255), type VARCHAR(255), virtual_tour_id INT); INSERT INTO cultural_heritage_sites (site_id, name, location, type, virtual_tour_id) VALUES (1, 'Acropolis', 'Athens', 'Archaeological', 1001), (2, 'Colosseum', 'Rome', 'Archaeological',... | What is the average number of cultural heritage sites visited per virtual tour? | SELECT AVG(ct.num_visits) FROM (SELECT c.virtual_tour_id, COUNT(*) AS num_visits FROM cultural_heritage_sites c GROUP BY c.virtual_tour_id) ct; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavations (id INT, location VARCHAR(255)); INSERT INTO excavations (id, location) VALUES (1, 'Nigeria'), (2, 'Australia'), (3, 'USA'); | List unique artifact types present in excavation sites from Africa or Oceania. | SELECT DISTINCT a.artifact_type FROM artifacts a INNER JOIN excavations e ON a.excavation_id = e.id WHERE e.location IN ('Africa%', 'Oceania%'); | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (site_id INT, site_name VARCHAR(50), country VARCHAR(50)); INSERT INTO excavation_sites (site_id, site_name, country) VALUES (1, 'Site A', 'USA'); CREATE TABLE artifacts (artifact_id INT, site_id INT, weight DECIMAL(5,2), excavation_date DATE); | What was the total weight of artifacts excavated per year? | SELECT e.site_name, EXTRACT(YEAR FROM a.excavation_date) as excavation_year, SUM(a.weight) as total_weight FROM excavation_sites e JOIN artifacts a ON e.site_id = a.site_id GROUP BY e.site_id, e.site_name, excavation_year ORDER BY total_weight DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, founder1 TEXT, founder2 TEXT, funding FLOAT); INSERT INTO startups (id, name, founder1, founder2, funding) VALUES (1, 'Acme', 'John Doe', 'Jane Smith', 500000.00); INSERT INTO startups (id, name, founder1, founder2, funding) VALUES (2, 'Beta Corp', 'Jane Smith', 'John Doe', 750... | List the names of all startups that have received funding and have diverse founding teams (more than one founder with different genders). | SELECT name FROM startups WHERE (founder1 != founder2) AND (founder1 IS NOT NULL AND founder2 IS NOT NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vendors (vid INT, name TEXT);CREATE TABLE Products (pid INT, name TEXT, vendor_id INT, calorie_content INT);INSERT INTO Vendors VALUES (1, 'VendorA');INSERT INTO Products VALUES (1, 'ProductA', 1, 500); | What is the name of the vendor with the highest total calorie content of products? | SELECT Vendors.name FROM Vendors INNER JOIN (SELECT vendor_id, SUM(calorie_content) AS total_calories FROM Products GROUP BY vendor_id ORDER BY total_calories DESC LIMIT 1) AS Subquery ON Vendors.vid = Subquery.vendor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty(faculty_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(20)); INSERT INTO faculty VALUES (1, 'Kai', 'Non-binary', 'Biology'); INSERT INTO faculty VALUES (2, 'Lena', 'Female', 'Biology'); CREATE TABLE research_grants(grant_id INT, faculty_id INT, amount DECIMAL(10, 2)); INSERT INTO ... | Calculate the average research grant amount for faculty members in the Biology department | SELECT AVG(amount) FROM faculty f INNER JOIN research_grants g ON f.faculty_id = g.faculty_id WHERE f.department = 'Biology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildings (building_id INT, building_name VARCHAR(255), country VARCHAR(255), building_type VARCHAR(255), emissions_reduction FLOAT); | What is the average emissions reduction for green building projects in South Korea for each building type category? | SELECT building_type, AVG(emissions_reduction) FROM GreenBuildings WHERE country = 'South Korea' GROUP BY building_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtistDemographics (artist VARCHAR(255), age INT, festival VARCHAR(255), year INT); CREATE VIEW CoachellaArtists AS SELECT * FROM ArtistDemographics WHERE festival = 'Coachella'; | What is the average age of artists who performed at Coachella from 2015-2019? | SELECT AVG(age) FROM CoachellaArtists WHERE year BETWEEN 2015 AND 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Forestry (country VARCHAR(255), species VARCHAR(255), volume INT); INSERT INTO Forestry (country, species, volume) VALUES ('Canada', 'Pine', 1200), ('Canada', 'Spruce', 1500), ('US', 'Oak', 2000), ('US', 'Maple', 1800); | What is the total volume of timber harvested by country and tree species? | SELECT country, species, SUM(volume) as total_volume FROM Forestry GROUP BY country, species; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, region VARCHAR(50), revenue INT); | What is the total revenue generated from sales in each region, ordered by the total revenue? | SELECT region, SUM(revenue) AS total_revenue FROM sales GROUP BY region ORDER BY total_revenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (ticket_sale_id INT, team_id INT, sale_quarter INT, sale_year INT, quantity INT, sale_price DECIMAL(10,2)); CREATE TABLE teams (team_id INT, team_name VARCHAR(255), sport_id INT); CREATE TABLE sports (sport_id INT, sport_name VARCHAR(255)); INSERT INTO ticket_sales VALUES (1, 101, 1, 2020, 50,... | Calculate the total ticket revenue for each sport, split by quarter and year. | SELECT sp.sport_name, sale_year, sale_quarter, SUM(quantity * sale_price) as total_revenue FROM ticket_sales ts JOIN teams t ON ts.team_id = t.team_id JOIN sports sp ON t.sport_id = sp.sport_id GROUP BY sp.sport_name, sale_year, sale_quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (country VARCHAR(50), event VARCHAR(50)); INSERT INTO defense_diplomacy (country, event) VALUES ('USA', 'Defense Summit'), ('USA', 'Military Diplomacy Conference'), ('China', 'Defense and Security Forum'), ('Russia', 'Military Cooperation Talks'), ('France', 'Defense Ministers Meeting'), ... | What is the number of defense diplomacy events held by each country in the UN Security Council? | SELECT de.country, COUNT(de.event) FROM defense_diplomacy de INNER JOIN un_security_council usc ON de.country = usc.country GROUP BY de.country; | 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.