context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE organic_inventory (item_id INT, item_name VARCHAR(255), category VARCHAR(255), quantity INT, unit_price DECIMAL(5,2)); INSERT INTO organic_inventory (item_id, item_name, category, quantity, unit_price) VALUES (1, 'Apples', 'Fruits', 100, 0.99), (2, 'Bananas', 'Fruits', 150, 0.69), (3, 'Carrots', 'Vegetable... | List the top 3 organic items with the lowest inventory value? | SELECT item_name, quantity * unit_price as total_value FROM organic_inventory ORDER BY total_value LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE accidents (id INT, province VARCHAR(50), industry VARCHAR(50), num_accidents INT); INSERT INTO accidents (id, province, industry, num_accidents) VALUES (1, 'Ontario', 'mining', 50); INSERT INTO accidents (id, province, industry, num_accidents) VALUES (2, 'Quebec', 'mining', 30); INSERT INTO accidents (id, ... | What is the total number of mining accidents in each province in Canada? | SELECT province, SUM(num_accidents) FROM accidents WHERE industry = 'mining' GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers(supplier_id INT, supplier_name TEXT); INSERT INTO suppliers(supplier_id, supplier_name) VALUES (1, 'Plant-Based Leather Inc'), (2, 'Eco-Friendly Leathers Ltd'); CREATE TABLE products(product_id INT, product_name TEXT, supplier_id INT, price DECIMAL, quantity INT); INSERT INTO products(product_id,... | What is the total quantity of 'vegan leather' products sold by each supplier? | SELECT suppliers.supplier_name, SUM(products.quantity) FROM suppliers JOIN products ON suppliers.supplier_id = products.supplier_id JOIN sales ON products.product_id = sales.product_id WHERE products.product_name LIKE '%vegan leather%' GROUP BY suppliers.supplier_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableBuildings (id INT, project_start DATE, project_end DATE, city VARCHAR(20)); INSERT INTO SustainableBuildings (id, project_start, project_end, city) VALUES (1, '2020-01-01', '2020-04-01', 'New York'), (2, '2019-06-15', '2019-11-30', 'Los Angeles'); | How many sustainable building projects were completed in New York in 2020? | SELECT COUNT(*) FROM SustainableBuildings WHERE city = 'New York' AND YEAR(project_start) = 2020 AND YEAR(project_end) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE DepartmentGrants (Department VARCHAR(50), GrantID INT, GrantAmount DECIMAL(10,2)); INSERT INTO DepartmentGrants (Department, GrantID, GrantAmount) VALUES ('Chemistry', 1, 50000); INSERT INTO DepartmentGrants (Department, GrantID, GrantAmount) VALUES ('Biology', 2, 75000); INSERT INTO DepartmentGrants (Depa... | Display the total grant amount awarded to each department. | SELECT Department, SUM(GrantAmount) as TotalGrantAmount FROM DepartmentGrants GROUP BY Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT PRIMARY KEY, ArtistName VARCHAR(100), Age INT, Genre VARCHAR(50)); INSERT INTO Artists (ArtistID, ArtistName, Age, Genre) VALUES (1, 'Artist A', 35, 'Rock'), (2, 'Artist B', 45, 'Jazz'), (3, 'Artist C', 28, 'Rock'); | What is the average age of all rock artists in the database? | SELECT AVG(Age) FROM Artists WHERE Genre = 'Rock'; | gretelai_synthetic_text_to_sql |
CREATE TABLE content (id INT, title VARCHAR(255), region VARCHAR(255)); INSERT INTO content (id, title, region) VALUES (1, 'Content1', 'North America'), (2, 'Content2', 'Europe'), (3, 'Content3', 'Asia'), (4, 'Content4', 'Africa'), (5, 'Content5', 'South America'); | What is the distribution of content by region? | SELECT region, COUNT(*) as count FROM content GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, menu_item VARCHAR(255), revenue INT, sale_date DATE); INSERT INTO sales (sale_id, menu_item, revenue, sale_date) VALUES (1, 'Impossible Burger', 500, '2022-01-01'), (2, 'Beyond Sausage', 700, '2022-01-02'), (3, 'Local Greens Salad', 600, '2022-02-01'), (4, 'Tofu Stir Fry', 800, '2022-02... | Show the monthly revenue trend for the top 2 revenue-generating menu items? | SELECT DATE_FORMAT(s.sale_date, '%Y-%m') AS month, m.menu_item, SUM(s.revenue) AS monthly_revenue FROM sales s JOIN (SELECT menu_item, MAX(revenue) AS max_revenue FROM sales GROUP BY menu_item LIMIT 2) ms ON s.menu_item = ms.menu_item JOIN menu m ON s.menu_item = m.menu_item GROUP BY m.menu_item, month ORDER BY monthly... | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, name VARCHAR(50), population INT, country VARCHAR(50)); INSERT INTO cities (id, name, population, country) VALUES (1, 'New York', 8500000, 'USA'), (2, 'Los Angeles', 4000000, 'USA'), (3, 'Chicago', 2700000, 'USA'), (4, 'Houston', 2300000, 'USA'), (5, 'Phoenix', 1700000, 'USA'); | List of cities in the USA with population over 500,000 in descending order by population size. | SELECT name FROM cities WHERE country = 'USA' AND population > 500000 ORDER BY population DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_design (game_id INT, game_name VARCHAR(50), genre VARCHAR(50), rating FLOAT); | List games from 'game_design' table with ratings higher than the average rating | SELECT * FROM game_design WHERE rating > (SELECT AVG(rating) FROM game_design); | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (permit_number TEXT, contractor TEXT); INSERT INTO building_permits (permit_number, contractor) VALUES ('2022-005', 'Contractor C'); | Delete permit 2022-005 from the database | WITH cte AS (DELETE FROM building_permits WHERE permit_number = '2022-005') SELECT * FROM cte; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmStocks (FarmID INT, Species VARCHAR(20), Biomass FLOAT); CREATE TABLE Farms (FarmID INT, FarmName VARCHAR(50)); INSERT INTO Farms (FarmID, FarmName) VALUES (1, 'Farm A'), (2, 'Farm B'); INSERT INTO FarmStocks (FarmID, Species, Biomass) VALUES (1, 'Tilapia', 1500), (1, 'Salmon', 2000), (2, 'Trout', 2500... | What is the total biomass of fish in each aquaculture farm? | SELECT FarmName, SUM(Biomass) FROM FarmStocks JOIN Farms ON FarmStocks.FarmID = Farms.FarmID GROUP BY FarmName; | gretelai_synthetic_text_to_sql |
CREATE TABLE geothermal_plants (id INT, name VARCHAR(255), location VARCHAR(255), capacity FLOAT); INSERT INTO geothermal_plants (id, name, location, capacity) VALUES (1, 'Sinabung Geothermal Power Plant', 'Indonesia', 190.0); INSERT INTO geothermal_plants (id, name, location, capacity) VALUES (2, 'Darajat Geothermal P... | What is the total installed capacity of geothermal plants in Indonesia? | SELECT SUM(capacity) FROM geothermal_plants WHERE location = 'Indonesia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_program (program_id INT, program_name TEXT, org_id INT); INSERT INTO support_program (program_id, program_name, org_id) VALUES (1, 'Adaptive Sports', 1); INSERT INTO support_program (program_id, program_name, org_id) VALUES (2, 'Assistive Technology', 2); INSERT INTO support_program (program_id, pr... | Delete the record for 'Sign Language Interpreter' from the support_program table. | DELETE FROM support_program WHERE program_name = 'Sign Language Interpreter'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name VARCHAR(50), ethnicity VARCHAR(50), gender VARCHAR(10)); INSERT INTO patients (id, name, ethnicity, gender) VALUES (1, 'John Doe', 'Caucasian', 'Male'), (2, 'Jane Smith', 'African American', 'Female'), (3, 'Alice Johnson', 'Hispanic', 'Female'); | What is the percentage of patients by ethnicity and gender? | SELECT ethnicity, gender, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM patients) AS percentage FROM patients GROUP BY ethnicity, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE paris_bikeshare (id INT, ride_time TIME, is_weekday BOOLEAN, trip_duration INT); INSERT INTO paris_bikeshare (id, ride_time, is_weekday, trip_duration) VALUES (1, '07:30:00', TRUE, 30), (2, '18:45:00', TRUE, 45); | Find the total number of bike-share trips taken in Paris during rush hour (7-10 AM and 4-7 PM) on weekdays. | SELECT COUNT(*) FROM paris_bikeshare WHERE is_weekday = TRUE AND (ride_time BETWEEN '07:00:00' AND '10:00:00' OR ride_time BETWEEN '16:00:00' AND '19:00:00'); | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorker (WorkerID INT, TrainingDate DATE); INSERT INTO CommunityHealthWorker (WorkerID, TrainingDate) VALUES (1, '2022-02-01'), (2, '2022-03-15'), (3, '2021-12-20'), (4, '2022-01-05'), (5, '2021-11-08'), (6, '2022-04-10'), (7, '2022-03-22'), (8, '2022-02-28'), (9, '2021-12-12'), (10, '2022-01... | What is the number of community health workers who have received cultural competency training in the last year? | SELECT COUNT(*) as Total FROM CommunityHealthWorker WHERE TrainingDate >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (PolicyID INT, PolicyName VARCHAR(50), PolicyType VARCHAR(50)); INSERT INTO Policies VALUES (1, 'Assistive Technology', 'Academic'); CREATE TABLE PolicyAdvocates (AdvocateID INT, AdvocateName VARCHAR(50), PolicyID INT); INSERT INTO PolicyAdvocates VALUES (1, 'Jamie Rodriguez', 1); CREATE TABLE Pol... | Who are the policy advocates for policies related to cognitive disabilities? | SELECT pa.AdvocateName FROM Policies p INNER JOIN PolicyDetails pd ON p.PolicyID = pd.PolicyID INNER JOIN PolicyAdvocates pa ON p.PolicyID = pa.PolicyID WHERE pd.DisabilityType = 'Cognitive Disability'; | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (product_id INT, material_type VARCHAR(50), material_quantity INT); CREATE TABLE products (product_id INT, country VARCHAR(50), material_A_used INT); INSERT INTO materials (product_id, material_type, material_quantity) VALUES (1, 'sustainable material A', 100), (2, 'sustainable material B', 50), ... | What is the total quantity of sustainable material A used in products manufactured in Italy and Spain? | SELECT SUM(materials.material_quantity) FROM materials INNER JOIN products ON materials.product_id = products.product_id WHERE products.country IN ('Italy', 'Spain') AND materials.material_type = 'sustainable material A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dams (Name VARCHAR(255), Height_feet INT, State VARCHAR(255)); INSERT INTO Dams (Name, Height_feet, State) VALUES ('Amistad Dam', 246, 'Texas'); | Which dams in Texas are over 100 feet tall? | SELECT Name FROM Dams WHERE Height_feet > 100 AND State = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_response (id INT, incident_category VARCHAR(50), resolution_time INT); INSERT INTO incident_response (id, incident_category, resolution_time) VALUES (1, 'Malware', 480), (2, 'Phishing', 240), (3, 'Malware', 720), (4, 'Phishing', 360), (5, 'DDoS', 1440); | What is the average time to resolve security incidents for each category in the 'incident_response' table? | SELECT incident_category, AVG(resolution_time) FROM incident_response GROUP BY incident_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aquatic_Farm (Farm_ID INT, Farm_Name VARCHAR(100), Species_ID INT, Stock_Quantity INT); INSERT INTO Aquatic_Farm (Farm_ID, Farm_Name, Species_ID, Stock_Quantity) VALUES (1, 'North Sea Fishery', 1, 25000); | Insert a new record for a farm with farm ID 2 and species ID 2 | INSERT INTO Aquatic_Farm (Farm_ID, Farm_Name, Species_ID, Stock_Quantity) VALUES (2, 'Pacific Fishery', 2, 15000); | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(100)); CREATE TABLE Users (id INT, name VARCHAR(100)); CREATE TABLE Streams (id INT, user_id INT, artist_id INT, minutes DECIMAL(10,2), year INT); | Find the number of unique users who streamed a given artist's music in a given year. | SELECT artist_id, COUNT(DISTINCT user_id) AS unique_users FROM Streams WHERE year = 2021 GROUP BY artist_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (project_id INT, project_location VARCHAR(50), project_type VARCHAR(50), project_funding DECIMAL(10,2)); INSERT INTO Projects (project_id, project_location, project_type, project_funding) VALUES (1, 'India', 'Disaster Response', 200000.00), (2, 'Canada', 'Education', 50000.00), (3, 'China', 'Disas... | What is the total amount of funds spent on disaster response projects in Asia? | SELECT SUM(project_funding) FROM Projects WHERE project_type = 'Disaster Response' AND project_location LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (name TEXT, country TEXT, weight FLOAT); INSERT INTO satellites (name, country, weight) VALUES ('Sentinel-1A', 'European Union', 2300.0); | What is the average weight of all satellites in the satellites table? | SELECT AVG(weight) FROM satellites; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_explainability (technique_name TEXT, explainability_score FLOAT); INSERT INTO tech_explainability (technique_name, explainability_score) VALUES ('TechniqueX', 0.75), ('TechniqueY', 0.90), ('TechniqueZ', 0.85); | What is the maximum explainability score for each AI technique in the 'tech_explainability' table? | SELECT technique_name, MAX(explainability_score) OVER (PARTITION BY technique_name) AS max_explainability_score FROM tech_explainability; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_weapon_systems (system_id INT PRIMARY KEY, system_name VARCHAR(100), system_type VARCHAR(50), manufacturer VARCHAR(100)); INSERT INTO military_weapon_systems (system_id, system_name, system_type, manufacturer) VALUES (1, 'Patriot Missile System', 'Air Defense Missile System', 'Raytheon'), (2, 'Tom... | Delete the 'military_weapon_system' with 'system_id' 1 from the 'military_weapon_systems' table | DELETE FROM military_weapon_systems WHERE system_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT PRIMARY KEY, name VARCHAR(255)); INSERT INTO warehouse (id, name) VALUES (1, 'ABC'), (2, 'DEF'); CREATE TABLE shipments (id INT PRIMARY KEY, warehouse_id INT, FOREIGN KEY (warehouse_id) REFERENCES warehouse(id)); INSERT INTO shipments (id, warehouse_id) VALUES (1, 1), (2, 2); | Delete the 'DEF' warehouse and all associated shipments | WITH w AS (DELETE FROM warehouse WHERE name = 'DEF' RETURNING id) DELETE FROM shipments WHERE warehouse_id IN (SELECT id FROM w); | gretelai_synthetic_text_to_sql |
CREATE TABLE player_demographics (player_id INT, age INT, gender VARCHAR(50)); INSERT INTO player_demographics (player_id, age, gender) VALUES (1, 25, 'Male'), (2, 35, 'Female'), (3, 17, 'Female'), (4, 22, 'Non-binary'); | Insert a new record into the "player_demographics" table with player_id 5, age 30, and gender "Transgender Male" | INSERT INTO player_demographics (player_id, age, gender) VALUES (5, 30, 'Transgender Male'); | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_workers (id INT, name TEXT, age INT, state TEXT); INSERT INTO healthcare_workers (id, name, age, state) VALUES (1, 'John Doe', 35, 'California'); INSERT INTO healthcare_workers (id, name, age, state) VALUES (2, 'Jane Smith', 40, 'California'); | What is the average age of healthcare workers in California? | SELECT AVG(age) FROM healthcare_workers WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists ocean_shipping;CREATE TABLE if not exists ocean_shipping.ships (id INT PRIMARY KEY, name VARCHAR(100), capacity INT);CREATE TABLE if not exists ocean_shipping.trips (id INT PRIMARY KEY, ship_id INT, port VARCHAR(100));INSERT INTO ocean_shipping.ships (id, name, capacity) VALUES (1, 'SS Oakla... | What is the average capacity of cargo ships that have visited the Port of Oakland? | SELECT AVG(capacity) FROM ocean_shipping.ships INNER JOIN ocean_shipping.trips ON ships.id = trips.ship_id WHERE trips.port = 'Port of Oakland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (concert_id INT, artist_name VARCHAR(100), concert_location VARCHAR(100)); INSERT INTO concerts (concert_id, artist_name, concert_location) VALUES (1, 'Taylor Swift', 'New York, USA'); INSERT INTO concerts (concert_id, artist_name, concert_location) VALUES (2, 'BTS', 'Seoul, South Korea'); INSERT ... | List all artists who have never performed a concert in the United States. | SELECT artist_name FROM concerts WHERE concert_location NOT LIKE '%USA%' GROUP BY artist_name HAVING COUNT(*) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE movie_reviews (id INT, user_id INT, movie_id INT, rating INT); CREATE VIEW movie_summary AS SELECT m.id, m.title, m.release_year, m.country, AVG(mr.rating) as avg_rating FROM movies m JOIN movie_reviews mr ON m.id = mr.movie_id GROUP BY m.id; | What is the distribution of user ratings for movies released in the US in 2016? | SELECT avg_rating, COUNT(*) as num_movies FROM movie_summary WHERE release_year = 2016 AND country = 'USA' GROUP BY avg_rating; | gretelai_synthetic_text_to_sql |
CREATE TABLE Songs(id INT, title VARCHAR(30), genre VARCHAR(10), artist VARCHAR(20), country VARCHAR(20), release_date DATE, length FLOAT); | What is the total number of songs and the average length of songs in the "pop" genre, produced by female artists from the United States, released in the last 5 years? | SELECT 'total songs' AS metric, COUNT(*) FROM Songs WHERE genre = 'pop' AND artist GLOB '*female*' AND country = 'United States' AND release_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) AND length IS NOT NULL; SELECT 'average song length' AS metric, AVG(length) FROM Songs WHERE genre = 'pop' AND artist GLOB '*female... | gretelai_synthetic_text_to_sql |
CREATE TABLE AgroforestryProject (id INT, region VARCHAR(50), budget DECIMAL(10,2), permaculture BOOLEAN); INSERT INTO AgroforestryProject (id, region, budget, permaculture) VALUES (1, 'Central America', 15000.0, true); INSERT INTO AgroforestryProject (id, region, budget, permaculture) VALUES (2, 'Central America', 200... | What is the total budget (in USD) for agroforestry projects in Central America and how many of them are using permaculture techniques? | SELECT SUM(budget), SUM(permaculture) FROM AgroforestryProject WHERE region = 'Central America'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; USE biotech; CREATE TABLE if not exists startups (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), funding DECIMAL(10,2)); INSERT INTO startups (id, name, location, funding) VALUES (1, 'StartupA', 'USA', 15000000.50), (2, 'StartupB', 'USA', 22000000.25), (3, 'StartupC',... | What is the sum of funding for all biotech startups based in Canada? | SELECT SUM(funding) FROM biotech.startups WHERE location = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (id INT PRIMARY KEY, name TEXT, region TEXT); INSERT INTO states (id, name, region) VALUES (1, 'Alabama', 'South'); CREATE TABLE crops (id INT PRIMARY KEY, state_id INT, crop TEXT, yield REAL); INSERT INTO crops (id, state_id, crop, yield) VALUES (1, 1, 'corn', 2.5); | What is the minimum yield of 'corn' for each state? | SELECT state_id, MIN(yield) FROM crops WHERE crop = 'corn' GROUP BY state_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT PRIMARY KEY, name VARCHAR(50), city VARCHAR(50));CREATE TABLE carrier (id INT PRIMARY KEY, name VARCHAR(50));CREATE TABLE shipment (id INT PRIMARY KEY, warehouse_id INT, carrier_id INT, package_count INT, damaged_count INT, shipped_date DATE); | How many packages arrived at the 'NY' warehouse from 'Mexico' in the last week, and how many of those were damaged? | SELECT SUM(shipment.package_count), SUM(shipment.damaged_count) FROM shipment WHERE shipment.warehouse_id = (SELECT id FROM warehouse WHERE city = 'NY') AND shipment.shipped_date BETWEEN (CURRENT_DATE - INTERVAL '7 days') AND CURRENT_DATE AND (SELECT name FROM carrier WHERE id = shipment.carrier_id) = 'Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (id INT, name TEXT, type TEXT, location TEXT); INSERT INTO infrastructure_projects (id, name, type, location) VALUES (1, 'Brooklyn Bridge', 'Bridge', 'USA'); INSERT INTO infrastructure_projects (id, name, type, location) VALUES (2, 'Chunnel', 'Tunnel', 'UK'); INSERT INTO infrastruct... | Count the number of bridges in Japan | SELECT COUNT(*) FROM infrastructure_projects WHERE type = 'Bridge' AND location = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_tourism (id INT, country VARCHAR(50), initiative VARCHAR(100)); INSERT INTO sustainable_tourism (id, country, initiative) VALUES (1, 'Costa Rica', 'Carbon neutral by 2050'), (2, 'Costa Rica', 'Banned single-use plastics'); | Which sustainable tourism initiatives have been implemented in Costa Rica? | SELECT initiative FROM sustainable_tourism WHERE country = 'Costa Rica'; | gretelai_synthetic_text_to_sql |
CREATE TABLE disability_accommodations (student_id INT, disability_type VARCHAR(50), gender VARCHAR(50)); INSERT INTO disability_accommodations (student_id, disability_type, gender) VALUES (1, 'Physical', 'Female'); | What is the number of students who received accommodations by gender? | SELECT gender, COUNT(*) as total_students FROM disability_accommodations GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (id INT, policy_name VARCHAR(50), last_modified DATE); | Which policies have been modified in the last week? | SELECT policy_name FROM policies WHERE last_modified >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE project_australia (project_id INT, country VARCHAR(50), project_type VARCHAR(50), start_date DATE); INSERT INTO project_australia (project_id, country, project_type, start_date) VALUES (1, 'Australia', 'Sustainable', '2019-05-01'); | Which sustainable building projects in Australia started between 2019 and 2021? | SELECT * FROM project_australia WHERE country = 'Australia' AND project_type = 'Sustainable' AND start_date BETWEEN '2019-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableProjects (ProjectID int, State varchar(25), Sustainable bit); INSERT INTO SustainableProjects (ProjectID, State, Sustainable) VALUES (1, 'OR', 1), (2, 'OR', 0), (3, 'OR', 1); | What is the percentage of sustainable building projects in OR? | SELECT State, (COUNT(*) FILTER (WHERE Sustainable = 1) * 100.0 / COUNT(*)) AS Percentage FROM SustainableProjects WHERE State = 'OR' GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation (id INT, country VARCHAR(50), initiative VARCHAR(50), budget INT, contributor VARCHAR(50)); INSERT INTO agricultural_innovation (id, country, initiative, budget, contributor) VALUES (1, 'Brazil', 'Precision Agriculture', 2000000, 'Government'), (2, 'Argentina', 'Sustainable Agricult... | What is the average budget for agricultural innovation initiatives in South America, broken down by initiative type and contributing organization? | SELECT initiative, contributor, AVG(budget) as avg_budget FROM agricultural_innovation WHERE country IN ('Brazil', 'Argentina', 'Colombia') GROUP BY initiative, contributor; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (id INT, location TEXT, date DATE, engagement INT); INSERT INTO virtual_tours (id, location, date, engagement) VALUES (1, 'Hotel 1', '2022-01-01', 50), (2, 'Hotel 2', '2022-01-05', 75), (3, 'Hotel 3', '2022-02-01', 100), (4, 'Hotel 4', '2022-02-10', 125), (5, 'Hotel 5', '2022-03-01', 150), (6... | How many virtual tours were engaged with in the Americas in the past month? | SELECT COUNT(*) FROM virtual_tours WHERE location LIKE '%Americas%' AND date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Sites (site_id INT, site_name TEXT, num_artifacts INT); INSERT INTO Sites (site_id, site_name, num_artifacts) VALUES (1, 'SiteA', 60), (2, 'SiteB', 40), (3, 'SiteC', 30); | Which excavation sites have more than 50 artifacts? | SELECT site_name FROM Sites WHERE num_artifacts > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact_investments (id INT PRIMARY KEY, name VARCHAR(100), amount INT, sector VARCHAR(20)); | Insert new record into impact_investments table | INSERT INTO impact_investments (id, name, amount, sector) VALUES (5, 'Investment in Clean Energy', 500000, 'Clean Energy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_code CHAR(3), port_name VARCHAR(20)); INSERT INTO ports (port_code, port_name) VALUES ('LA', 'Los Angeles'), ('NY', 'New York'), ('MIA', 'Miami'), ('HOU', 'Houston'), ('SFO', 'San Francisco'); CREATE TABLE cargo_handling (port_code CHAR(3), waiting_time INT); INSERT INTO cargo_handling (port_co... | What are the waiting times for cargo handling at port 'SFO'? | SELECT cargo_handling.waiting_time FROM cargo_handling WHERE cargo_handling.port_code = 'SFO'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (id INT, location VARCHAR(20), volume INT, date DATE); INSERT INTO wells (id, location, volume, date) VALUES (1, 'South China Sea', 800, '2022-01-01'); INSERT INTO wells (id, location, volume, date) VALUES (2, 'South China Sea', 1800, '2022-02-01'); INSERT INTO wells (id, location, volume, date) VALU... | Calculate the average production volume for wells in the South China Sea in 2022. | SELECT AVG(volume) FROM wells WHERE location = 'South China Sea' AND YEAR(date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE disability_accommodations (student_id INT, disability_type VARCHAR(50)); INSERT INTO disability_accommodations (student_id, disability_type) VALUES (1, 'Physical'); | What is the total number of students who received accommodations by disability type? | SELECT disability_type, COUNT(*) as total_students FROM disability_accommodations GROUP BY disability_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, name VARCHAR(20), location VARCHAR(20), attendees INT); INSERT INTO events (id, name, location, attendees) VALUES (1, 'Rio Games', 'Brazil', 50000), (2, 'Casablanca Cup', 'Morocco', 30000), (3, 'Johannesburg Jam', 'South Africa', 40000), (4, 'Lima League', 'Peru', 25000), (5, 'Cairo Clash',... | List all the eSports events that have taken place in Africa or South America, along with the number of attendees? | SELECT events.name, events.location, events.attendees FROM events WHERE events.location IN ('Africa', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, total_donations DECIMAL(10,2)); CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donors (id, name, total_donations) VALUES (1, 'John Doe', 500.00), (2, 'Jane Smith', 300.00); INSERT INTO donations (id, donor_id, amount, don... | What is the total amount donated by each donor in 'donations' table? | SELECT donor_id, SUM(amount) as total_donations FROM donations GROUP BY donor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_life_research_stations (id INT, name TEXT, location TEXT, depth FLOAT); INSERT INTO marine_life_research_stations (id, name, location, depth) VALUES (1, 'Station A', 'Pacific', 2500.5); INSERT INTO marine_life_research_stations (id, name, location, depth) VALUES (2, 'Station B', 'Atlantic', 3000.2); | What is the average depth of all marine life research stations in the Southern hemisphere? | SELECT AVG(depth) FROM marine_life_research_stations WHERE location LIKE 'S%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (company_id INT, company_name TEXT, country TEXT); INSERT INTO companies VALUES (1, 'Pacific Ocean Shipping', 'China'), (2, 'Asian Coastal Lines', 'Japan'), (3, 'Indian Ocean Maritime', 'India'); CREATE TABLE vessels (vessel_id INT, company_id INT, capacity INT); INSERT INTO vessels VALUES (1, 1,... | What is the maximum cargo capacity in TEUs for vessels owned by companies based in Asia with the word 'Ocean' in their name? | SELECT MAX(vessels.capacity) FROM vessels JOIN companies ON vessels.company_id = companies.company_id WHERE companies.country = 'Asia' AND companies.company_name LIKE '%Ocean%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalEvents (EventID INT, Name TEXT, Location TEXT, Attendance INT); INSERT INTO CulturalEvents (EventID, Name, Location, Attendance) VALUES (1, 'Chinese New Year', 'China', 10000000); INSERT INTO CulturalEvents (EventID, Name, Location, Attendance) VALUES (2, 'Diwali', 'India', 8000000); INSERT INTO Cu... | Which cultural events in Asia had the highest attendance? | SELECT Name FROM CulturalEvents WHERE Location = 'Asia' GROUP BY Name ORDER BY Attendance DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset (id INT, initiative_name VARCHAR(50), region VARCHAR(50), offset_amount INT); INSERT INTO carbon_offset (id, initiative_name, region, offset_amount) VALUES (1, 'GreenCities EU', 'Europe', 25000), (2, 'CleanAir NA', 'North America', 18000), (3, 'SmartGrid AP', 'Asia Pacific', 22000), (4, 'EcoR... | What is the average carbon offset by smart city initiatives in each region? | SELECT region, AVG(offset_amount) FROM carbon_offset GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtForms (ArtFormID INT, Name TEXT, Location TEXT); INSERT INTO ArtForms (ArtFormID, Name, Location) VALUES (1, 'Capoeira', 'Brazil'); INSERT INTO ArtForms (ArtFormID, Name, Location) VALUES (2, 'Samba', 'Brazil'); | What are the names and locations of traditional art forms in Brazil? | SELECT Name, Location FROM ArtForms WHERE Location = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE NutritionData(product_id INT, product_type VARCHAR(50), is_gluten_free BOOLEAN, calorie_count INT); | What is the total calorie count for gluten-free products in the NutritionData table, grouped by product type? | SELECT product_type, SUM(calorie_count) FROM NutritionData WHERE is_gluten_free = TRUE GROUP BY product_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, destination VARCHAR(50), packages INT, timestamp DATE); INSERT INTO Shipments (id, destination, packages, timestamp) VALUES (1, 'Paris', 50, '2021-03-01'), (2, 'Berlin', 30, '2021-03-02'), (3, 'London', 40, '2021-03-03'), (4, 'Rome', 55, '2021-03-04'), (5, 'Paris', 60, '2021-03-05'); | Find the number of packages shipped to each destination in March 2021 | SELECT destination, SUM(packages) FROM Shipments WHERE timestamp BETWEEN '2021-03-01' AND '2021-03-31' GROUP BY destination; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, price DECIMAL(5,2), is_cruelty_free BOOLEAN); INSERT INTO products (product_id, price, is_cruelty_free) VALUES (1, 25.99, true), (2, 30.99, false), (3, 15.99, true); | What is the average price of products with a cruelty-free certification? | SELECT AVG(price) FROM products WHERE is_cruelty_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE talent_acquisition (id INT PRIMARY KEY, job_title VARCHAR(50), job_location VARCHAR(50), number_of_openings INT, source VARCHAR(50)); | Update the number of openings for a talent acquisition in the 'talent_acquisition' table | UPDATE talent_acquisition SET number_of_openings = 5 WHERE id = 2001; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPersonnel (PersonnelID int, PersonnelName varchar(100), Branch varchar(50), NumPersonnel int); INSERT INTO MilitaryPersonnel (PersonnelID, PersonnelName, Branch, NumPersonnel) VALUES (1, 'John Doe', 'Army', 500000), (2, 'Jane Smith', 'Navy', 450000), (3, 'Mike Johnson', 'Air Force', 300000); | Show the number of military personnel in each military branch, ranked by the highest number of personnel. | SELECT Branch, NumPersonnel, ROW_NUMBER() OVER (ORDER BY NumPersonnel DESC) as Rank FROM MilitaryPersonnel; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductionData (WellID int, ProductionDate date, BarrelsPerDay int); INSERT INTO ProductionData (WellID, ProductionDate, BarrelsPerDay) VALUES (401, '2022-01-01', 1200), (401, '2022-01-02', 1300), (401, '2022-01-03', 1400); | What was the daily production rate for Well ID 401 on 2022-01-03? | SELECT BarrelsPerDay FROM ProductionData WHERE WellID = 401 AND ProductionDate = '2022-01-03'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (employee_id INT, department TEXT, salary DECIMAL(10,2)); INSERT INTO employees VALUES (1, 'Engineering', 80000), (2, 'Marketing', 60000), (3, 'Engineering', 85000), (4, 'Human Resources', 70000), (5, 'Finance', 90000), (6, 'Marketing', 65000); | Show the number of employees and total salary expense for each department in the organization. | SELECT department, COUNT(*) AS num_employees, SUM(salary) AS total_salary_expense FROM employees GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Southern_Ocean_Temp (date DATE, location TEXT, temp FLOAT); INSERT INTO Southern_Ocean_Temp (date, location, temp) VALUES ('2022-01-01', 'Southern Ocean', 2.0), ('2022-01-15', 'Southern Ocean', 2.5); | What is the average sea surface temperature in the Southern Ocean during the month of January? | SELECT AVG(temp) FROM Southern_Ocean_Temp WHERE location = 'Southern Ocean' AND EXTRACT(MONTH FROM date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories_workers_ext (id INT, factory_id INT, name VARCHAR(50), country VARCHAR(50), worker_count INT); INSERT INTO factories_workers_ext (id, factory_id, name, country, worker_count) VALUES (1, 1, 'Factory One', 'Germany', 100), (2, 2, 'Factory Two', 'China', 50), (3, 3, 'Factory Three', 'China', 150); | What is the name of the factory in 'China' with the lowest number of workers? | SELECT name FROM factories_workers_ext WHERE country = 'China' AND worker_count = (SELECT MIN(worker_count) FROM factories_workers_ext WHERE country = 'China'); | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_officers (id INT, name VARCHAR(20), rank VARCHAR(10)); INSERT INTO intelligence_officers (id, name, rank) VALUES (1, 'Ivy', 'Captain'), (2, 'Jack', 'Lieutenant'), (3, 'Kate', 'Commander'); | Delete the 'intelligence_officer' record with the name 'Ivy' from the 'intelligence_officers' table | DELETE FROM intelligence_officers WHERE name = 'Ivy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE north_atlantic_ocean (id INT, well_name VARCHAR(255), drill_date DATE, production_oil INT); | What is the total number of wells that were drilled in the North Atlantic Ocean before 2015, and what is the total amount of oil they produced? | SELECT COUNT(*) as total_wells, SUM(production_oil) as total_oil_produced FROM north_atlantic_ocean WHERE drill_date < '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (id INT, initiative_name VARCHAR(50), country VARCHAR(50), amount FLOAT, date DATE); INSERT INTO climate_finance (id, initiative_name, country, amount, date) VALUES (1, 'Green Energy Investment', 'France', 750000, '2019-01-01'); | How many climate finance initiatives were implemented in Europe in 2019? | SELECT COUNT(*) FROM climate_finance WHERE country LIKE '%Europe%' AND date = '2019-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Rainfall (id INT, region VARCHAR(255), rainfall DECIMAL(5,2), date DATE); INSERT INTO Rainfall (id, region, rainfall, date) VALUES (1, 'FR-Nord', 50.3, '2022-06-01'); | Identify the total rainfall in millimeters for all regions in "FR" for the month of "June" in the year "2022". | SELECT SUM(rainfall) FROM Rainfall WHERE region LIKE 'FR%' AND EXTRACT(MONTH FROM date) = 6 AND EXTRACT(YEAR FROM date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE rigs (rig_id INT, rig_name VARCHAR(255), status VARCHAR(255), region VARCHAR(255)); INSERT INTO rigs (rig_id, rig_name, status, region) VALUES (1, 'Rig1', 'active', 'Alaska'), (2, 'Rig2', 'inactive', 'Alaska'), (3, 'Rig3', 'active', 'Gulf of Mexico'); | How many active rigs are there in the 'Alaska' region? | SELECT COUNT(*) FROM rigs WHERE status = 'active' AND region = 'Alaska'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, Name TEXT, City TEXT); CREATE TABLE Programs (ProgramID INT, Name TEXT, VolunteerID INT, StartDate DATE); INSERT INTO Volunteers (VolunteerID, Name, City) VALUES (1, 'James Johnson', 'New York'), (2, 'Natalie Brown', 'Los Angeles'), (3, 'Michael Davis', 'Chicago'); INSERT INTO ... | How many volunteers engaged in each program in Q1 2021, grouped by city? | SELECT City, COUNT(DISTINCT Volunteers.VolunteerID) as 'Number of Volunteers' FROM Programs INNER JOIN Volunteers ON Programs.VolunteerID = Volunteers.VolunteerID WHERE Programs.StartDate BETWEEN '2021-01-01' AND '2021-03-31' GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(50), gender VARCHAR(10), genre VARCHAR(20), is_solo BOOLEAN); INSERT INTO artists (id, name, gender, genre, is_solo) VALUES (1, 'Cardi B', 'Female', 'Hip Hop', TRUE), (2, 'Kendrick Lamar', 'Male', 'Hip Hop', TRUE); | What is the ratio of female to male solo artists in the Hip Hop genre? | SELECT COUNT(*) FILTER (WHERE gender = 'Female' AND is_solo = TRUE) / COUNT(*) FILTER (WHERE gender = 'Male' AND is_solo = TRUE) FROM artists WHERE genre = 'Hip Hop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (year INT, sector VARCHAR(20), amount INT); INSERT INTO waste_generation (year, sector, amount) VALUES (2020, 'commercial', 1200), (2020, 'residential', 800), (2021, 'commercial', 1500), (2021, 'residential', 900); | Find the total waste generation for commercial and residential sectors in 2020 and 2021. | SELECT sector, SUM(amount) FROM waste_generation WHERE year IN (2020, 2021) GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (id INT, country VARCHAR(50), visit_year INT, gender VARCHAR(10)); CREATE VIEW African_Countries AS SELECT 'Egypt' AS country UNION ALL SELECT 'South Africa' UNION ALL SELECT 'Nigeria'; | Find the total number of visitors from African countries in the last 2 years. | SELECT COUNT(*) FROM Visitors INNER JOIN African_Countries ON Visitors.country = African_Countries.country WHERE visit_year BETWEEN 2020 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation (area VARCHAR(20), service_type VARCHAR(50), satisfaction_score INT); INSERT INTO transportation (area, service_type, satisfaction_score) VALUES ('urban', 'public_transportation', 8), ('rural', 'public_transportation', 6), ('urban', 'rail', 9), ('rural', 'rail', 7), ('urban', 'bus', 8), ('ru... | What is the average citizen satisfaction score for public transportation services in urban areas? | SELECT AVG(satisfaction_score) FROM transportation WHERE area = 'urban' AND service_type = 'public_transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, donor_name TEXT, donation_date DATE); INSERT INTO donors (id, donor_name, donation_date) VALUES (1, 'Jim White', '2022-01-01'), (2, 'Jane Smith', '2022-02-15'); | How many unique donors have there been each month in the last year? | SELECT EXTRACT(MONTH FROM donation_date) as month, COUNT(DISTINCT donor_name) as unique_donors FROM donors WHERE donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY month ORDER BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), uses_recycled_materials BIT); INSERT INTO products (product_id, product_name, uses_recycled_materials) VALUES (1, 'Product A', 1), (2, 'Product B', 0), (3, 'Product C', 1); CREATE TABLE pricing (product_id INT, retail_price DECIMAL(5, 2)); INSERT INTO pri... | Update the retail price of all products that use recycled materials by 5%. | UPDATE p SET retail_price = retail_price * 1.05 FROM products p JOIN pricing pc ON p.product_id = pc.product_id WHERE p.uses_recycled_materials = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID INT, Name TEXT, Budget INT);CREATE TABLE Locations (ProjectID INT, Country TEXT); | List all heritage preservation projects in Africa and their corresponding budgets. | SELECT Projects.Name, Projects.Budget FROM Projects INNER JOIN Locations ON Projects.ProjectID = Locations.ProjectID WHERE Locations.Country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech_armies (army VARCHAR(50), tech_type VARCHAR(50), quantity INT); INSERT INTO military_tech_armies (army, tech_type, quantity) VALUES ('Australia', 'Armored Vehicles', 726), ('Australia', 'Artillery', 145), ('Australia', 'Aircraft', 334), ('Canada', 'Armored Vehicles', 873), ('Canada', 'Artille... | What are the most common types of military technology used by the Australian and Canadian armies in their inventories? | SELECT army, tech_type, quantity FROM military_tech_armies WHERE army IN ('Australia', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (patient_id INT, gender VARCHAR(10), age INT, diagnosis VARCHAR(20)); | What is the average age of female patients diagnosed with diabetes? | SELECT AVG(age) FROM patient WHERE gender = 'female' AND diagnosis = 'diabetes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE returns (id INT, carrier TEXT, return_weight FLOAT, source_country TEXT, destination_country TEXT); | Which carriers have handled the most returns from Canada to France, and what is the total weight of those returns? | SELECT carrier, SUM(return_weight) as total_weight FROM returns WHERE source_country = 'Canada' AND destination_country = 'France' GROUP BY carrier ORDER BY total_weight DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, region VARCHAR(20), response_time INT); INSERT INTO emergency_calls (id, region, response_time) VALUES (1, 'Southern', 180); | What is the maximum response time for emergency calls in the 'Southern' region? | SELECT MAX(response_time) FROM emergency_calls WHERE region = 'Southern'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetic_products (product_id INT, product_name VARCHAR(50), is_cruelty_free BOOLEAN, sales_volume INT, market VARCHAR(10)); INSERT INTO cosmetic_products (product_id, product_name, is_cruelty_free, sales_volume, market) VALUES (1, 'Lip Gloss', true, 500, 'SA'), (2, 'Mascara', false, 400, 'SA'), (3, 'Eyesh... | Which cruelty-free cosmetic products have the lowest sales volume in the South American market? | SELECT product_name, sales_volume FROM cosmetic_products WHERE is_cruelty_free = true AND market = 'SA' ORDER BY sales_volume ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS heritage_sites (id INT, name VARCHAR(255), status VARCHAR(255)); | Insert records for new heritage sites into "heritage_sites" table | INSERT INTO heritage_sites (id, name, status) VALUES (4, 'Taj Mahal', 'World Heritage'), (5, 'Galapagos Islands', 'World Heritage'); | gretelai_synthetic_text_to_sql |
CREATE TABLE RecycledMaterials (product VARCHAR(50), amount INT); INSERT INTO RecycledMaterials VALUES ('Jeans', 500), ('Shirts', 300), ('Jeans', 700), ('Pants', 400); | What is the total amount of recycled materials used in the production of jeans in the United States? | SELECT SUM(amount) FROM RecycledMaterials WHERE product = 'Jeans'; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (investment_id INT, investment_date DATE); INSERT INTO network_investments (investment_id, investment_date) VALUES (1, '2021-01-15'), (2, '2021-03-01'), (3, '2020-12-01'); | What is the total number of network infrastructure investments made in the last quarter of 2020? | SELECT COUNT(*) FROM network_investments WHERE investment_date BETWEEN '2020-10-01' AND '2020-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_insurance (policy_id INT, claim_amount DECIMAL(10,2)); INSERT INTO health_insurance (policy_id, claim_amount) VALUES (1, 150.00), (2, 250.50), (3, 50.00), (4, 400.75); | What is the minimum claim amount for policies in the 'health_insurance' table? | SELECT MIN(claim_amount) FROM health_insurance; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, date DATE, is_fraudulent BOOLEAN); INSERT INTO transactions (transaction_id, date, is_fraudulent) VALUES (1, '2021-04-01', true), (2, '2021-04-02', false), (3, '2021-07-01', true); | How many fraudulent transactions occurred in Q2 of 2021? | SELECT COUNT(*) FROM transactions WHERE date BETWEEN '2021-04-01' AND '2021-06-30' AND is_fraudulent = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name TEXT, gender TEXT, department TEXT); INSERT INTO faculty (id, name, gender, department) VALUES (1, 'Alice', 'Female', 'Engineering'), (2, 'Bob', 'Male', 'Engineering'), (3, 'Carla', 'Non-binary', 'Engineering'); CREATE TABLE research_grants (id INT, faculty_id INT, title TEXT, amount ... | What are the total number of research grants awarded to female and non-binary faculty in the College of Engineering, sorted alphabetically by faculty last name? | SELECT COUNT(*) FROM research_grants INNER JOIN faculty ON research_grants.faculty_id = faculty.id WHERE faculty.gender IN ('Female', 'Non-binary') AND faculty.department = 'Engineering' ORDER BY faculty.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE LanguagePreservation (ProjectID INT PRIMARY KEY, ProjectName VARCHAR(50), Location VARCHAR(50), Budget DECIMAL(10,2)); INSERT INTO LanguagePreservation (ProjectID, ProjectName, Location, Budget) VALUES (1, 'Polynesian Languages', 'Samoa', 350000.00), (2, 'Aboriginal Languages', 'Australia', 600000.00); | What is the total budget allocated for all language preservation projects in 'Oceania'? | SELECT SUM(Budget) FROM LanguagePreservation WHERE Location LIKE '%Oceania%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildings (id INT, city VARCHAR(50), building_count INT); INSERT INTO GreenBuildings (id, city, building_count) VALUES (1, 'New York', 300), (2, 'Los Angeles', 250), (3, 'Chicago', 220), (4, 'Houston', 280); | Which city has the least number of green buildings in the United States? | SELECT city, MIN(building_count) FROM GreenBuildings WHERE country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_labor2 (product_id INT, brand VARCHAR(255), quantity_sold INT); INSERT INTO ethical_labor2 (product_id, brand, quantity_sold) VALUES (4, 'BrandV', 500), (5, 'BrandW', 800), (6, 'BrandX', 700); | Calculate the percentage of products sold for each brand in the 'ethical_labor2' table, ordered by the percentage in descending order. | SELECT brand, (SUM(quantity_sold) OVER (PARTITION BY brand) * 100.0 / SUM(quantity_sold) OVER ()) AS percentage_sold FROM ethical_labor2 GROUP BY brand ORDER BY percentage_sold DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerns (id INT, description VARCHAR(255), published_date DATE, industry VARCHAR(255)); | What are the AI safety concerns raised in the past year for the transportation industry, in the AI Safety database? | SELECT description FROM concerns WHERE published_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 YEAR) AND industry = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (country VARCHAR(50), incident_count INT, incident_date DATE); INSERT INTO security_incidents (country, incident_count, incident_date) VALUES ('USA', 200, '2023-01-01'), ('Canada', 150, '2023-01-02'), ('UK', 120, '2023-01-03'), ('Germany', 180, '2023-01-04'), ('Australia', 80, '2023-01-0... | Find the top 3 countries with the highest number of security incidents in the last 30 days. | SELECT country, incident_count FROM security_incidents WHERE incident_date >= DATEADD(day, -30, GETDATE()) ORDER BY incident_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, country VARCHAR(255), launch_year INT, PRIMARY KEY(id)); INSERT INTO satellites (id, country, launch_year) VALUES (1, 'USA', 1978), (2, 'USSR', 1957), (3, 'China', 1970); | What is the total number of satellites launched by countries before 1990? | SELECT SUM(satellites.total) FROM (SELECT COUNT(*) AS total FROM satellites WHERE launch_year < 1990 GROUP BY country) AS satellites; | gretelai_synthetic_text_to_sql |
CREATE TABLE Soil_Types (id INT PRIMARY KEY, type VARCHAR(50), ph VARCHAR(50), region VARCHAR(50)); INSERT INTO Soil_Types (id, type, ph, region) VALUES (1, 'Sandy', '6.0-7.5', 'Northeast'), (2, 'Clay', '5.5-6.5', 'Midwest'), (3, 'Loam', '6.0-7.0', 'West'), (4, 'Silt', '6.5-7.5', 'West'); | What is the minimum ph level of soils in the West? | SELECT MIN(ph) FROM Soil_Types WHERE region = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE household_energy (household_id INT, city VARCHAR(50), consumption_kwh FLOAT); INSERT INTO household_energy (household_id, city, consumption_kwh) VALUES (1, 'Tokyo', 250.3), (2, 'Seoul', 280.9), (3, 'Tokyo', 300.1), (4, 'Seoul', 220.5), (5, 'Tokyo', 270.4), (6, 'Seoul', 290.1); | What is the average energy consumption (in kWh) of households in Tokyo and Seoul? | SELECT AVG(consumption_kwh) FROM household_energy WHERE city IN ('Tokyo', 'Seoul'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai (country VARCHAR(50), sector VARCHAR(50), year INT, score INT); INSERT INTO ethical_ai (country, sector, year, score) VALUES ('Brazil', 'Healthcare', 2022, 85), ('Brazil', 'Finance', 2022, 70), ('Mexico', 'Healthcare', 2022, 80), ('Mexico', 'Finance', 2022, 90); | What is the average ethical AI score for Latin American countries, for each technology sector, in the year 2022? | SELECT country, sector, AVG(score) as avg_score FROM ethical_ai WHERE year = 2022 AND region = 'Latin America' GROUP BY country, sector; | gretelai_synthetic_text_to_sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.