context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE Artworks (id INT, artist VARCHAR(20), title VARCHAR(50), year INT, type VARCHAR(20)); INSERT INTO Artworks (id, artist, title, year, type) VALUES (1, 'Asian Artist 1', 'Artwork 1', 2000, 'Painting'); INSERT INTO Artworks (id, artist, title, year, type) VALUES (2, 'Asian Artist 2', 'Artwork 2', 2005, 'Sculp...
How many artworks were created each year by Asian artists?
SELECT year, COUNT(*) AS artworks_per_year FROM Artworks WHERE artist LIKE 'Asian Artist%' GROUP BY year ORDER BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE residential (customer_id INT, water_usage FLOAT, usage_date DATE); INSERT INTO residential (customer_id, water_usage, usage_date) VALUES (1, 150.5, '2022-03-01'), (2, 250.7, '2022-03-02'), (3, 350.8, '2022-03-03');
Find the maximum water usage by residential customers in the month of March 2022.
SELECT MAX(water_usage) FROM residential WHERE usage_date BETWEEN '2022-03-01' AND '2022-03-31';
gretelai_synthetic_text_to_sql
CREATE TABLE workplaces (id INT, country VARCHAR(50), num_employees INT, has_cba BOOLEAN); INSERT INTO workplaces (id, country, num_employees, has_cba) VALUES (1, 'Canada', 200, true), (2, 'USA', 300, false);
What is the total number of workplaces with successful collective bargaining agreements in Canada in 2020?
SELECT COUNT(*) FROM workplaces WHERE country = 'Canada' AND has_cba = true;
gretelai_synthetic_text_to_sql
CREATE TABLE mining_sites (id INT, site_name VARCHAR(50), location VARCHAR(50), environmental_score FLOAT); INSERT INTO mining_sites (id, site_name, location, environmental_score) VALUES (1, 'Site A', 'Australia', 82.50);
List the mining sites in the 'Africa' region with environmental impact scores above 80.
SELECT site_name, environmental_score FROM mining_sites WHERE location LIKE 'Africa' AND environmental_score > 80.00;
gretelai_synthetic_text_to_sql
CREATE TABLE ArtWorks (ID INT PRIMARY KEY, Title TEXT, Artist TEXT, Year INT);
Update the year of artwork with ID 7 to 1889
UPDATE ArtWorks SET Year = 1889 WHERE ID = 7;
gretelai_synthetic_text_to_sql
CREATE TABLE conservation (id INT PRIMARY KEY, artifact_id INT, date DATE, notes TEXT);
Delete all records from the 'conservation' table that are older than 2005
DELETE FROM conservation WHERE date < '2005-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE deliveries (id INT, shipment_id INT, delivery_date DATE, delivery_time_days INT); INSERT INTO deliveries (id, shipment_id, delivery_date, delivery_time_days) VALUES (1, 1, '2021-04-01', 5); INSERT INTO deliveries (id, shipment_id, delivery_date, delivery_time_days) VALUES (2, 2, '2021-04-03', 7);
What is the minimum delivery time in days for shipments from India to the United Kingdom in April 2021?
SELECT MIN(delivery_time_days) FROM deliveries D INNER JOIN (SELECT id AS shipment_id FROM shipments WHERE origin_country = 'India' AND destination_country = 'United Kingdom' AND EXTRACT(MONTH FROM ship_date) = 4 AND EXTRACT(YEAR FROM ship_date) = 2021) AS S ON D.shipment_id = S.shipment_id;
gretelai_synthetic_text_to_sql
CREATE TABLE VehicleSales (id INT, vehicle_type VARCHAR(255), sale_date DATE, units_sold INT); INSERT INTO VehicleSales (id, vehicle_type, sale_date, units_sold) VALUES (1, 'Gasoline', '2017-01-01', 500); INSERT INTO VehicleSales (id, vehicle_type, sale_date, units_sold) VALUES (2, 'Electric', '2020-01-01', 800);
How many electric vehicles have been sold in California since 2018?
SELECT SUM(units_sold) FROM VehicleSales WHERE vehicle_type = 'Electric' AND sale_date >= '2018-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Digital_Engagement (id INT, city VARCHAR(20), num_visitors INT); INSERT INTO Digital_Engagement (id, city, num_visitors) VALUES (1, 'Tokyo', 1500), (2, 'Tokyo', 2000), (3, 'New York', 3000);
How many visitors engaged with digital installations in Tokyo and New York?'
SELECT SUM(num_visitors) FROM Digital_Engagement WHERE city IN ('Tokyo', 'New York');
gretelai_synthetic_text_to_sql
CREATE TABLE charging_stations (id INT, state TEXT, station_type TEXT, total_stations INT); INSERT INTO charging_stations (id, state, station_type, total_stations) VALUES (1, 'California', 'Fast', 50), (2, 'Texas', 'Standard', 40), (3, 'California', 'Standard', 60);
How many charging stations are there in 'California' and 'Texas' in the charging_stations table?
SELECT state, COUNT(*) as total_charging_stations FROM charging_stations WHERE state IN ('California', 'Texas') GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE Strains (strain_id INT, strain_name TEXT, state TEXT, sales_quantity INT); INSERT INTO Strains (strain_id, strain_name, state, sales_quantity) VALUES (1, 'Blue Dream', 'California', 500), (2, 'Girl Scout Cookies', 'California', 400), (3, 'Durban Poison', 'California', 300), (4, 'OG Kush', 'California', 250...
What are the top 5 strains sold in dispensaries in California, ordered by sales quantity?
SELECT strain_name, SUM(sales_quantity) as total_sales FROM Strains WHERE state = 'California' GROUP BY strain_name ORDER BY total_sales DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE Protected_Habitats (id INT, animal_type VARCHAR(50), size INT);
What is the maximum size of a protected habitat for each animal type?
SELECT animal_type, MAX(size) FROM Protected_Habitats GROUP BY animal_type;
gretelai_synthetic_text_to_sql
CREATE TABLE material_costs (id INT, material_type VARCHAR(255), project_type VARCHAR(255), cost FLOAT); INSERT INTO material_costs (id, material_type, project_type, cost) VALUES (1, 'Steel', 'Bridge', 150000.00), (2, 'Asphalt', 'Road', 50000.00), (3, 'Concrete', 'Building', 200000.00), (4, 'Steel', 'Building', 300000....
What is the total cost of concrete and steel materials used in public works projects?
SELECT SUM(cost) as total_cost FROM material_costs WHERE material_type IN ('Concrete', 'Steel');
gretelai_synthetic_text_to_sql
CREATE TABLE patients_no_improvement (patient_id INT, age INT, improvement CHAR(1)); INSERT INTO patients_no_improvement (patient_id, age, improvement) VALUES (1, 30, 'N'), (2, 25, 'N'), (3, 45, 'N');
What is the average age of patients who did not improve after therapy sessions?
SELECT AVG(age) as avg_age_no_improvement FROM patients_no_improvement WHERE improvement = 'N';
gretelai_synthetic_text_to_sql
CREATE TABLE Parks (Year INT, Action TEXT); INSERT INTO Parks (Year, Action) VALUES (2018, 'Renovated'), (2019, 'Renovated'), (2020, 'Renovated'), (2021, 'Renovated');
How many public parks were renovated each year from 2018 to 2021?
SELECT Year, COUNT(*) FROM Parks WHERE Action = 'Renovated' GROUP BY Year;
gretelai_synthetic_text_to_sql
CREATE TABLE shark_species (species_name TEXT, population INTEGER, ocean TEXT);
What is the average population of all shark species in the Atlantic Ocean?
SELECT AVG(population) FROM shark_species WHERE ocean = 'Atlantic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE srl_institutions (id INT PRIMARY KEY, institution_name VARCHAR(100), country VARCHAR(50)); INSERT INTO srl_institutions (id, institution_name, country) VALUES (1, 'Institution A', 'Country X'), (2, 'Institution B', 'Country Y'), (3, 'Institution C', 'Country Z');
Identify the number of socially responsible lending institutions in Country Y
SELECT COUNT(*) FROM srl_institutions WHERE country = 'Country Y';
gretelai_synthetic_text_to_sql
CREATE TABLE refugees (id INT, organization VARCHAR(255), location VARCHAR(255), assist_date DATE, gender VARCHAR(10), age INT); INSERT INTO refugees (id, organization, location, assist_date, gender, age) VALUES (1, 'UNHCR', 'Asia', '2019-02-12', 'Female', 34), (2, 'Red Cross', 'Asia', '2019-04-01', 'Male', 27), (3, 'S...
What is the total number of refugees assisted by each organization in Asia in 2019?
SELECT organization, COUNT(*) as total_refugees FROM refugees WHERE location = 'Asia' AND YEAR(assist_date) = 2019 GROUP BY organization;
gretelai_synthetic_text_to_sql
CREATE TABLE news_articles (id INT, title VARCHAR(100), publication_date DATE, author VARCHAR(50), word_count INT, gender VARCHAR(10), region VARCHAR(50)); INSERT INTO news_articles (id, title, publication_date, author, word_count, gender, region) VALUES (1, 'Article 1', '2022-01-01', 'John Doe', 500, 'Male', 'North Am...
What is the average word count of articles by gender and region in 'news_articles' table?
SELECT gender, region, AVG(word_count) as avg_word_count FROM news_articles GROUP BY gender, region;
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', 'Egypt'); CREATE TABLE artifacts (artifact_id INT, site_id INT, category VARCHAR(50));
Which artifact categories were most frequently excavated in Egypt?
SELECT a.category, COUNT(*) as frequency FROM excavation_sites e JOIN artifacts a ON e.site_id = a.site_id WHERE e.country = 'Egypt' GROUP BY a.category ORDER BY frequency DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE diversity_metrics (id INT PRIMARY KEY, startup_id INT, gender VARCHAR(10), underrepresented_group BOOLEAN);
Calculate the number of diversity metrics recorded
SELECT COUNT(*) FROM diversity_metrics;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (satellite_id INT, name VARCHAR(50), launch_date DATE, manufacturer VARCHAR(50)); INSERT INTO Satellites (satellite_id, name, launch_date, manufacturer) VALUES (1, 'Sat1', '2020-01-01', 'SpaceTech Inc.'), (2, 'Sat2', '2019-05-15', 'Orbital Inc.'), (3, 'Sat3', '2021-03-27', 'SpaceTech Inc.'), (4,...
Which satellites were deployed by both SpaceTech Inc. and Orbital Inc.?
SELECT name FROM Satellites WHERE manufacturer IN ('SpaceTech Inc.', 'Orbital Inc.') GROUP BY name HAVING COUNT(DISTINCT manufacturer) = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), sustainable_practices BOOLEAN); CREATE TABLE products (id INT PRIMARY KEY, name VARCHAR(255), supplier_id INT, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); CREATE TABLE sales (id INT PRIMARY KEY, product_id INT, quantity INT, ...
List all suppliers, products, and sales quantities for suppliers based in 'India' that use sustainable practices.
SELECT s.name AS supplier_name, p.name AS product_name, sales.quantity FROM sales JOIN products ON sales.product_id = products.id JOIN suppliers ON products.supplier_id = suppliers.id WHERE suppliers.location = 'India' AND suppliers.sustainable_practices = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE Budget (Id INT, Category VARCHAR(50), Amount DECIMAL(10, 2), Year INT); INSERT INTO Budget (Id, Category, Amount, Year) VALUES (1, 'Policy Advocacy', 50000, 2022);
What is the total budget allocated to policy advocacy efforts in 2022?
SELECT SUM(Amount) FROM Budget WHERE Category = 'Policy Advocacy' AND Year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE Vulnerabilities (id INT, report_date DATE, severity INT); INSERT INTO Vulnerabilities (id, report_date, severity) VALUES (1, '2022-04-01', 3), (2, '2022-04-15', 5), (3, '2022-05-01', 7);
What is the total number of high severity vulnerabilities found in the last month?
SELECT COUNT(*) FROM Vulnerabilities WHERE severity >= 5 AND report_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE Beneficiaries (id INT, name VARCHAR(50), gender VARCHAR(50), age INT, country VARCHAR(50), registration_date DATE); INSERT INTO Beneficiaries (id, name, gender, age, country, registration_date) VALUES (1, 'Ahmed', 'Male', 25, 'Egypt', '2020-12-12'), (2, 'Bella', 'Female', 35, 'Nigeria', '2021-01-01'), (3, ...
How many male and female beneficiaries are there in each country?
SELECT country, gender, COUNT(*) as count FROM Beneficiaries GROUP BY country, gender;
gretelai_synthetic_text_to_sql
CREATE TABLE network_towers (tower_id INT, city VARCHAR(50), connected_devices INT); INSERT INTO network_towers VALUES (1, 'CityA', 50), (2, 'CityB', 60), (3, 'CityC', 70);
Find the top 3 cities with the highest number of connected devices and the total number of connected devices in each city.
SELECT city, SUM(connected_devices) as total_connected_devices FROM (SELECT city, connected_devices, RANK() OVER(PARTITION BY city ORDER BY connected_devices DESC) as rank FROM network_towers) ranked_towers WHERE rank <= 3 GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE art_categories (id INT, category TEXT); INSERT INTO art_categories (id, category) VALUES (1, 'Sculpture'), (2, 'Painting'); CREATE TABLE art_market (id INT, title TEXT, category_id INT, price INT); INSERT INTO art_market (id, title, category_id, price) VALUES (1, 'The Persistence of Memory', 2, 20000000), ...
What are the average prices for sculptures and paintings in the modern art market?
SELECT AVG(price) as avg_price, category FROM art_market am INNER JOIN art_categories ac ON am.category_id = ac.id WHERE ac.category IN ('Sculpture', 'Painting') GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE Factories (FactoryID int, FactoryName varchar(50), Address varchar(100), Country varchar(50)); INSERT INTO Factories VALUES (1, 'Factory1', '123 Main St, China', 'China'); INSERT INTO Factories VALUES (2, 'Factory2', '456 Oak St, Germany', 'Germany'); INSERT INTO Factories VALUES (3, 'Factory3', '789 Elm S...
What is the average price of items manufactured by factories in 'Asia' and 'Europe'?
SELECT AVG(Products.Price) FROM Products INNER JOIN Factories ON Products.FactoryID = Factories.FactoryID WHERE Factories.Country = 'China' OR Factories.Country = 'Germany' OR Factories.Country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE sales (sale_id INT, product_id INT, sale_date DATE, revenue INT); INSERT INTO sales (sale_id, product_id, sale_date, revenue) VALUES (1, 1, '2022-01-01', 1000), (2, 2, '2022-01-02', 500), (3, 1, '2022-01-03', 1500);
What is the total revenue for each product category in the current year?
SELECT p.category, SUM(s.revenue) FROM sales s INNER JOIN products p ON s.product_id = p.product_id WHERE YEAR(s.sale_date) = YEAR(GETDATE()) GROUP BY p.category;
gretelai_synthetic_text_to_sql
CREATE TABLE Water_Conservation_Initiatives (State VARCHAR(20), Year INT, Score INT); INSERT INTO Water_Conservation_Initiatives (State, Year, Score) VALUES ('California', 2020, 85), ('Texas', 2020, 78), ('Florida', 2020, 82);
What are the top 3 states with the highest water conservation initiative scores in 2020?
SELECT State, MAX(Score) FROM Water_Conservation_Initiatives WHERE Year = 2020 GROUP BY State ORDER BY Score DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE Warehouse (id INT, name VARCHAR(20), city VARCHAR(20)); INSERT INTO Warehouse (id, name, city) VALUES (1, 'Seattle Warehouse', 'Seattle'), (2, 'NYC Warehouse', 'NYC'), (3, 'Chicago Warehouse', 'Chicago'); CREATE TABLE Packages (id INT, warehouse_id INT, status VARCHAR(20)); INSERT INTO Packages (id, wareho...
What is the count of packages in 'received' status at each warehouse?
SELECT warehouse_id, COUNT(*) FROM Packages WHERE status = 'received' GROUP BY warehouse_id;
gretelai_synthetic_text_to_sql
CREATE TABLE equipment_sales (eq_id INT, eq_type VARCHAR(50), sale_amount INT); INSERT INTO equipment_sales (eq_id, eq_type, sale_amount) VALUES (1, 'M1 Abrams', 5000000);
Get unique equipment types sold in 'Africa' with sales data
SELECT DISTINCT eq_type, SUM(sale_amount) AS total_sales_amount FROM equipment_sales es JOIN equipment e ON es.eq_id = e.eq_id WHERE e.region = 'Africa' GROUP BY eq_type;
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID int, DonorID int, DonationDate date, DonationAmount numeric); INSERT INTO Donations (DonationID, DonorID, DonationDate, DonationAmount) VALUES (1, 1, '2022-01-01', 500), (2, 1, '2022-02-01', 300), (3, 2, '2022-03-01', 800), (4, 2, '2022-04-01', 900), (5, 3, '2022-05-01', 700);
How many donations have been made by each donor, in descending order?
SELECT DonorID, COUNT(DonationID) NumDonations, RANK() OVER (ORDER BY COUNT(DonationID) DESC) DonorRank FROM Donations GROUP BY DonorID;
gretelai_synthetic_text_to_sql
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL(10,2), Country TEXT);
What is the maximum donation amount from donors in Mexico?
SELECT MAX(DonationAmount) FROM Donors WHERE Country = 'Mexico';
gretelai_synthetic_text_to_sql
CREATE TABLE diversity_metrics3 (metric_id INT, company_id INT, diverse_founder BOOLEAN); INSERT INTO diversity_metrics3 (metric_id, company_id, diverse_founder) VALUES (1, 1, TRUE), (2, 2, FALSE), (3, 3, TRUE), (4, 4, FALSE); CREATE TABLE company_founding2 (company_id INT, founding_year INT); INSERT INTO company_found...
Show startups with no diversity metrics records.
SELECT company_id FROM company_founding2 WHERE company_id NOT IN (SELECT company_id FROM diversity_metrics3);
gretelai_synthetic_text_to_sql
CREATE TABLE water_quality (farm_id INT, water_type VARCHAR(10), dissolved_oxygen FLOAT); INSERT INTO water_quality VALUES (1, 'Marine', 6.5), (2, 'Marine', 7.0), (3, 'Brackish', 5.5), (4, 'Freshwater', 8.0);
What is the minimum and maximum dissolved oxygen level in marine water farms?
SELECT MIN(dissolved_oxygen) AS 'Minimum Dissolved Oxygen', MAX(dissolved_oxygen) AS 'Maximum Dissolved Oxygen' FROM water_quality WHERE water_type = 'Marine';
gretelai_synthetic_text_to_sql
CREATE TABLE flight_safety (id INT, country VARCHAR(255), accident_date DATE, accident_type VARCHAR(255));
Which countries have the highest and lowest number of flight accidents in the last 5 years?
SELECT country, COUNT(*) as num_accidents FROM flight_safety WHERE accident_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 5 YEAR) GROUP BY country ORDER BY num_accidents DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Companies (id INT, name VARCHAR(50), industry VARCHAR(50), country VARCHAR(50), founding_year INT, founder_veteran VARCHAR(10)); CREATE TABLE Funding (id INT, company_name VARCHAR(50), funding_amount INT); INSERT INTO Companies (id, name, industry, country, founding_year, founder_veteran) VALUES (1, 'PayVe...
What is the total funding amount for companies founded by veterans in the Fintech industry?
SELECT SUM(funding_amount) as total_funding FROM Funding INNER JOIN Companies ON Funding.company_name = Companies.name WHERE Companies.industry = 'Fintech' AND Companies.founder_veteran = 'Yes';
gretelai_synthetic_text_to_sql
CREATE TABLE mines (id INT, name TEXT, location TEXT, annual_production INT); INSERT INTO mines (id, name, location, annual_production) VALUES (1, 'Mine A', 'Country X', 1500), (2, 'Mine B', 'Country Y', 2000), (3, 'Mine C', 'Country Z', 1750);
What was the average REE production per mine in 2018?
SELECT AVG(annual_production) as avg_production FROM mines WHERE YEAR(timestamp) = 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE AgentClaims (ClaimID INT, PolicyID INT, ClaimAmount DECIMAL(10, 2), ClaimDate DATE, AgentID INT); INSERT INTO AgentClaims VALUES (1, 1, 500, '2021-01-05', 1), (2, 2, 1000, '2022-02-10', 2), (3, 3, 750, '2021-03-15', 1), (4, 4, 1200, '2022-01-25', 2), (5, 5, 300, '2021-02-01', 3), (6, 6, 1500, '2022-03-01',...
What is the number of policies and total claim amount by agent and month?
SELECT a.AgentID, EXTRACT(MONTH FROM ac.ClaimDate) AS Month, COUNT(DISTINCT ac.PolicyID) AS Policies, SUM(ac.ClaimAmount) AS TotalClaimAmount FROM AgentClaims AS ac JOIN AgentSales AS asa ON ac.PolicyID = asa.PolicyID JOIN Agents AS a ON asa.AgentID = a.AgentID GROUP BY a.AgentID, Month;
gretelai_synthetic_text_to_sql
CREATE TABLE co2_emissions_reduction (initiative_id INT, initiative_name VARCHAR(50), region VARCHAR(50), year_started INT, co2_emissions_reduction DECIMAL(5, 2)); INSERT INTO co2_emissions_reduction (initiative_id, initiative_name, region, year_started, co2_emissions_reduction) VALUES (1, 'Green Energy Transition', 'S...
What is the average annual CO2 emissions reduction achieved by climate mitigation initiatives in Southeast Asia?
SELECT AVG(co2_emissions_reduction) FROM co2_emissions_reduction WHERE region = 'Southeast Asia';
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.startups (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), funding FLOAT);
Add a new biotech startup in the USA
INSERT INTO biotech.startups (id, name, location, funding) VALUES (4, 'StartupD', 'USA', 8000000);
gretelai_synthetic_text_to_sql
CREATE TABLE customer_transactions (transaction_id INT, customer_id INT, transaction_value DECIMAL(10, 2), transaction_date DATE, customer_region VARCHAR(20)); INSERT INTO customer_transactions (transaction_id, customer_id, transaction_value, transaction_date, customer_region) VALUES (1, 1, 20000, '2021-08-01', 'Latin ...
List all transactions with a value greater than $15,000, along with the customer ID and the transaction date, in descending order of transaction date for customers in Latin America?
SELECT * FROM customer_transactions WHERE transaction_value > 15000 AND customer_region = 'Latin America' ORDER BY transaction_date DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE CYBER_STRATEGIES (id INT PRIMARY KEY, country VARCHAR(255), strategy VARCHAR(255), year INT);
Which cybersecurity strategies were implemented in 'Country2' in the CYBER_STRATEGIES table?
SELECT strategy FROM CYBER_STRATEGIES WHERE country = 'Country2' AND year = (SELECT MAX(year) FROM CYBER_STRATEGIES WHERE country = 'Country2');
gretelai_synthetic_text_to_sql
CREATE TABLE mental_health_facilities (facility_id INT, name VARCHAR(50), type VARCHAR(50), state VARCHAR(50)); INSERT INTO mental_health_facilities (facility_id, name, type, state) VALUES (1, 'Example Facility 1', 'Inpatient', 'California'); INSERT INTO mental_health_facilities (facility_id, name, type, state) VALUES ...
How many mental health facilities of each type are there in the mental_health_facilities table?
SELECT type, COUNT(*) FROM mental_health_facilities GROUP BY type;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, state VARCHAR(50), month VARCHAR(50), revenue FLOAT); INSERT INTO sales (id, state, month, revenue) VALUES (1, 'New York', 'July', 50000.0), (2, 'New York', 'August', 60000.0), (3, 'New York', 'September', 70000.0);
What was the total revenue for the state of New York in the third quarter of 2022?
SELECT SUM(revenue) FROM sales WHERE state = 'New York' AND (month = 'July' OR month = 'August' OR month = 'September');
gretelai_synthetic_text_to_sql
CREATE TABLE emergency_responses (id INT, incident_id INT, response_time INT); CREATE TABLE emergency_incidents (id INT, incident_type VARCHAR(255), report_date DATE); INSERT INTO emergency_incidents (id, incident_type, report_date) VALUES (1, 'Medical Emergency', '2022-01-01'), (2, 'Fire', '2022-01-02'); INSERT INTO e...
What is the average response time for emergency incidents in the city of Los Angeles, categorized by incident type?
SELECT incident_type, AVG(response_time) FROM emergency_responses JOIN emergency_incidents ON emergency_responses.incident_id = emergency_incidents.id GROUP BY incident_type;
gretelai_synthetic_text_to_sql
CREATE TABLE cosmetics_sales (product_id INT, product_name VARCHAR(255), units_sold INT, revenue DECIMAL(10,2), sale_date DATE);
Delete records from the 'cosmetics_sales' table where the 'units_sold' is less than 10
DELETE FROM cosmetics_sales WHERE units_sold < 10;
gretelai_synthetic_text_to_sql
CREATE TABLE Tech_Projects (ID INT, Project_Name VARCHAR(100), Location VARCHAR(50), Budget DECIMAL(10,2)); INSERT INTO Tech_Projects (ID, Project_Name, Location, Budget) VALUES (1, 'Tech4All', 'Europe', 150000.00), (2, 'AI4Good', 'Asia', 200000.00), (3, 'EqualWeb', 'Europe', 180000.00);
What is the maximum budget for technology projects in Europe?
SELECT MAX(Budget) FROM Tech_Projects WHERE Location = 'Europe';
gretelai_synthetic_text_to_sql
CREATE TABLE fish_farms (farm_id INT, temperature FLOAT, year INT, region VARCHAR(255), PRIMARY KEY (farm_id, temperature, year)); INSERT INTO fish_farms (farm_id, temperature, year, region) VALUES (1, 2.5, 2018, 'Arctic Ocean'), (2, 3.0, 2019, 'Arctic Ocean'), (3, 3.5, 2020, 'Arctic Ocean');
What is the number of fish farms in the Arctic Ocean that have been impacted by climate change since 2018?
SELECT COUNT(*) FROM fish_farms WHERE temperature > (SELECT AVG(temperature) FROM fish_farms WHERE year < 2018 AND region = 'Arctic Ocean') AND region = 'Arctic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE space_missions (mission_id INT, mission_name VARCHAR(255), launch_country VARCHAR(50), launch_date DATE); INSERT INTO space_missions (mission_id, mission_name, launch_country, launch_date) VALUES (1, 'Apollo 11', 'USA', '1969-07-16'), (2, 'Sputnik 1', 'Russia', '1957-10-04');
What is the earliest launch date for each country that has launched a space mission?
SELECT launch_country, MIN(launch_date) FROM space_missions GROUP BY launch_country;
gretelai_synthetic_text_to_sql
CREATE TABLE ArtistConcertCount (ArtistID INT, AppearanceCount INT);
Which artist has the highest number of concert appearances in 2021?
SELECT A.Name, ACC.AppearanceCount FROM ArtistConcertCount ACC INNER JOIN Artists A ON ACC.ArtistID = A.ArtistID WHERE YEAR(C.Date) = 2021 GROUP BY A.Name ORDER BY ACC.AppearanceCount DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE public_transportation_routes (route_id INT, route_name TEXT, stop_sequence INT, stop_id INT, city TEXT, country TEXT);
Update the public transportation route with ID 402 to include a new stop
UPDATE public_transportation_routes SET stop_id = 803 WHERE route_id = 402 AND stop_sequence = 5;
gretelai_synthetic_text_to_sql
CREATE TABLE diversity_metrics (id INT, gender VARCHAR(10), race VARCHAR(30), department VARCHAR(50), total_count INT, hiring_rate DECIMAL(5,2));
Add a new diversity metric record into the "diversity_metrics" table
INSERT INTO diversity_metrics (id, gender, race, department, total_count, hiring_rate) VALUES (2001, 'Female', 'Hispanic', 'Marketing', 3, 0.75);
gretelai_synthetic_text_to_sql
CREATE TABLE threats (threat_type VARCHAR(255), organization VARCHAR(255), date DATE); INSERT INTO threats (threat_type, organization, date) VALUES ('Phishing', 'Org123', '2022-01-01'), ('Malware', 'Org123', '2022-01-05'), ('Ransomware', 'Org123', '2022-01-10'), ('Phishing', 'Org123', '2022-02-01'), ('Phishing', 'Org12...
Identify the top 3 most common types of threats and their frequency in the last 3 months, for a specific organization 'Org123'?
SELECT threat_type, COUNT(threat_type) as frequency FROM threats WHERE organization = 'Org123' AND date >= DATEADD(month, -3, GETDATE()) GROUP BY threat_type ORDER BY frequency DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE Advocacy (AdvocacyID INT, InitiativeName VARCHAR(50), LaunchDate DATE); INSERT INTO Advocacy (AdvocacyID, InitiativeName, LaunchDate) VALUES (1, 'Inclusive Education', '2018-05-05'), (2, 'Employment Equity', '2019-08-28'), (3, 'Accessible Transportation', '2018-12-12'), (4, 'Digital Accessibility', '2020-0...
How many policy advocacy initiatives were launched per year?
SELECT EXTRACT(YEAR FROM LaunchDate) as Year, COUNT(*) as InitiativeCount FROM Advocacy GROUP BY Year;
gretelai_synthetic_text_to_sql
CREATE TABLE Sustainable_Projects (project_id INT, project_name VARCHAR(50), state VARCHAR(2), cost FLOAT); INSERT INTO Sustainable_Projects VALUES (1, 'Greenville Library', 'TX', 5000000);
What is the total cost of sustainable building projects in Texas?
SELECT SUM(cost) FROM Sustainable_Projects WHERE state = 'TX';
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (id INT, name TEXT); INSERT INTO Artists (id, name) VALUES (1, 'Pablo Picasso'); CREATE TABLE Artwork (id INT, title TEXT, artist_id INT); INSERT INTO Artwork (id, title, artist_id) VALUES (1, 'Guernica', 1), (2, 'Three Musicians', 1);
Delete paintings from artist 'Pablo Picasso' in 'Artwork' table.
DELETE FROM Artwork WHERE artist_id = (SELECT id FROM Artists WHERE name = 'Pablo Picasso');
gretelai_synthetic_text_to_sql
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Region TEXT, DonationAmount DECIMAL(10,2)); INSERT INTO Donors VALUES (1, 'John Smith', 'Asia-Pacific', 500.00), (2, 'Jane Doe', 'Americas', 300.00), (3, 'Mary Major', 'Asia-Pacific', 750.00);
What is the average donation amount per donor in the Asia-Pacific region, excluding the top 10 donors?
SELECT AVG(DonationAmount) FROM (SELECT DonationAmount, ROW_NUMBER() OVER (PARTITION BY Region ORDER BY DonationAmount DESC) as rn FROM Donors WHERE Region = 'Asia-Pacific') tmp WHERE rn > 10;
gretelai_synthetic_text_to_sql
CREATE TABLE regulatory_frameworks (framework_id INT PRIMARY KEY, framework_name VARCHAR(50), country VARCHAR(50)); INSERT INTO regulatory_frameworks (framework_id, framework_name, country) VALUES (1, 'Framework1', 'USA'); INSERT INTO regulatory_frameworks (framework_id, framework_name, country) VALUES (2, 'Framework2'...
What are the regulatory frameworks in place for decentralized applications in India?
SELECT framework_name FROM regulatory_frameworks WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE AircraftManufacturing (aircraft_id INT, model VARCHAR(255), manufacturer VARCHAR(255), manufacturing_date DATE, country VARCHAR(255));
List all aircraft models manufactured by AeroTech in South America with a manufacturing date on or after 2015-01-01.
SELECT model FROM AircraftManufacturing WHERE manufacturer = 'AeroTech' AND manufacturing_date >= '2015-01-01' AND country = 'South America';
gretelai_synthetic_text_to_sql
CREATE TABLE sales_representatives (id INT, name TEXT, region TEXT, sales FLOAT); INSERT INTO sales_representatives (id, name, region, sales) VALUES (1, 'John Doe', 'North', 5000), (2, 'Jane Smith', 'South', 6000), (3, 'Alice Johnson', 'East', 7000), (4, 'Bob Williams', 'West', 8000);
What is the total sales amount for each sales representative, ordered by total sales in descending order?
SELECT name, SUM(sales) as total_sales FROM sales_representatives GROUP BY name ORDER BY total_sales DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Startups (ID INT, Name VARCHAR(50), Funding FLOAT, Year INT, Industry VARCHAR(50)); INSERT INTO Startups (ID, Name, Funding, Year, Industry) VALUES (1, 'GreenGenes', 5000000, 2020, 'Genetic Research'); INSERT INTO Startups (ID, Name, Funding, Year, Industry) VALUES (2, 'BioSense', 3000000, 2019, 'Biosensor...
What is the total funding received by bioprocess engineering startups?
SELECT Industry, SUM(Funding) FROM Startups WHERE Industry = 'Bioprocess Engineering' GROUP BY Industry;
gretelai_synthetic_text_to_sql
CREATE TABLE community_policing (id INT, event_date DATE, event_type VARCHAR(255)); INSERT INTO community_policing (id, event_date, event_type) VALUES (1, '2020-01-01', 'Meeting'), (2, '2021-01-01', 'Training');
Delete community_policing records older than 2 years
DELETE FROM community_policing WHERE event_date < (CURRENT_DATE - INTERVAL '2 years');
gretelai_synthetic_text_to_sql
CREATE TABLE neighborhoods (neighborhood VARCHAR(255), city VARCHAR(255), housing_affordability_index FLOAT);
Identify the top 5 neighborhoods with the highest average housing affordability index and their corresponding city.
SELECT neighborhood, city, AVG(housing_affordability_index) as avg_affordability_index FROM neighborhoods GROUP BY neighborhood, city ORDER BY avg_affordability_index DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE HeritageSites (id INT PRIMARY KEY, name VARCHAR(255), visitors INT, complaints INT); INSERT INTO HeritageSites (id, name, visitors, complaints) VALUES (1, 'Site A', 1000, 5), (2, 'Site B', 1500, 3);
Update the number of complaints for 'Site A' to 6 in the HeritageSites table.
UPDATE HeritageSites SET complaints = 6 WHERE name = 'Site A';
gretelai_synthetic_text_to_sql
CREATE TABLE states (id INT, name VARCHAR(255)); INSERT INTO states (id, name) VALUES (1, 'California'); CREATE TABLE wastewater_treatment (id INT, state_id INT, volume FLOAT, treatment_date DATE); INSERT INTO wastewater_treatment (id, state_id, volume, treatment_date) VALUES (1, 1, 1000, '2022-01-01');
Calculate the total volume of wastewater treated in the state of California, USA in the last quarter
SELECT SUM(wastewater_treatment.volume) as total_volume FROM wastewater_treatment WHERE wastewater_treatment.treatment_date >= (CURRENT_DATE - INTERVAL '3 months')::date AND wastewater_treatment.state_id IN (SELECT id FROM states WHERE name = 'California');
gretelai_synthetic_text_to_sql
CREATE TABLE forests (id INT, region VARCHAR(50)); INSERT INTO forests (id, region) VALUES (1, 'Asian'); CREATE TABLE species (id INT, name VARCHAR(50), is_protected BOOLEAN); INSERT INTO species (id, name, is_protected) VALUES (1, 'Tiger', true);
List all protected species in 'Asian' forests.
SELECT species.name FROM species JOIN forests ON FALSE WHERE forests.region = 'Asian' AND species.is_protected = true;
gretelai_synthetic_text_to_sql
CREATE TABLE vulnerabilities (id INT, severity VARCHAR(10), open_date DATE, close_date DATE);
What is the trend of open vulnerabilities by severity over the last year?
SELECT severity, COUNT(*) as vulnerability_count, DATEADD(month, DATEDIFF(month, 0, open_date), 0) as month FROM vulnerabilities WHERE close_date IS NULL GROUP BY severity, DATEADD(month, DATEDIFF(month, 0, open_date), 0) ORDER BY month, severity;
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_mix (id INT, date DATE, country VARCHAR(20), renewable_percentage DECIMAL(5,2)); INSERT INTO renewable_mix (id, date, country, renewable_percentage) VALUES (3, '2021-01-03', 'Australia', 35.00); INSERT INTO renewable_mix (id, date, country, renewable_percentage) VALUES (4, '2021-01-04', 'Argentin...
What is the renewable energy percentage for Australia on 2021-01-03?
SELECT renewable_percentage FROM renewable_mix WHERE date = '2021-01-03' AND country = 'Australia';
gretelai_synthetic_text_to_sql
CREATE TABLE games (id INT, game_date DATE, team VARCHAR(20)); CREATE TABLE goals (id INT, game_id INT, player VARCHAR(20), goals INT);
What is the average number of goals scored per game by each soccer player in the last season, broken down by team?
SELECT team, player, AVG(goals) FROM goals JOIN games ON goals.game_id = games.id WHERE games.game_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY team, player;
gretelai_synthetic_text_to_sql
CREATE TABLE CyberThreats (id INT, country VARCHAR(50), threat_type VARCHAR(50), threat_date DATE); INSERT INTO CyberThreats (id, country, threat_type, threat_date) VALUES (1, 'South Korea', 'Phishing', '2021-01-12'), (2, 'South Korea', 'Ransomware', '2021-03-25'), (3, 'South Korea', 'Malware', '2021-05-08');
What is the minimum number of cyber threats detected by the military in South Korea in the last 6 months?
SELECT MIN(frequency) FROM (SELECT COUNT(*) AS frequency FROM CyberThreats WHERE country = 'South Korea' AND threat_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY threat_type) AS subquery;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, date DATE, item VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO sales (id, date, item, revenue) VALUES (1, '2021-01-01', 'Postcard', 1.50), (2, '2021-02-01', 'Mug', 10.00), (3, '2021-03-01', 'T-shirt', 20.00);
What is the total revenue for museum shop sales by month?
SELECT DATE_FORMAT(date, '%Y-%m') as month, SUM(revenue) as total_revenue FROM sales GROUP BY month ORDER BY STR_TO_DATE(month, '%Y-%m');
gretelai_synthetic_text_to_sql
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(50), size FLOAT, ocean VARCHAR(20)); INSERT INTO marine_protected_areas (id, name, size, ocean) VALUES (1, 'Northwest Passage', 123000, 'Arctic'); INSERT INTO marine_protected_areas (id, name, size, ocean) VALUES (2, 'Arctic National Wildlife Refuge', 780000, 'A...
Display the number of marine protected areas and their total size in the Arctic region.
SELECT COUNT(*), SUM(size) FROM marine_protected_areas WHERE ocean = 'Arctic';
gretelai_synthetic_text_to_sql
CREATE TABLE road_materials (material_id INT, road_id INT, material VARCHAR(50)); CREATE TABLE materials (material_id INT, material_name VARCHAR(50), quantity INT); CREATE TABLE roads (road_id INT, state VARCHAR(50), length INT);
What are the top 3 materials used in road construction in Texas?
SELECT materials.material_name, SUM(materials.quantity) as total_quantity FROM road_materials JOIN materials ON road_materials.material_id = materials.material_id JOIN roads ON road_materials.road_id = roads.road_id WHERE roads.state = 'Texas' GROUP BY materials.material_name ORDER BY total_quantity DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy.solar_power (project_name VARCHAR(30), capacity INT);
What is the minimum and maximum renewable energy capacity (in MW) for solar power projects in the 'renewable_energy' schema?
SELECT MIN(capacity) AS min_capacity, MAX(capacity) AS max_capacity FROM renewable_energy.solar_power;
gretelai_synthetic_text_to_sql
CREATE TABLE members (id INT, gender VARCHAR(10)); CREATE TABLE workouts (id INT, member_id INT, workout_type VARCHAR(20), workout_date DATE);
Show the top 5 most popular workout types by total number of workouts for female members.
SELECT w.workout_type, COUNT(*) as total_workouts FROM members m INNER JOIN workouts w ON m.id = w.member_id WHERE m.gender = 'female' GROUP BY w.workout_type ORDER BY total_workouts DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE telescopes (id INT, name VARCHAR(255), type VARCHAR(255), agency VARCHAR(255), PRIMARY KEY(id)); INSERT INTO telescopes (id, name, type, agency) VALUES (1, 'Telescope1', 'Optical', 'Agency1'), (2, 'Telescope2', 'Radio', 'Agency2'), (3, 'Telescope3', 'Infrared', 'Agency1');
What is the total number of telescopes operated by space agencies and their types?
SELECT telescopes.agency, COUNT(telescopes.id), telescopes.type FROM telescopes GROUP BY telescopes.agency, telescopes.type;
gretelai_synthetic_text_to_sql
CREATE TABLE Properties (id INT, price INT, state TEXT); INSERT INTO Properties (id, price, state) VALUES (1, 500000, 'California'), (2, 400000, 'California'), (3, 700000, 'Colorado'), (4, 600000, 'Texas');
What is the total number of properties and the average price in the state of California?
SELECT COUNT(*) AS total_properties, AVG(price) AS avg_price FROM Properties WHERE state = 'California';
gretelai_synthetic_text_to_sql
CREATE TABLE cannabis_growers (license_number VARCHAR(10), grower_name VARCHAR(50));
Insert new record into 'cannabis_growers' table with data: license_number: 789B, grower_name: 'EcoCann'
INSERT INTO cannabis_growers (license_number, grower_name) VALUES ('789B', 'EcoCann');
gretelai_synthetic_text_to_sql
CREATE TABLE months (month_id INT, month_name VARCHAR(255)); CREATE TABLE products (product_id INT, product_name VARCHAR(255), is_refillable BOOLEAN, sales INT, month_id INT);
What is the total sales of refillable cosmetic products by month?
SELECT m.month_name, SUM(p.sales) as total_sales FROM months m INNER JOIN products p ON m.month_id = p.month_id WHERE p.is_refillable = TRUE GROUP BY m.month_name;
gretelai_synthetic_text_to_sql
CREATE TABLE WastewaterTreatmentFacilities (FacilityID INT, FacilityName VARCHAR(255), Address VARCHAR(255), City VARCHAR(255), State VARCHAR(255), ZipCode VARCHAR(10)); INSERT INTO WastewaterTreatmentFacilities (FacilityID, FacilityName, Address, City, State, ZipCode) VALUES (1, 'Clear Water Plant', '1234 5th St', 'Ho...
What are the water conservation initiatives implemented in the Greenville Wastewater Treatment Plant in 2022?
SELECT InitiativeName FROM WaterConservationInitiatives WHERE FacilityID = 2 AND StartDate <= '2022-12-31' AND EndDate >= '2022-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Attorneys (AttorneyID int, HourlyRate decimal(5,2), Losses int); INSERT INTO Attorneys (AttorneyID, HourlyRate, Losses) VALUES (1, 300.00, 0), (2, 250.00, 1), (3, 350.00, 0);
What is the maximum hourly rate for attorneys who have never lost a case?
SELECT MAX(HourlyRate) AS MaxHourlyRate FROM Attorneys WHERE Losses = 0;
gretelai_synthetic_text_to_sql
CREATE TABLE Farming_Sites (Site_ID INT, Site_Name TEXT, Water_Temperature INT); INSERT INTO Farming_Sites (Site_ID, Site_Name, Water_Temperature) VALUES (1, 'Site A', 20), (2, 'Site B', 30), (3, 'Site C', 25); CREATE TABLE Fish_Stock (Site_ID INT, Fish_Type TEXT, Biomass FLOAT); INSERT INTO Fish_Stock (Site_ID, Fish_T...
What is the list of fish types farmed in sites with water temperature above 25 degrees Celsius?
SELECT Fish_Type FROM Fish_Stock INNER JOIN Farming_Sites ON Fish_Stock.Site_ID = Farming_Sites.Site_ID WHERE Water_Temperature > 25;
gretelai_synthetic_text_to_sql
CREATE TABLE drugs (drug_id INT, drug_name VARCHAR(255), manufacturer VARCHAR(255)); INSERT INTO drugs (drug_id, drug_name, manufacturer) VALUES (1, 'DrugA', 'Manufacturer1'); CREATE TABLE sales (sale_id INT, drug_id INT, sale_amount DECIMAL(10,2), sale_tax DECIMAL(10,2), country VARCHAR(255)); INSERT INTO sales (sale_...
What are the total sales for each drug, including sales tax, in the Canadian market?
SELECT d.drug_name, SUM(s.sale_amount + s.sale_tax) as total_sales_with_tax FROM drugs d JOIN sales s ON d.drug_id = s.drug_id WHERE s.country = 'Canada' GROUP BY d.drug_name;
gretelai_synthetic_text_to_sql
CREATE TABLE space_missions (mission_id INT, mission_country VARCHAR(100), mission_year INT);
How many space missions were attempted by each country?
SELECT mission_country, COUNT(*) FROM space_missions GROUP BY mission_country;
gretelai_synthetic_text_to_sql
CREATE TABLE PlayerPreferences (PlayerID INT, AgeGroup VARCHAR(10), VRPreference INT); INSERT INTO PlayerPreferences (PlayerID, AgeGroup, VRPreference) VALUES (1, '18-24', 1), (2, '25-34', 0), (3, '18-24', 1), (4, '35-44', 0);
What is the total number of players who prefer VR technology, grouped by age?
SELECT AgeGroup, SUM(VRPreference) FROM PlayerPreferences GROUP BY AgeGroup;
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, sector VARCHAR(20), investment_amount FLOAT)
What is the total investment in 'sustainable_infrastructure' projects?
SELECT SUM(investment_amount) FROM projects WHERE sector = 'sustainable_infrastructure'
gretelai_synthetic_text_to_sql
CREATE TABLE articles (id INT PRIMARY KEY, title TEXT NOT NULL, author_id INT, published_at DATE); CREATE TABLE authors (id INT PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE views (article_id INT, visitor_id INT);
Show the number of unique visitors for a specific article, including the article's title and author
SELECT articles.title, authors.name, COUNT(DISTINCT views.visitor_id) as unique_visitors FROM articles INNER JOIN authors ON articles.author_id = authors.id INNER JOIN views ON articles.id = views.article_id WHERE articles.id = 'specific_article_id' GROUP BY articles.title, authors.name;
gretelai_synthetic_text_to_sql
CREATE SCHEMA carbon_pricing; CREATE TABLE carbon_pricing_policies (name TEXT, description TEXT); INSERT INTO carbon_pricing_policies (name, description) VALUES ('Policy A', 'Text A'), ('Policy B', 'Text B');
How many carbon pricing policies are there in the 'carbon_pricing' schema?
SELECT COUNT(*) FROM carbon_pricing.carbon_pricing_policies;
gretelai_synthetic_text_to_sql
CREATE TABLE Events (EventID INT, EventName TEXT, EventDate DATE, AttendeeAge INT); INSERT INTO Events (EventID, EventName, EventDate, AttendeeAge) VALUES (1, 'Art Exhibition', '2021-06-01', 28), (2, 'Theater Performance', '2021-07-15', 32), (3, 'Music Concert', '2020-12-31', 26);
How many events were attended by people aged 25-34 in the last 6 months?
SELECT COUNT(*) FROM Events WHERE AttendeeAge BETWEEN 25 AND 34 AND EventDate >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE health_equity_metrics (id INT, community_health_worker_id INT, score INT); INSERT INTO health_equity_metrics (id, community_health_worker_id, score) VALUES (1, 1, 80), (2, 2, 90), (3, 3, 95), (4, 4, 70), (5, 6, 65); CREATE TABLE community_health_workers (id INT, name VARCHAR(100), state VARCHAR(50)); INSER...
What is the minimum health equity metric score for community health workers in Florida?
SELECT MIN(score) FROM health_equity_metrics JOIN community_health_workers ON health_equity_metrics.community_health_worker_id = community_health_workers.id WHERE community_health_workers.state = 'Florida';
gretelai_synthetic_text_to_sql
CREATE TABLE plants (plant_id INT, plant_name VARCHAR(50), region VARCHAR(50), production_capacity INT); INSERT INTO plants (plant_id, plant_name, region, production_capacity) VALUES (1, 'Plant A', 'Northeast', 500), (2, 'Plant B', 'Midwest', 600);
What is the maximum production capacity for the chemical plants in a specific region?
SELECT plant_name, MAX(production_capacity) FROM plants WHERE region = 'Northeast';
gretelai_synthetic_text_to_sql
CREATE TABLE Shipments (id INT, source VARCHAR(50), destination VARCHAR(50), weight FLOAT, ship_date DATE); INSERT INTO Shipments (id, source, destination, weight, ship_date) VALUES (12, 'Nigeria', 'China', 500, '2022-06-01'); INSERT INTO Shipments (id, source, destination, weight, ship_date) VALUES (13, 'Egypt', 'Japa...
What was the total weight of shipments from Africa to Asia in June 2022?
SELECT SUM(weight) FROM Shipments WHERE (source = 'Nigeria' OR source = 'Egypt' OR source = 'South Africa') AND (destination = 'China' OR destination = 'Japan' OR destination = 'India') AND ship_date = '2022-06-01';
gretelai_synthetic_text_to_sql
CREATE TABLE oceania_visitors (id INT, name TEXT, country TEXT, visit_date DATE);
Show the total number of international visitors to all countries in Oceania in the last year.
SELECT country, COUNT(*) AS visitor_count FROM oceania_visitors WHERE visit_date > DATEADD(year, -1, GETDATE()) GROUP BY country; SELECT SUM(visitor_count) AS total_visitor_count FROM ( SELECT country, COUNT(*) AS visitor_count FROM oceania_visitors WHERE visit_date > DATEADD(year, -1, GETDATE()) GROUP BY country ) AS ...
gretelai_synthetic_text_to_sql
CREATE TABLE CountryFoodIntake (CountryName VARCHAR(50), Continent VARCHAR(50), Year INT, CaloriesPerPerson INT); INSERT INTO CountryFoodIntake (CountryName, Continent, Year, CaloriesPerPerson) VALUES ('United States', 'North America', 2021, 3800), ('Mexico', 'North America', 2021, 3400), ('Italy', 'Europe', 2021, 3200...
What is the total calorie intake for each continent in 2021?
SELECT Continent, SUM(CaloriesPerPerson) FROM CountryFoodIntake WHERE Year = 2021 GROUP BY Continent;
gretelai_synthetic_text_to_sql
CREATE TABLE Investors (InvestorID INT, InvestorName VARCHAR(50)); CREATE TABLE Founders (FounderID INT, FounderName VARCHAR(50), Ethnicity VARCHAR(20)); CREATE TABLE Investments (InvestmentID INT, InvestorID INT, FounderID INT, InvestmentAmount DECIMAL(10, 2));
What is the total investment amount by each investor for diverse founders?
SELECT I.InvestorName, SUM(I.InvestmentAmount) AS TotalInvestment FROM Investments I JOIN Founders F ON I.FounderID = Founders.FounderID WHERE F.Ethnicity IN ('African', 'Hispanic', 'Asian', 'Indigenous') GROUP BY I.InvestorID;
gretelai_synthetic_text_to_sql
CREATE TABLE timber_production_volume_2(year INT, region VARCHAR(255), species VARCHAR(255), volume FLOAT); INSERT INTO timber_production_volume_2(year, region, species, volume) VALUES (2016, 'Asia', 'Pine', 1100.0), (2016, 'Asia', 'Oak', 1400.0), (2017, 'Africa', 'Pine', 1200.0), (2017, 'Africa', 'Oak', 1500.0), (2018...
What is the total volume of timber production for each species in the African region in 2017 and 2018?
SELECT species, SUM(volume) as total_volume FROM timber_production_volume_2 WHERE region = 'Africa' AND year IN (2017, 2018) GROUP BY species;
gretelai_synthetic_text_to_sql
CREATE TABLE Song (Title VARCHAR(30), Genre VARCHAR(10), Duration FLOAT); INSERT INTO Song (Title, Genre, Duration) VALUES ('Song1', 'Jazz', 3.45), ('Song2', 'Jazz', 4.23), ('Song3', 'Jazz', 2.87), ('Song4', 'Pop', 3.12), ('Song5', 'Rock', 2.98), ('Song6', 'Jazz', 3.66);
What is the average duration of songs in the jazz genre?
SELECT AVG(Duration) FROM Song WHERE Genre = 'Jazz';
gretelai_synthetic_text_to_sql