context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE cultural_events (id INT, name VARCHAR(50), month VARCHAR(10), revenue DECIMAL(10, 2));
What is the average revenue per month for cultural heritage events in Europe?
SELECT AVG(cultural_events.revenue) FROM cultural_events WHERE cultural_events.name LIKE '%cultural heritage%' AND cultural_events.month LIKE '%Europe%';
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (SatelliteID INT, Name VARCHAR(50), LaunchDate DATE, Manufacturer VARCHAR(50)); INSERT INTO Satellites (SatelliteID, Name, LaunchDate, Manufacturer) VALUES (1, 'Sat1', '2022-02-01', 'SpaceCorp'), (2, 'Sat2', '2022-02-10', 'Galactic'), (3, 'Sat3', '2022-02-20', 'SpaceCorp'), (4, 'Sat4', '2023-01-...
What is the maximum number of satellites launched by a manufacturer in a single year, and the year in which this occurred?
SELECT Manufacturer, YEAR(LaunchDate) AS Launch_Year, MAX(COUNT(SatelliteID)) OVER (PARTITION BY Manufacturer) AS Max_Launches FROM Satellites GROUP BY Manufacturer, LaunchDate;
gretelai_synthetic_text_to_sql
CREATE TABLE Waste_Generation_All (industry VARCHAR(20), region VARCHAR(20), waste_quantity INT); INSERT INTO Waste_Generation_All (industry, region, waste_quantity) VALUES ('Manufacturing', 'North', 1000), ('Manufacturing', 'South', 1500), ('Retail', 'North', 500), ('Retail', 'East', 700), ('Agriculture', 'West', 2000...
What is the total waste generation for the Manufacturing industry across all regions?
SELECT industry, SUM(waste_quantity) FROM Waste_Generation_All WHERE industry = 'Manufacturing' GROUP BY industry;
gretelai_synthetic_text_to_sql
CREATE TABLE circular_economy (country VARCHAR(50), initiative_count INT, year INT); INSERT INTO circular_economy (country, initiative_count, year) VALUES ('Germany', 250, 2019), ('Germany', 300, 2020), ('Germany', 350, 2021);
What is the total circular economy initiatives in Germany over the last 3 years?
SELECT SUM(initiative_count) FROM circular_economy WHERE country = 'Germany' AND year >= 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, director_gender VARCHAR(10), rating DECIMAL(2,1));
Insert a new movie 'Pulp Fiction' with release year 1994 and rating 9.0.
INSERT INTO movies (title, release_year, rating, director_gender) VALUES ('Pulp Fiction', 1994, 9.0, 'Male');
gretelai_synthetic_text_to_sql
CREATE TABLE space_debris (id INT, name VARCHAR(50), type VARCHAR(50), source VARCHAR(50), location POINT);
What is the average distance of space debris generated by NASA from the Earth's center?
SELECT AVG(DISTANCE(location, POINT(0, 0))) as average_distance FROM space_debris WHERE source = 'NASA';
gretelai_synthetic_text_to_sql
CREATE TABLE dataset_data (model_id INT, model_name VARCHAR(50), dataset VARCHAR(50), application VARCHAR(50));
What is the distribution of models trained on different datasets for AI applications?
SELECT dataset, COUNT(model_id) as num_models FROM dataset_data GROUP BY dataset;
gretelai_synthetic_text_to_sql
CREATE TABLE Neighborhoods (name VARCHAR(50), median_home_price INT); INSERT INTO Neighborhoods (name, median_home_price) VALUES ('Central Park', 500000), ('Harlem', 350000), ('Bronx', 400000);
List the top 3 most affordable neighborhoods by median home price.
SELECT name, median_home_price FROM Neighborhoods ORDER BY median_home_price LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE wells (well_id varchar(10), field varchar(10), production int, datetime date); INSERT INTO wells (well_id, field, production, datetime) VALUES ('W003', 'FieldE', 1200, '2022-01-01'), ('W004', 'FieldE', 1800, '2022-02-01');
Which wells in 'FieldE' have a production greater than 1000 in the first quarter of 2022?
SELECT well_id, field, production FROM wells WHERE field = 'FieldE' AND production > 1000 AND YEAR(datetime) = 2022 AND QUARTER(datetime) = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE QuinoaProduction (country VARCHAR(50), year INT, production_tons INT); INSERT INTO QuinoaProduction (country, year, production_tons) VALUES ('Bolivia', 2015, 70000), ('Peru', 2015, 100000), ('Ecuador', 2015, 50000), ('Bolivia', 2016, 80000), ('Peru', 2016, 120000), ('Ecuador', 2016, 60000);
What is the average production (in tons) of quinoa in the Andean region, disaggregated by country?
SELECT country, AVG(production_tons) FROM QuinoaProduction WHERE country IN ('Bolivia', 'Peru', 'Ecuador') AND year = 2015 OR year = 2016 GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE Workers (ID INT, Age INT, Gender VARCHAR(10), Salary DECIMAL(5,2), Industry VARCHAR(20)); INSERT INTO Workers (ID, Age, Gender, Salary, Industry) VALUES (1, 42, 'Female', 50000.00, 'Textile'); INSERT INTO Workers (ID, Age, Gender, Salary, Industry) VALUES (2, 35, 'Male', 55000.00, 'Textile'); INSERT INTO W...
What is the average salary of workers in the 'textile' industry who are female and over 40 years old, sorted by highest salary?
SELECT AVG(Salary) FROM Workers WHERE Gender = 'Female' AND Age > 40 AND Industry = 'Textile' ORDER BY Salary DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, product_name VARCHAR(255), country VARCHAR(255), sales_amount DECIMAL(10, 2), sale_date DATE);
What are the top 10 most popular beauty products in the UK, based on sales in Q2 2022?
SELECT product_name, SUM(sales_amount) as total_sales FROM sales WHERE country = 'UK' AND sale_date BETWEEN '2022-04-01' AND '2022-06-30' GROUP BY product_name ORDER BY total_sales DESC LIMIT 10;
gretelai_synthetic_text_to_sql
CREATE TABLE donations (id INT, donor TEXT, program TEXT, amount FLOAT); INSERT INTO donations (id, donor, program, amount) VALUES (1, 'Donor A', 'Education', 500.00), (2, 'Donor B', 'Health', 1000.00), (3, 'Donor C', 'Environment', 750.00), (4, 'Donor D', 'Education', 250.00), (5, 'Donor A', 'Health', 750.00);
What is the total donation amount given to nonprofits offering programs in the categories of Education, Health, and Environment, excluding any duplicate records?
SELECT SUM(amount) as total_donations FROM donations WHERE program IN (SELECT DISTINCT program FROM donations WHERE program IN ('Education', 'Health', 'Environment'));
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (id INT, name TEXT, location TEXT, num_beds INT, state TEXT); INSERT INTO hospitals (id, name, location, num_beds, state) VALUES (1, 'General Hospital', 'Urban, California', 200, 'California'); INSERT INTO hospitals (id, name, location, num_beds, state) VALUES (2, 'Community Hospital', 'Rural, Ne...
Calculate the percentage of hospitals in urban areas in each state.
SELECT state, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM hospitals WHERE location = 'Urban') as percentage FROM hospitals WHERE location = 'Urban' GROUP BY state
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID INT PRIMARY KEY, DonorID INT, Amount DECIMAL(10, 2), DonationDate DATE);
Update the donation amount in the 'Donations' table
UPDATE Donations SET Amount = 600.00 WHERE DonationID = 301;
gretelai_synthetic_text_to_sql
CREATE TABLE Astronauts (ID INT, Name VARCHAR(50), Nationality VARCHAR(50)); INSERT INTO Astronauts VALUES (1, 'Mark Watney', 'USA'), (2, 'Melissa Lewis', 'USA');
List all astronauts from the USA
SELECT * FROM Astronauts WHERE Nationality = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE LandfillCapacity (year INT, region VARCHAR(50), landfill VARCHAR(50), capacity FLOAT, filled_volume FLOAT); INSERT INTO LandfillCapacity (year, region, landfill, capacity, filled_volume) VALUES (2018, 'North America', 'Landfill A', 100000, 95000), (2018, 'Europe', 'Landfill B', 120000, 110000), (2018, 'Asi...
How many landfills were operational in 2018, excluding data from North America and Europe?
SELECT COUNT(*) FROM LandfillCapacity WHERE year = 2018 AND region NOT IN ('North America', 'Europe');
gretelai_synthetic_text_to_sql
CREATE TABLE Military_Equipment_Sales(id INT, country VARCHAR(255), year INT, value FLOAT); INSERT INTO Military_Equipment_Sales(id, country, year, value) VALUES (1, 'India', 2020, 50000000), (2, 'India', 2021, 4500000), (3, 'US', 2020, 80000000), (4, 'India', 2019, 40000000), (5, 'US', 2019, 75000000), (6, 'China', 20...
Delete military equipment sales records with a value less than 1000000 from the year 2021.
DELETE FROM Military_Equipment_Sales WHERE year = 2021 AND value < 1000000;
gretelai_synthetic_text_to_sql
CREATE TABLE Countries (Country VARCHAR(50), Continent VARCHAR(50), Hospital_Beds INT); INSERT INTO Countries (Country, Continent, Hospital_Beds) VALUES ('Australia', 'Oceania', 64000), ('New Zealand', 'Oceania', 10000);
What is the total number of hospital beds in each country in the Oceania continent?
SELECT Country, SUM(Hospital_Beds) FROM Countries WHERE Continent = 'Oceania' GROUP BY Country WITH ROLLUP;
gretelai_synthetic_text_to_sql
CREATE TABLE mining_operations (id INT, name VARCHAR(100), role VARCHAR(50), salary FLOAT); INSERT INTO mining_operations (id, name, role, salary) VALUES (1, 'John Doe', 'Mining Engineer', 75000.00); INSERT INTO mining_operations (id, name, role, salary) VALUES (2, 'Jane Smith', 'Geologist', 60000.00);
What is the average salary of employees in the 'mining_operations' table?
SELECT AVG(salary) FROM mining_operations;
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (ExhibitionID INT PRIMARY KEY, Title TEXT, Date DATE, City TEXT);
What is the earliest and latest date of exhibitions held in 'London' and 'Tokyo'?
SELECT MIN(Exhibitions.Date), MAX(Exhibitions.Date) FROM Exhibitions WHERE Exhibitions.City IN ('London', 'Tokyo');
gretelai_synthetic_text_to_sql
CREATE TABLE products (id INT, name VARCHAR(255), price DECIMAL(10, 2), category VARCHAR(255)); INSERT INTO products (id, name, price, category) VALUES (1, 'Mascara 1', 20.00, 'Mascara'), (2, 'Mascara 2', 30.00, 'Mascara'), (3, 'Mascara 3', 40.00, 'Mascara'), (4, 'Mascara 4', 50.00, 'Mascara');
Update the price of all mascaras to $25
UPDATE products SET price = 25.00 WHERE category = 'Mascara';
gretelai_synthetic_text_to_sql
CREATE TABLE ferries (id INT, region VARCHAR(20), fare DECIMAL(5,2)); INSERT INTO ferries (id, region, fare) VALUES (1, 'Sydney', 7.00), (2, 'Sydney', 5.50), (3, 'Melbourne', 4.50), (4, 'Sydney', 6.00);
What is the maximum fare for a ferry in the 'Sydney' region?
SELECT MAX(fare) FROM ferries WHERE region = 'Sydney';
gretelai_synthetic_text_to_sql
CREATE TABLE donations (id INT, donor TEXT, country TEXT, donation FLOAT); INSERT INTO donations (id, donor, country, donation) VALUES (1, 'John Doe', 'USA', 100), (2, 'Jane Smith', 'Canada', 150), (3, 'Michael Lee', 'USA', 75);
What is the average amount of aid donated by individuals in the US and Canada?
SELECT AVG(donation) as avg_donation FROM donations WHERE country IN ('USA', 'Canada');
gretelai_synthetic_text_to_sql
CREATE TABLE MilitaryEquipmentSales (id INT, equipment_name VARCHAR(50), sale_amount INT, sale_date DATE); INSERT INTO MilitaryEquipmentSales (id, equipment_name, sale_amount, sale_date) VALUES (1, 'Fighter Jet', 45000, '2021-01-01'), (2, 'Tank', 75000, '2021-02-01'), (3, 'Helicopter', 35000, '2021-03-01');
Delete records with sale amount less than $50,000 in the MilitaryEquipmentSales table
DELETE FROM MilitaryEquipmentSales WHERE sale_amount < 50000;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_protected_areas (name VARCHAR(255), area_size FLOAT, ocean VARCHAR(255)); INSERT INTO marine_protected_areas (name, area_size, ocean) VALUES ('Chagos Marine Protected Area', 545000, 'Indian');
What is the total area of all marine protected areas in the Indian Ocean?
SELECT SUM(area_size) FROM marine_protected_areas WHERE ocean = 'Indian';
gretelai_synthetic_text_to_sql
CREATE TABLE Carriers (id INT, name TEXT, fleet_size INT, headquarters TEXT); INSERT INTO Carriers (id, name, fleet_size, headquarters) VALUES (1, 'ABC Carriers', 75, 'New York'); INSERT INTO Carriers (id, name, fleet_size, headquarters) VALUES (2, 'XYZ Carriers', 35, 'Los Angeles'); INSERT INTO Carriers (id, name, fle...
What are the names and locations of all carriers that have a fleet size greater than 50 vehicles?
SELECT name, headquarters FROM Carriers WHERE fleet_size > 50;
gretelai_synthetic_text_to_sql
CREATE TABLE Players (PlayerID INT, Age INT, GamePurchaseCount INT); INSERT INTO Players (PlayerID, Age, GamePurchaseCount) VALUES (1, 25, 120), (2, 35, 200), (3, 42, 150), (4, 22, 80), (5, 31, 175); CREATE TABLE VR_Games (PlayerID INT, VRGamePlayed BOOLEAN); INSERT INTO VR_Games (PlayerID, VRGamePlayed) VALUES (1, TRU...
What is the average age of players who have not played VR games and their total game purchase count?
SELECT AVG(Players.Age), SUM(Players.GamePurchaseCount) FROM Players INNER JOIN VR_Games ON Players.PlayerID = VR_Games.PlayerID WHERE VR_Games.VRGamePlayed = FALSE;
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (hospital_id INT, city_id INT, hospital_name TEXT);CREATE TABLE cities (city_id INT, city_name TEXT, population INT);
Display the number of hospitals in each city, ordered by the number of hospitals in descending order
SELECT c.city_name, COUNT(h.hospital_id) FROM hospitals h INNER JOIN cities c ON h.city_id = c.city_id GROUP BY c.city_name ORDER BY COUNT(h.hospital_id) DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE daily_transaction_volume (date DATE, asset_id INT, volume DECIMAL(10,2)); INSERT INTO daily_transaction_volume (date, asset_id, volume) VALUES ('2022-01-01', 1, 5000), ('2022-01-02', 1, 5500), ('2022-01-03', 1, 6000);
What is the maximum daily transaction volume for the 'Tether' digital asset on the 'ETH' network in the last 30 days?
SELECT MAX(dt.volume) as max_daily_volume FROM daily_transaction_volume dt WHERE dt.asset_id = 1 AND dt.date >= CURDATE() - INTERVAL 30 DAY;
gretelai_synthetic_text_to_sql
CREATE SCHEMA publications;CREATE TABLE student_publications(student_name TEXT,department TEXT,num_publications INTEGER);INSERT INTO student_publications(student_name,department,num_publications)VALUES('Eve','Physics',5),('Frank','Computer Science',3);
How many publications do graduate students in the Physics department have?
SELECT department,SUM(num_publications) FROM publications.student_publications WHERE department='Physics' GROUP BY department;
gretelai_synthetic_text_to_sql
CREATE TABLE wave_heights (id INT, location VARCHAR(255), height FLOAT, date DATE); INSERT INTO wave_heights (id, location, height, date) VALUES (1, 'Arctic Ocean', 20.0, '2020-01-01'), (2, 'North Atlantic Ocean', 30.0, '2019-12-31');
What was the maximum wave height ever recorded in the Arctic?
SELECT MAX(height) FROM wave_heights WHERE location = 'Arctic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE companies (id INT, name TEXT, industry TEXT, ceo_gender TEXT); INSERT INTO companies (id, name, industry, ceo_gender) VALUES (1, 'GreenTech', 'Renewable Energy', 'Female'); INSERT INTO companies (id, name, industry, ceo_gender) VALUES (2, 'CleanEnergy', 'Energy', 'Male');
How many companies have a female CEO in the renewable energy sector?
SELECT COUNT(*) FROM companies WHERE industry = 'Renewable Energy' AND ceo_gender = 'Female';
gretelai_synthetic_text_to_sql
CREATE TABLE Concerts (ConcertID INT, Artist VARCHAR(50), City VARCHAR(50)); INSERT INTO Concerts (ConcertID, Artist, City) VALUES (1, 'Taylor Swift', 'Los Angeles'), (2, 'BTS', 'New York'), (3, 'Adele', 'London'), (4, 'Taylor Swift', 'New York');
List all artists who have had at least one concert in 'New York' and 'Los Angeles'.
SELECT Artist FROM Concerts WHERE City IN ('New York', 'Los Angeles') GROUP BY Artist HAVING COUNT(DISTINCT City) = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE conservation_projects (id INT, project_name VARCHAR(50), status VARCHAR(10)); INSERT INTO conservation_projects (id, project_name, status) VALUES (1, 'Habitat Restoration', 'Success'), (2, 'Community Education', 'In Progress'), (3, 'Species Protection', 'Success');
What is the total number of successful habitat preservation projects in the 'conservation_projects' table?
SELECT COUNT(*) FROM conservation_projects WHERE status = 'Success';
gretelai_synthetic_text_to_sql
CREATE TABLE investments(id INT, sector VARCHAR(20), esg_score INT); INSERT INTO investments VALUES(1, 'Tech', 85), (2, 'Healthcare', 75), (3, 'Tech', 82);
Find the average ESG score for the Renewable Energy sector, if any investments exist.
SELECT AVG(esg_score) as avg_esg_score FROM investments WHERE sector = 'Renewable Energy' HAVING COUNT(*) > 0;
gretelai_synthetic_text_to_sql
CREATE TABLE AIModels (model_id INT, model_name VARCHAR(50), added_date DATE); INSERT INTO AIModels (model_id, model_name, added_date) VALUES (1, 'ModelA', '2022-04-15'), (2, 'ModelB', '2022-05-20'), (3, 'ModelC', '2022-06-05'), (4, 'ModelD', '2022-07-18');
List AI models that were added in Q2 2022.
SELECT model_name FROM AIModels WHERE added_date BETWEEN '2022-04-01' AND '2022-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE mine (id INT, name TEXT, location TEXT, Dysprosium_monthly_production FLOAT, timestamp TIMESTAMP); INSERT INTO mine (id, name, location, Dysprosium_monthly_production, timestamp) VALUES (1, 'Australian Mine', 'Australia', 120.5, '2021-03-01'), (2, 'Californian Mine', 'USA', 150.3, '2021-03-01'), (3, 'Brazi...
Update the production of Dysprosium in the Brazilian mine for March 2021 to 95.0.
UPDATE mine SET Dysprosium_monthly_production = 95.0 WHERE name = 'Brazilian Mine' AND EXTRACT(MONTH FROM timestamp) = 3 AND EXTRACT(YEAR FROM timestamp) = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE concert_prices (id INT, type VARCHAR(10), price DECIMAL(5,2)); INSERT INTO concert_prices (id, type, price) VALUES (1, 'classical', 35.50), (2, 'pop', 20.00), (3, 'classical', 40.00), (4, 'jazz', 28.30);
What is the maximum ticket price for classical concerts?
SELECT MAX(price) FROM concert_prices WHERE type = 'classical';
gretelai_synthetic_text_to_sql
CREATE TABLE players (player_id INT, name TEXT, nationality TEXT, points INT, season INT); INSERT INTO players (player_id, name, nationality, points, season) VALUES (1, 'Alice Johnson', 'Canada', 700, 2019), (2, 'Bob Williams', 'Canada', 600, 2019);
Who is the top scorer among players from Canada in the 2019 season?
SELECT name, MAX(points) FROM players WHERE nationality = 'Canada' AND season = 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE Precincts (PrecinctID INT, Name VARCHAR(50)); CREATE TABLE CommunityPolicing (Score INT, PrecinctID INT);
What is the maximum community policing score for each precinct?
SELECT P.Name, MAX(CP.Score) as MaxScore FROM Precincts P INNER JOIN CommunityPolicing CP ON P.PrecinctID = CP.PrecinctID GROUP BY P.Name;
gretelai_synthetic_text_to_sql
CREATE TABLE defense_contracts (id INT PRIMARY KEY, department VARCHAR(50), year INT, contract_value FLOAT);INSERT INTO defense_contracts (id, department, year, contract_value) VALUES (1, 'Army', 2018, 1000000), (2, 'Navy', 2018, 2000000), (3, 'Air Force', 2018, 1500000), (4, 'Army', 2019, 1200000), (5, 'Navy', 2019, 1...
Generate a view 'contract_value_summary' to display the total value of defense contracts awarded by year and department
CREATE VIEW contract_value_summary AS SELECT year, department, SUM(contract_value) as total_contract_value FROM defense_contracts GROUP BY year, department;
gretelai_synthetic_text_to_sql
CREATE TABLE material_cost (id INT, supplier_name VARCHAR(50), product_name VARCHAR(50), quantity INT, cost_per_unit DECIMAL(10,2)); INSERT INTO material_cost (id, supplier_name, product_name, quantity, cost_per_unit) VALUES (1, 'Green Products Inc.', 'Solar Panels', 50, 500.00);
What is the total cost of materials for each supplier, grouped by supplier name and product type?
SELECT supplier_name, product_name, SUM(quantity * cost_per_unit) as total_cost FROM material_cost GROUP BY supplier_name, product_name;
gretelai_synthetic_text_to_sql
CREATE TABLE supplier_sustainability (supplier_id INT, name TEXT, sustainability_score INT); INSERT INTO supplier_sustainability (supplier_id, name, sustainability_score) VALUES (1, 'Supplier A', 85), (2, 'Supplier B', 90), (3, 'Supplier C', 70), (4, 'Supplier D', 60), (5, 'Supplier E', 50), (6, 'Supplier F', 95), (7, ...
What is the average sustainability score of suppliers that provide linen?
SELECT AVG(sustainability_score) FROM supplier_sustainability s JOIN supplier_materials m ON s.supplier_id = m.supplier_id WHERE material = 'linen';
gretelai_synthetic_text_to_sql
CREATE TABLE vessels (id INT, name TEXT, type TEXT, safety_score FLOAT, average_speed FLOAT);CREATE TABLE cargos (id INT, vessel_id INT, material TEXT, destination TEXT, date DATE, weight FLOAT); INSERT INTO vessels (id, name, type, safety_score, average_speed) VALUES (1, 'VesselH', 'Tanker', 75, 12.5); INSERT INTO car...
What is the average speed of vessels that transported dangerous goods in the Pacific Ocean in H1 2021?
SELECT AVG(v.average_speed) FROM vessels v JOIN cargos c ON v.id = c.vessel_id WHERE v.safety_score > 70 AND c.material = 'Dangerous' AND c.destination = 'Pacific' AND c.date BETWEEN '2021-01-01' AND '2021-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE satellite_status (id INT, name VARCHAR(50), status VARCHAR(20), last_contact_date DATE); INSERT INTO satellite_status (id, name, status, last_contact_date) VALUES (1, 'Sat1', 'Active', '2019-01-01'); INSERT INTO satellite_status (id, name, status, last_contact_date) VALUES (2, 'Sat2', 'Active', '2022-01-01...
Which is the oldest active satellite in the "satellite_status" table?
SELECT name, last_contact_date FROM (SELECT name, last_contact_date, ROW_NUMBER() OVER (PARTITION BY status ORDER BY last_contact_date ASC) as row_num FROM satellite_status WHERE status = 'Active') tmp WHERE row_num = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Manufacturers (id INT, industry VARCHAR(255), name VARCHAR(255), production_output INT); INSERT INTO Manufacturers (id, industry, name, production_output) VALUES (1, 'Aerospace', 'ABC Aerospace', 1000), (2, 'Aerospace', 'DEF Aerospace', 1500), (3, 'Automotive', 'GHI Automotive', 500);
What is the total production output for each manufacturer in the aerospace industry?
SELECT name, production_output FROM Manufacturers WHERE industry = 'Aerospace';
gretelai_synthetic_text_to_sql
CREATE TABLE ShipmentsUS (id INT, weight FLOAT, destination VARCHAR(20), ship_date DATE); INSERT INTO ShipmentsUS (id, weight, destination, ship_date) VALUES (1, 70.3, 'United States', '2021-01-05'), (2, 80.1, 'Canada', '2021-01-06');
What is the sum of the weight of shipments sent to the United States from January 5, 2021 to January 10, 2021?
SELECT SUM(weight) FROM ShipmentsUS WHERE destination = 'United States' AND ship_date BETWEEN '2021-01-05' AND '2021-01-10';
gretelai_synthetic_text_to_sql
CREATE TABLE Patients (PatientID INT, Age INT, Gender TEXT, Diagnosis TEXT, State TEXT); INSERT INTO Patients (PatientID, Age, Gender, Diagnosis, State) VALUES (1, 67, 'Female', 'Heart Disease', 'New York');
What is the ratio of male to female patients diagnosed with heart disease?
SELECT COUNT(*) FILTER (WHERE Gender = 'Male') / COUNT(*) FILTER (WHERE Gender = 'Female') AS Ratio FROM Patients WHERE Diagnosis = 'Heart Disease';
gretelai_synthetic_text_to_sql
CREATE TABLE CybersecurityStrategies (Id INT PRIMARY KEY, Name VARCHAR(50), SuccessRate DECIMAL(3,2));
List cybersecurity strategies with a higher success rate than 70%
SELECT Name FROM CybersecurityStrategies WHERE SuccessRate > 0.7;
gretelai_synthetic_text_to_sql
CREATE TABLE Vehicles (year INT, make VARCHAR(100), model VARCHAR(100), horsepower INT); INSERT INTO Vehicles (year, make, model, horsepower) VALUES (2015, 'Toyota', 'Corolla', 132), (2018, 'Honda', 'Civic', 158), (2020, 'Tesla', 'Model 3', 263);
What is the average horsepower of vehicles released in 2020?
SELECT AVG(horsepower) FROM Vehicles WHERE year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE excavation_sites (id INT, site_name VARCHAR(50), location VARCHAR(50), num_artifacts INT, total_funding DECIMAL(10,2));
Which countries had the highest average weight of artifacts?
SELECT country, AVG(weight) as avg_weight FROM artifact_details GROUP BY country ORDER BY avg_weight DESC LIMIT 1
gretelai_synthetic_text_to_sql
CREATE TABLE properties (id INT, city VARCHAR(20), square_footage INT, inclusive_housing BOOLEAN); INSERT INTO properties (id, city, square_footage, inclusive_housing) VALUES (1, 'Oakland', 1200, true); INSERT INTO properties (id, city, square_footage, inclusive_housing) VALUES (2, 'Oakland', 1500, false);
What is the total square footage of inclusive housing units in Oakland?
SELECT SUM(square_footage) FROM properties WHERE city = 'Oakland' AND inclusive_housing = true;
gretelai_synthetic_text_to_sql
CREATE TABLE players (id INT, name VARCHAR(50), country VARCHAR(50), wins INT); INSERT INTO players (id, name, country, wins) VALUES (1, 'Player1', 'USA', 100), (2, 'Player2', 'Canada', 80), (3, 'Player3', 'USA', 120);
What is the total number of wins for players from the United States?
SELECT SUM(wins) FROM players WHERE country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE Visitors (VisitorID INT, Nationality VARCHAR(20), VisitedHistoricalSites BOOLEAN, ParticipatedInSustainableActivities BOOLEAN, Continent VARCHAR(20)); INSERT INTO Visitors (VisitorID, Nationality, VisitedHistoricalSites, ParticipatedInSustainableActivities, Continent) VALUES (1, 'Egyptian', true, true, 'Af...
What is the percentage of tourists who visited historical sites in Africa that also participated in sustainable activities?
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Visitors WHERE Continent = 'Africa')) as Percentage FROM Visitors WHERE VisitedHistoricalSites = true AND ParticipatedInSustainableActivities = true AND Continent = 'Africa';
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.research_projects(id INT, name TEXT, duration INT);INSERT INTO genetics.research_projects(id, name, duration) VALUES (1, 'ProjectA', 48), (2, 'ProjectB', 24), (3, 'ProjectC', 60);
Which genetic research projects have a duration greater than 3 years?
SELECT name FROM genetics.research_projects WHERE duration > 36;
gretelai_synthetic_text_to_sql
CREATE TABLE emergency_calls (id INT, call_type VARCHAR(255), call_date TIMESTAMP); INSERT INTO emergency_calls (id, call_type, call_date) VALUES (1, 'Medical Emergency', '2022-01-01 12:00:00'); CREATE TABLE fire_incidents (id INT, incident_type VARCHAR(255), incident_date TIMESTAMP); INSERT INTO fire_incidents (id, in...
What is the total number of emergency calls and fire incidents in the city of Oakland?
SELECT COUNT(*) FROM emergency_calls UNION ALL SELECT COUNT(*) FROM fire_incidents;
gretelai_synthetic_text_to_sql
CREATE TABLE districts (id INT, name TEXT, population INT, area FLOAT); INSERT INTO districts (id, name, population, area) VALUES (1, 'DistrictA', 50000, 50), (2, 'DistrictB', 100000, 100), (3, 'DistrictC', 25000, 20); CREATE TABLE violations (id INT, district_id INT, year INT, num_violations INT); INSERT INTO violatio...
How many traffic violations were reported in districts with the highest and lowest population densities in 2019?
SELECT v1.num_violations + v2.num_violations FROM (SELECT dv.num_violations FROM violations dv INNER JOIN districts d ON dv.district_id = d.id ORDER BY d.population/d.area DESC LIMIT 1) v1, (SELECT dv.num_violations FROM violations dv INNER JOIN districts d ON dv.district_id = d.id ORDER BY d.population/d.area LIMIT 1)...
gretelai_synthetic_text_to_sql
CREATE TABLE museums (id INT, name VARCHAR(50), location VARCHAR(30), exhibition_space INT); INSERT INTO museums (id, name, location, exhibition_space) VALUES (1, 'Museum1', 'NYC', 50000), (2, 'Museum2', 'LA', 75000); CREATE TABLE artworks (id INT, museum_id INT, title VARCHAR(50)); INSERT INTO artworks (id, museum_id,...
List all museums and their total exhibition space, in square feet, along with the number of artworks in their collection.
SELECT m.name, m.location, m.exhibition_space, COUNT(a.id) as artwork_count FROM museums m LEFT JOIN artworks a ON m.id = a.museum_id GROUP BY m.id;
gretelai_synthetic_text_to_sql
CREATE TABLE farms (id INT, farm_name VARCHAR(50), acres INT, total_yield INT); INSERT INTO farms (id, farm_name, acres, total_yield) VALUES (1, 'Farm 1', 25, 10000), (2, 'Farm 2', 75, 20000), (3, 'Farm 3', 45, 15000), (4, 'Farm 4', 55, 25000), (5, 'Farm 5', 35, 12000);
What is the total crop yield for small-scale farms (less than 50 acres) in the United States?
SELECT SUM(total_yield) FROM farms WHERE acres < 50;
gretelai_synthetic_text_to_sql
CREATE TABLE community_engagement (id INT, event_name VARCHAR(255), category VARCHAR(255), country VARCHAR(255)); INSERT INTO community_engagement (id, event_name, category, country) VALUES (1, 'Dance Performance', 'Architecture', 'Greece'), (2, 'Music Concert', 'Architecture', 'Italy'); CREATE VIEW community_engagemen...
What is the total number of community engagement events by category?
SELECT category, SUM(event_count) as total_events FROM community_engagement_by_category;
gretelai_synthetic_text_to_sql
CREATE TABLE Teams (TeamID INT, TeamName VARCHAR(50)); CREATE TABLE TicketSales (TicketID INT, TeamID INT, SaleDate DATE); INSERT INTO Teams (TeamID, TeamName) VALUES (1, 'TeamA'), (2, 'TeamB'); INSERT INTO TicketSales (TicketID, TeamID, SaleDate) VALUES (1, 1, '2023-01-01'), (2, 1, '2023-04-03'), (3, 2, '2023-03-02'),...
For each team, find the number of ticket sales in each month of 2023, ranked from highest to lowest.
SELECT TeamName, EXTRACT(MONTH FROM SaleDate) AS Month, COUNT(*) AS SaleCount FROM TicketSales JOIN Teams ON TicketSales.TeamID = Teams.TeamID GROUP BY TeamName, Month ORDER BY TeamName, SaleCount DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE ChemicalProduction (date DATE, chemical VARCHAR(10), mass FLOAT); INSERT INTO ChemicalProduction (date, chemical, mass) VALUES ('2021-01-01', 'A', 100), ('2021-01-01', 'B', 150), ('2021-01-02', 'A', 120), ('2021-01-02', 'B', 170);
What is the average mass of chemicals produced per day?
SELECT date, AVG(mass) as AvgMass FROM ChemicalProduction GROUP BY date;
gretelai_synthetic_text_to_sql
CREATE TABLE movies (movie_id INT, title VARCHAR(100), release_year INT, rating FLOAT);
Insert a new movie 'Black Panther 2' with a rating of 4.6 and a 2022 release.
INSERT INTO movies (title, release_year, rating) VALUES ('Black Panther 2', 2022, 4.6);
gretelai_synthetic_text_to_sql
CREATE TABLE hotel_tech_adoption (hotel_id INT, hotel_name TEXT, region TEXT, ai_adoption BOOLEAN); INSERT INTO hotel_tech_adoption (hotel_id, hotel_name, region, ai_adoption) VALUES (1, 'Hotel A', 'APAC', true), (2, 'Hotel B', 'APAC', false), (3, 'Hotel C', 'APAC', true), (4, 'Hotel D', 'APAC', true);
How many hotels have adopted AI technology in 'APAC' region?
SELECT COUNT(*) FROM hotel_tech_adoption WHERE region = 'APAC' AND ai_adoption = true;
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (VolunteerID int, VolunteerName varchar(50), HoursDonated int, VolunteerYear int); INSERT INTO Volunteers (VolunteerID, VolunteerName, HoursDonated, VolunteerYear) VALUES (1, 'Karen Green', 20, 2020), (2, 'Lisa White', 25, 2020), (3, 'Mia Black', 30, 2020), (4, 'Noah Red', 15, 2020);
What is the average number of hours donated by volunteers in '2020'?
SELECT AVG(HoursDonated) as AverageHours FROM Volunteers WHERE VolunteerYear = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE food_safety (restaurant VARCHAR(255), score INT, city VARCHAR(255), year INT); INSERT INTO food_safety (restaurant, score, city, year) VALUES ('Restaurant C', 90, 'Los Angeles', 2021), ('Restaurant D', 85, 'Los Angeles', 2021);
What was the median food safety score for a restaurant in Los Angeles in 2021?
SELECT AVG(score) FROM (SELECT score FROM food_safety WHERE city = 'Los Angeles' AND year = 2021 ORDER BY score LIMIT 2 OFFSET 1) AS temp;
gretelai_synthetic_text_to_sql
CREATE TABLE traffic_fines (fine_id INT, fine_amount INT, department TEXT, city TEXT); INSERT INTO traffic_fines (fine_id, fine_amount, department, city) VALUES (1, 100, 'Traffic', 'Chicago'), (2, 200, 'Traffic', 'Chicago'), (3, 50, 'Parks', 'Chicago'), (4, 300, 'Traffic', 'New York');
What is the sum of all fines issued by the traffic department in the city of Chicago?
SELECT SUM(fine_amount) FROM traffic_fines WHERE department = 'Traffic' AND city = 'Chicago';
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists program (id INT, name VARCHAR(50), category VARCHAR(50)); CREATE TABLE if not exists funding (id INT, program_id INT, year INT, amount DECIMAL(10, 2), source VARCHAR(50)); INSERT INTO program (id, name, category) VALUES (1, 'Theater 101', 'Theater'), (2, 'Broadway Hits', 'Theater'), (3, 'Shak...
List all funding sources for 'Theater' programs in 2022.
SELECT source FROM funding f JOIN program p ON f.program_id = p.id WHERE p.name LIKE '%Theater%' AND f.year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE south_american_tourists (id INT, country VARCHAR(20), destination VARCHAR(20), visitors INT); INSERT INTO south_american_tourists (id, country, destination, visitors) VALUES (1, 'Brazil', 'Rio de Janeiro', 1000000), (2, 'Argentina', 'Buenos Aires', 800000), (3, 'Colombia', 'Bogota', 600000);
What is the most popular tourist destination in South America?
SELECT destination, SUM(visitors) as total_visitors FROM south_american_tourists GROUP BY destination ORDER BY total_visitors DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE energy_efficiency (id INT, name VARCHAR(255), savings FLOAT, country VARCHAR(50)); INSERT INTO energy_efficiency (id, name, savings, country) VALUES (1, 'Efficiency A', 10.5, 'Germany'), (2, 'Efficiency B', 15.2, 'France'), (3, 'Efficiency C', 8.0, 'Germany');
What is the total energy efficiency savings in Germany and France, grouped by country?
SELECT ee.country, SUM(ee.savings) as total_savings FROM energy_efficiency ee GROUP BY ee.country;
gretelai_synthetic_text_to_sql
CREATE TABLE yearly_projects (id INT, name VARCHAR(50), year INT, cost FLOAT); INSERT INTO yearly_projects VALUES (1, 'Dam Construction', 2020, 7000000), (2, 'Road Widening', 2019, 4000000), (3, 'Bridge Construction', 2021, 3500000);
What is the total cost of projects per year?
SELECT year, SUM(cost) FROM yearly_projects GROUP BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE ai_algorithms (algorithm_id INT, algorithm_name VARCHAR(50), algorithm_type VARCHAR(50), safety_score FLOAT); INSERT INTO ai_algorithms (algorithm_id, algorithm_name, algorithm_type, safety_score) VALUES (1, 'Algo1', 'Reinforcement Learning', 0.85), (2, 'Algo2', 'Computer Vision', 0.92), (3, 'Algo3', 'Rein...
What is the average safety score for each AI algorithm, grouped by algorithm type?
SELECT algorithm_type, AVG(safety_score) AS avg_safety_score FROM ai_algorithms GROUP BY algorithm_type;
gretelai_synthetic_text_to_sql
CREATE TABLE sf_police_officers (id INT, officer_name VARCHAR(20), station VARCHAR(20)); INSERT INTO sf_police_officers (id, officer_name, station) VALUES (1, 'Officer Smith', 'Precinct 1'), (2, 'Officer Johnson', 'Precinct 1');
What is the total number of police officers in San Francisco?
SELECT COUNT(*) FROM sf_police_officers;
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists paris_public_transport_vehicles (id INT, vehicle_id INT, vehicle_type VARCHAR(20), timestamp TIMESTAMP);
How many unique vehicle IDs were used for public transportation services in Paris during the month of June?
SELECT COUNT(DISTINCT vehicle_id) FROM paris_public_transport_vehicles WHERE EXTRACT(MONTH FROM timestamp) = 6;
gretelai_synthetic_text_to_sql
CREATE TABLE players (player_id INT, name VARCHAR(100), position VARCHAR(50), team_id INT); INSERT INTO players (player_id, name, position, team_id) VALUES (1, 'John Doe', 'Forward', 1), (2, 'Jane Smith', 'Goalie', 2);
Update the positions of all goalkeepers to 'Goalkeeper'
UPDATE players SET position = 'Goalkeeper' WHERE position = 'Goalie';
gretelai_synthetic_text_to_sql
CREATE TABLE WaterTreatmentPlants (plant_id INT, state VARCHAR(20), water_consumption_per_day FLOAT); INSERT INTO WaterTreatmentPlants (plant_id, state, water_consumption_per_day) VALUES (1, 'Illinois', 1800000), (2, 'Illinois', 1300000);
How many water treatment plants in the state of Illinois have water consumption per day greater than 1,500,000 liters?
SELECT COUNT(*) FROM WaterTreatmentPlants WHERE state = 'Illinois' AND water_consumption_per_day > 1500000;
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(255)); INSERT INTO Artists (ArtistID, ArtistName) VALUES (1, 'ArtistA'), (2, 'ArtistB'), (3, 'ArtistC'); CREATE TABLE Songs (SongID INT, ArtistID INT, SongName VARCHAR(255), Streams INT); INSERT INTO Songs (SongID, ArtistID, SongName, Streams) VALUES (1, 1, 'TopSon...
List the number of streams for each artist's top-performing song.
SELECT A.ArtistName, MAX(S.Streams) AS TopStreams FROM Artists A JOIN Songs S ON A.ArtistID = S.ArtistID GROUP BY A.ArtistName;
gretelai_synthetic_text_to_sql
CREATE TABLE HotelTechAdoption (hotel_id INT, ai_integration BOOLEAN, virtual_tour BOOLEAN); CREATE TABLE OnlineTravelAgency (ota_id INT, hotel_id INT, bookings INT); CREATE TABLE AIHospitalityTrends (hotel_id INT, ai_trend VARCHAR(255)); CREATE TABLE HotelGeolocation (hotel_id INT, country VARCHAR(255), city VARCHAR(2...
What is the average booking amount for hotels that have implemented AI integration and are located in Japan?
SELECT AVG(bookings) as avg_bookings FROM OnlineTravelAgency ota JOIN HotelTechAdoption hta ON ota.hotel_id = hta.hotel_id JOIN HotelGeolocation hgl ON ota.hotel_id = hgl.hotel_id WHERE hta.ai_integration = TRUE AND hgl.country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE flights (id INT, airline VARCHAR(255)); INSERT INTO flights (id, airline) VALUES (1, 'AstroFlights'), (2, 'GalacticAirlines'), (3, 'AstroFlights'), (4, 'GalacticAirlines'), (5, 'AstroFlights');
What is the difference in the number of flights operated by 'AstroFlights' and 'GalacticAirlines'?
SELECT COUNT(*) FILTER (WHERE airline = 'AstroFlights') - COUNT(*) FILTER (WHERE airline = 'GalacticAirlines') as difference;
gretelai_synthetic_text_to_sql
CREATE TABLE users (id INT, country VARCHAR(255)); INSERT INTO users (id, country) VALUES (1, 'France'), (2, 'Canada'), (3, 'Germany'); CREATE TABLE ad_spend (id INT, user_id INT, amount DECIMAL(10, 2), spend_date DATE); INSERT INTO ad_spend (id, user_id, amount, spend_date) VALUES (1, 1, 500.00, '2022-01-01'), (2, 1, ...
What is the average ad spend per user in the last month?
SELECT AVG(ad_spend.amount) FROM ad_spend INNER JOIN users ON ad_spend.user_id = users.id WHERE ad_spend.spend_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE vulnerabilities (id INT, name VARCHAR(255), severity VARCHAR(255), location VARCHAR(255), timestamp TIMESTAMP);
What are the names and locations of all the vulnerabilities with a high severity level in the last 30 days?
SELECT name, location FROM vulnerabilities WHERE severity = 'high' AND timestamp >= NOW() - INTERVAL 30 DAY;
gretelai_synthetic_text_to_sql
CREATE TABLE cases (case_id INT, case_outcome VARCHAR(20), billing_amount DECIMAL(10, 2), case_location VARCHAR(20)); INSERT INTO cases (case_id, case_outcome, billing_amount, case_location) VALUES (1, 'Successful', 3000, 'New York'), (2, 'Unsuccessful', 2000, 'New York');
What is the total billing amount for cases with a successful outcome in New York?
SELECT SUM(billing_amount) FROM cases WHERE case_outcome = 'Successful' AND case_location = 'New York';
gretelai_synthetic_text_to_sql
CREATE TABLE fish_species (id INT, name VARCHAR(255)); INSERT INTO fish_species (id, name) VALUES (1, 'Salmon'), (2, 'Tilapia'), (3, 'Cod'); CREATE TABLE oxygen_readings (id INT, fish_id INT, date DATE, level FLOAT); INSERT INTO oxygen_readings (id, fish_id, date, level) VALUES (1, 1, '2021-01-01', 6.5), (2, 1, '2021-0...
What is the average dissolved oxygen level for each fish species in the past 6 months?
SELECT f.name, AVG(o.level) as avg_level FROM oxygen_readings o JOIN fish_species f ON o.fish_id = f.id WHERE o.date >= DATEADD(month, -6, GETDATE()) GROUP BY f.name;
gretelai_synthetic_text_to_sql
CREATE TABLE project_timeline_florida_data (region VARCHAR(255), building_type VARCHAR(255), timeline INT); INSERT INTO project_timeline_florida_data (region, building_type, timeline) VALUES ('Florida', 'Green', 200), ('Florida', 'Non-Green', 250);
What is the average project timeline for non-green buildings in Florida?
SELECT AVG(timeline) FROM project_timeline_florida_data WHERE region = 'Florida' AND building_type = 'Non-Green';
gretelai_synthetic_text_to_sql
CREATE TABLE MonthlyWaterUsage (Month DATE, City VARCHAR(20), Usage FLOAT); INSERT INTO MonthlyWaterUsage (Month, City, Usage) VALUES ('2022-01-01', 'NYC', 2500), ('2022-02-01', 'NYC', 3000), ('2022-03-01', 'NYC', 3500);
What is the total water consumption for the city of NYC in the last quarter?
SELECT SUM(Usage) FROM MonthlyWaterUsage WHERE City = 'NYC' AND Month >= DATEADD(QUARTER, -1, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE Products (id INT, ProductName VARCHAR(50), Category VARCHAR(50), Price DECIMAL(5,2), IsEcoFriendly BOOLEAN, LaunchDate DATE); CREATE TABLE CrueltyFreeCertification (id INT, ProductID INT, CertificationDate DATE);
What is the average preference score for eco-friendly products launched before 2010?
SELECT AVG(CP.PreferenceScore) as AveragePreferenceScore FROM ConsumerPreference CP JOIN Products P ON CP.ProductID = P.id JOIN CrueltyFreeCertification CFC ON P.id = CFC.ProductID WHERE P.IsEcoFriendly = TRUE AND P.LaunchDate < '2010-01-01' AND CFC.CertificationDate IS NOT NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE islamic_savings (account_type VARCHAR(50), interest_rate FLOAT); INSERT INTO islamic_savings (account_type, interest_rate) VALUES ('Al-Wadiah', 1.5), ('Mudarabah', 2.5), ('Wakalah', 2.0);
What is the maximum interest rate for Islamic savings accounts?
SELECT MAX(interest_rate) FROM islamic_savings WHERE account_type = 'Al-Wadiah';
gretelai_synthetic_text_to_sql
CREATE TABLE industry (company_id INT, industry TEXT); INSERT INTO industry (company_id, industry) VALUES (1, 'Healthcare'); INSERT INTO industry (company_id, industry) VALUES (2, 'Retail');
Calculate the average funding for startups with at least one female founder in the healthcare industry
SELECT AVG(funding_amount) FROM investment_rounds ir INNER JOIN company c ON ir.company_id = c.id INNER JOIN diversity d ON c.id = d.company_id INNER JOIN industry i ON c.id = i.company_id WHERE i.industry = 'Healthcare' AND d.founder_gender = 'Female';
gretelai_synthetic_text_to_sql
CREATE TABLE military_tech_assets (asset_id INT PRIMARY KEY, asset_name VARCHAR(255), acquisition_year INT, country VARCHAR(255)); INSERT INTO military_tech_assets (asset_id, asset_name, acquisition_year, country) VALUES (1, 'F-35 Fighter Jet', 2019, 'USA'), (2, 'Type-26 Frigate', 2020, 'UK'), (3, 'Dolphin-class Submar...
How many military technology assets were acquired by country in 2021?
SELECT country, COUNT(*) FROM military_tech_assets WHERE acquisition_year = 2021 GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE vaccine_data (id INT, age INT, gender TEXT, vaccinated BOOLEAN); INSERT INTO vaccine_data (id, age, gender, vaccinated) VALUES (1, 20, 'Male', true); INSERT INTO vaccine_data (id, age, gender, vaccinated) VALUES (2, 30, 'Female', true); INSERT INTO vaccine_data (id, age, gender, vaccinated) VALUES (3, 40, ...
What is the number of people who have received the COVID-19 vaccine, grouped by age and gender?
SELECT age, gender, SUM(vaccinated) as number_vaccinated FROM vaccine_data GROUP BY age, gender;
gretelai_synthetic_text_to_sql
CREATE TABLE us_tourism (year INT, visitors INT, sustainability_rating INT); INSERT INTO us_tourism (year, visitors, sustainability_rating) VALUES (2018, 50000000, 3), (2019, 55000000, 4), (2020, 40000000, 5), (2021, 45000000, 5);
How many tourists visited the United States from 2018 to 2021 who were traveling sustainably?
SELECT SUM(visitors) FROM us_tourism WHERE sustainability_rating >= 4 AND year BETWEEN 2018 AND 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE public.collected_fare (fare_id SERIAL PRIMARY KEY, fare DECIMAL(5,2), fare_date DATE, route_type_id INTEGER, FOREIGN KEY (route_type_id) REFERENCES public.route_type(route_type_id)); INSERT INTO public.collected_fare (fare, fare_date, route_type_id) VALUES (2.00, '2022-04-01', 3), (1.00, '2022-04-05', 3), ...
What is the total fare collected from 'tram' routes in April 2022?
SELECT SUM(fare) FROM public.collected_fare INNER JOIN public.route_type ON public.collected_fare.route_type_id = public.route_type.route_type_id WHERE route_type = 'tram' AND fare_date >= '2022-04-01' AND fare_date <= '2022-04-30'
gretelai_synthetic_text_to_sql
CREATE TABLE exits(startup_id INT, exit_type TEXT, exit_date DATE, exit_value INT); INSERT INTO exits (startup_id, exit_type, exit_date, exit_value) VALUES (1, 'Acquisition', '2021-10-01', 20000000), (2, 'IPO', '2021-06-01', 50000000), (3, 'Acquisition', '2021-02-01', 1000000);
Update the exit value for startup with ID 3 in the exits table to 12000000.
UPDATE exits SET exit_value = 12000000 WHERE startup_id = 3;
gretelai_synthetic_text_to_sql
CREATE TABLE policy_violations (id INT, policy VARCHAR(50), violations INT, year INT, month INT);
How many policy violations have occurred in each month of the past year from the 'policy_violations' table?
SELECT month, SUM(violations) FROM policy_violations WHERE year = YEAR(CURRENT_DATE) - 1 GROUP BY month;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, product_id INT, quantity INT, sale_price DECIMAL); CREATE TABLE products (id INT, name TEXT, is_cruelty_free BOOLEAN, product_type TEXT, sale_price DECIMAL, country TEXT);
What's the total revenue of cruelty-free skincare products from Canada?
SELECT SUM(sales.quantity * sales.sale_price) FROM sales JOIN products ON sales.product_id = products.id WHERE products.is_cruelty_free = true AND products.product_type = 'skincare' AND products.country = 'Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE autonomous_test_vehicles (vehicle_id INT, make VARCHAR(50), model VARCHAR(50), production_year INT, autonomous BOOLEAN);
How many autonomous test vehicles were produced between 2018 and 2020?
SELECT COUNT(*) FROM autonomous_test_vehicles WHERE production_year BETWEEN 2018 AND 2020 AND autonomous = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE syria_assistance (org_id INT, org_name VARCHAR(50), year INT, medical_assistance BOOLEAN); INSERT INTO syria_assistance (org_id, org_name, year, medical_assistance) VALUES (1, 'WHO', 2017, TRUE), (2, 'UNICEF', 2018, TRUE), (3, 'MSF', 2019, TRUE), (4, 'IFRC', 2020, TRUE); CREATE TABLE yemen_assistance (org_...
Which organizations provided medical assistance in Syria and Yemen between 2017 and 2020?
SELECT o.org_name FROM syria_assistance s INNER JOIN yemen_assistance y ON s.org_name = y.org_name WHERE s.medical_assistance = TRUE AND y.medical_assistance = TRUE AND s.year BETWEEN 2017 AND 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE shipments (id INT, destination VARCHAR(20), delivery_time INT); INSERT INTO shipments (id, destination, delivery_time) VALUES (1, 'Africa', 8), (2, 'Africa', 10), (3, 'Africa', 9);
What is the maximum delivery time for shipments to 'Africa'?
SELECT MAX(delivery_time) FROM shipments WHERE destination = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE RuralInfrastructure (id INT, country VARCHAR(50), project VARCHAR(50), budget FLOAT, year INT); INSERT INTO RuralInfrastructure (id, country, project, budget, year) VALUES (1, 'Nigeria', 'Road Construction', 800000, 2020), (2, 'Nigeria', 'Bridge Building', 500000, 2019), (3, 'Kenya', 'Electricity Grid Expa...
What is the total budget for rural infrastructure projects in Nigeria in 2020?
SELECT SUM(budget) FROM RuralInfrastructure WHERE country = 'Nigeria' AND year = 2020;
gretelai_synthetic_text_to_sql