context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE users (id INT, followers INT); CREATE TABLE posts (id INT, user_id INT, content TEXT, created_at DATETIME); | What is the maximum number of followers for users who have posted about veganism in the last year? | SELECT MAX(users.followers) FROM users INNER JOIN posts ON users.id = posts.user_id WHERE posts.content LIKE '%veganism%' AND posts.created_at >= DATE_SUB(NOW(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (drug_name TEXT, approval_year INTEGER, success BOOLEAN); INSERT INTO clinical_trials (drug_name, approval_year, success) VALUES ('DrugP', 2018, true), ('DrugP', 2019, true), ('DrugQ', 2020, false), ('DrugR', 2017, true), ('DrugR', 2018, true), ('DrugS', 2019, false); | Calculate the success rate of clinical trials for drugs approved between 2017 and 2020. | SELECT AVG(success) as avg_success_rate FROM (SELECT approval_year, success, COUNT(*) as trials_count FROM clinical_trials WHERE approval_year BETWEEN 2017 AND 2020 GROUP BY approval_year, success) subquery WHERE trials_count > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE brands (brand_id INT, brand_name TEXT, country TEXT); CREATE TABLE product_recalls (recall_id INT, brand_id INT, recall_date DATE); INSERT INTO brands (brand_id, brand_name, country) VALUES (1, 'Brand X', 'USA'), (2, 'Brand Y', 'USA'), (3, 'Brand Z', 'Canada'); INSERT INTO product_recalls (recall_id, brand... | How many product recalls were issued for brands in the USA in the last 12 months? | SELECT brand_name, COUNT(*) as recalls_in_last_12_months FROM brands JOIN product_recalls ON brands.brand_id = product_recalls.brand_id WHERE country = 'USA' AND recall_date > DATEADD(month, -12, CURRENT_DATE) GROUP BY brand_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Age INT, Gender VARCHAR(10), Income FLOAT); CREATE TABLE Cases (CaseID INT, AttorneyID INT, CaseStatus VARCHAR(10)); | List all attorneys who have never lost a case, along with their demographic information. | SELECT A.AttorneyID, A.Age, A.Gender, A.Income FROM Attorneys A WHERE NOT EXISTS (SELECT 1 FROM Cases C WHERE A.AttorneyID = C.AttorneyID AND C.CaseStatus = 'Lost'); | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganicWaste (Region VARCHAR(50), WasteQuantity INT); INSERT INTO OrganicWaste (Region, WasteQuantity) VALUES ('World', 100000000), ('Europe', 10000000), ('North America', 30000000), ('Asia', 40000000); | What is the total amount of organic waste generated in the world, and how does that compare to the amount of organic waste generated in Europe? | SELECT Region, WasteQuantity FROM OrganicWaste WHERE Region IN ('World', 'Europe'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (Product_ID INT PRIMARY KEY, Product_Name TEXT); CREATE TABLE Ingredients (Product_ID INT, Ingredient_Name TEXT, Organic BOOLEAN, Weight FLOAT); INSERT INTO Products (Product_ID, Product_Name) VALUES (1, 'Facial Cleanser'), (2, 'Moisturizing Cream'), (3, 'Exfoliating Scrub'); INSERT INTO Ingredien... | What is the percentage of organic ingredients used in each product? | SELECT p.Product_Name, (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Ingredients i WHERE i.Product_ID = p.Product_ID)) AS Percentage_Organic FROM Ingredients i JOIN Products p ON i.Product_ID = p.Product_ID WHERE i.Organic = TRUE GROUP BY p.Product_ID; | gretelai_synthetic_text_to_sql |
CREATE TABLE conditions (id INT, patient_id INT, condition VARCHAR(255)); CREATE TABLE patients (id INT, age INT, country VARCHAR(255)); INSERT INTO conditions (id, patient_id, condition) VALUES (1, 1, 'depression'), (2, 2, 'anxiety'), (3, 3, 'bipolar'), (4, 4, 'schizophrenia'); INSERT INTO patients (id, age, country) ... | What is the most common mental health condition in Canada's youth population? | SELECT conditions.condition, COUNT(conditions.condition) AS count FROM conditions JOIN patients ON conditions.patient_id = patients.id WHERE patients.country = 'Canada' AND patients.age < 18 GROUP BY conditions.condition ORDER BY count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_emissions (id INT, country VARCHAR(50), co2_emissions INT); INSERT INTO textile_emissions (id, country, co2_emissions) VALUES (1, 'Bangladesh', 5000), (2, 'China', 15000), (3, 'India', 10000), (4, 'USA', 8000); | Which country has the highest CO2 emissions in textile industry? | SELECT country, MAX(co2_emissions) as max_emissions FROM textile_emissions GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Smart_Contracts (Contract_Address VARCHAR(100), Transaction_Date DATE, Transaction_Amount FLOAT); INSERT INTO Smart_Contracts (Contract_Address, Transaction_Date, Transaction_Amount) VALUES ('0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', '2022-01-03', 600); INSERT INTO Smart_Contracts (Contract_Address, Tra... | What is the total transaction amount for each smart contract address? | SELECT Contract_Address, SUM(Transaction_Amount) FROM Smart_Contracts GROUP BY Contract_Address | gretelai_synthetic_text_to_sql |
CREATE TABLE games (id INT, name VARCHAR(100), release_date DATE, revenue INT); INSERT INTO games (id, name, release_date, revenue) VALUES (1, 'Apex Legends', '2019-02-04', 5000000); INSERT INTO games (id, name, release_date, revenue) VALUES (2, 'Fortnite', '2017-07-21', 10000000); | Calculate the total revenue for all games released in 2021 | SELECT SUM(revenue) FROM games WHERE EXTRACT(YEAR FROM release_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_severity (id INT, ip_address VARCHAR(255), country VARCHAR(255), severity VARCHAR(255)); INSERT INTO country_severity (id, ip_address, country, severity) VALUES (1, '192.168.1.1', 'US', 'High'), (2, '10.0.0.1', 'Canada', 'Low'), (3, '192.168.1.2', 'Mexico', 'High'), (4, '10.0.0.2', 'Canada', 'Mediu... | Which countries have 'High' severity vulnerabilities and the number of such vulnerabilities? Provide the output in the format: country, count_of_high_severity_vulnerabilities. | SELECT country, COUNT(*) as count_of_high_severity_vulnerabilities FROM country_severity WHERE severity = 'High' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE complaint (id INT, category VARCHAR(50), district_id INT, date DATE); INSERT INTO complaint (id, category, district_id, date) VALUES (1, 'healthcare', 1, '2022-01-01'), (2, 'education', 2, '2022-01-15'), (3, 'healthcare', 3, '2022-03-01'), (4, 'education', 1, '2022-04-01'); | How many healthcare complaints were received from rural areas in Q1 2022? | SELECT COUNT(*) FROM complaint WHERE category = 'healthcare' AND district_id IN (SELECT id FROM district WHERE type = 'rural') AND date BETWEEN '2022-01-01' AND '2022-03-31'; | 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), (3, 'Bob Johnson', 700.00); INSERT INTO donations... | Who are the top 3 donors by total donation amount in 'donations' table? | SELECT donor_id, SUM(amount) as total_donations FROM donations GROUP BY donor_id ORDER BY total_donations DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (item_category VARCHAR(20), daily_revenue DECIMAL(10,2)); INSERT INTO restaurant_revenue (item_category, daily_revenue) VALUES ('Burger', 1500.00), ('Pizza', 1200.00), ('Salad', 800.00); | What is the total revenue for the 'Burger' category? | SELECT SUM(daily_revenue) FROM restaurant_revenue WHERE item_category = 'Burger'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, location VARCHAR(20), entry_fee INT); INSERT INTO Exhibitions (exhibition_id, location, entry_fee) VALUES (1, 'Seoul', 12), (2, 'Seoul', 8), (3, 'Seoul', 25); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT); INSERT INTO Visitors (visitor_id, exhibition_id) VALUES (... | What is the average entry fee for exhibitions in Seoul with more than 50 visitors? | SELECT AVG(entry_fee) FROM Exhibitions WHERE location = 'Seoul' GROUP BY location HAVING COUNT(DISTINCT visitor_id) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE Space_Missions (ID INT, Mission_Name VARCHAR(255), Country VARCHAR(255), Avg_Altitude FLOAT); INSERT INTO Space_Missions (ID, Mission_Name, Country, Avg_Altitude) VALUES (1, 'Apollo 11', 'USA', 363300); | What is the average altitude of all space missions launched by a specific country, according to the Space_Missions table? | SELECT Country, AVG(Avg_Altitude) FROM Space_Missions GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapy_sessions (patient_id INT, session_type VARCHAR(50)); INSERT INTO therapy_sessions (patient_id, session_type) VALUES (1, 'Individual Therapy'), (2, 'Group Therapy'), (3, 'CBT'), (4, 'Group Therapy'), (5, 'Individual Therapy'); CREATE TABLE patient_location (patient_id INT, location VARCHAR(50)); INS... | What is the total number of patients who have received group therapy in New York? | SELECT COUNT(DISTINCT patient_id) FROM therapy_sessions JOIN patient_location ON therapy_sessions.patient_id = patient_location.patient_id WHERE session_type = 'Group Therapy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (sale_id INT PRIMARY KEY, menu_item VARCHAR(50), sale_quantity INT, sale_date DATE); CREATE TABLE Menu (menu_item VARCHAR(50) PRIMARY KEY, menu_item_category VARCHAR(50)); | Which menu items have experienced a decrease in sales in the past month compared to the same month last year? | SELECT s1.menu_item, s1.sale_quantity - s2.sale_quantity AS sales_delta FROM Sales s1 JOIN Sales s2 ON s1.menu_item = s2.menu_item WHERE s1.sale_date >= DATEADD(month, -1, GETDATE()) AND s2.sale_date >= DATEADD(month, -13, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, sector TEXT, month INT, year INT, amount FLOAT); INSERT INTO donations (id, sector, month, year, amount) VALUES (1, 'refugee support', 1, 2020, 5000.00); INSERT INTO donations (id, sector, month, year, amount) VALUES (2, 'refugee support', 2, 2020, 6000.00); INSERT INTO donations (id, se... | What is the average amount of donations received per month in the 'refugee support' sector? | SELECT AVG(amount) FROM donations WHERE sector = 'refugee support' GROUP BY year, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE investor_demographics (investor_id INT, investor_name VARCHAR(255), investment_amount INT, investment_year INT, sector VARCHAR(255), gender VARCHAR(10)); INSERT INTO investor_demographics (investor_id, investor_name, investment_amount, investment_year, sector, gender) VALUES (1, 'EcoGrowth', 120000, 2021, ... | What is the total investment in sustainable agriculture by gender in 2021? | SELECT gender, SUM(investment_amount) as total_investment FROM investor_demographics WHERE investment_year = 2021 AND sector = 'Sustainable Agriculture' GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (vulnerability_id INT, severity VARCHAR(255), last_updated TIMESTAMP, patch_time INT); INSERT INTO vulnerabilities (vulnerability_id, severity, last_updated, patch_time) VALUES (1, 'High', '2022-01-01 10:00:00', 3), (2, 'High', '2022-02-01 15:30:00', 5), (3, 'High', '2022-03-01 08:15:00', 7... | What is the average time taken to patch high-severity vulnerabilities in the last quarter? | SELECT AVG(patch_time) as avg_patch_time FROM vulnerabilities WHERE severity = 'High' AND last_updated >= DATEADD(quarter, -1, CURRENT_TIMESTAMP); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, name VARCHAR(50), age INT, gender VARCHAR(10), condition VARCHAR(50)); INSERT INTO patients (patient_id, name, age, gender, condition) VALUES (1, 'John Doe', 30, 'Male', 'Anxiety Disorder'); INSERT INTO patients (patient_id, name, age, gender, condition) VALUES (2, 'Jane Smith', 3... | What's the average age of patients diagnosed with anxiety disorder? | SELECT AVG(age) FROM patients WHERE condition = 'Anxiety Disorder'; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_membership (id INT, union_name VARCHAR(255), year INT, membership INT); INSERT INTO union_membership (id, union_name, year, membership) VALUES (1, 'Union A', 2020, 5000), (2, 'Union A', 2021, 5500), (3, 'Union B', 2020, 6000), (4, 'Union B', 2021, 6200), (5, 'Union C', 2020, 4000), (6, 'Union C', 202... | What is the percentage change in Union membership from 2020 to 2021 for each union? | SELECT u.union_name, ((m2.membership - m1.membership) * 100.0 / m1.membership) as pct_change FROM union_membership m1 JOIN union_membership m2 ON m1.union_name = m2.union_name AND m1.year = 2020 AND m2.year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE musicals (title VARCHAR(255), location VARCHAR(255), price DECIMAL(5,2)); INSERT INTO musicals (title, location, price) VALUES ('Phantom of the Opera', 'New York', 125.99), ('Lion King', 'New York', 149.99), ('Hamilton', 'Chicago', 200.00), ('Wicked', 'Los Angeles', 150.00); | What is the average ticket price for all musicals in the United States? | SELECT AVG(price) FROM musicals WHERE location IN ('New York', 'Chicago', 'Los Angeles'); | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_expeditions (id INT, expedition_name VARCHAR(255), year INT, region VARCHAR(255)); INSERT INTO deep_sea_expeditions (id, expedition_name, year, region) VALUES (1, 'Expedition A', 2015, 'Southern Ocean'); INSERT INTO deep_sea_expeditions (id, expedition_name, year, region) VALUES (2, 'Expedition B'... | How many deep-sea expeditions have been conducted in the Southern Ocean since 2010? | SELECT COUNT(*) FROM deep_sea_expeditions WHERE region = 'Southern Ocean' AND year >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_data (year INT, country VARCHAR(15), investment FLOAT); INSERT INTO investment_data (year, country, investment) VALUES (2019, 'Australia', 2500000), (2020, 'Australia', 3000000), (2021, 'Australia', 3500000); | What is the maximum network infrastructure investment in Australia for the last 3 years? | SELECT MAX(investment) as max_investment FROM investment_data WHERE country = 'Australia' AND year BETWEEN 2019 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(50), game VARCHAR(50), last_played DATETIME); INSERT INTO users VALUES (1, 'United States', 'Cybernetic Realms', '2022-02-03 16:20:00'); INSERT INTO users VALUES (2, 'Canada', 'Cybernetic Realms', '2022-02-10 09:35:00'); | How many users from the United States have played the virtual reality game "Cybernetic Realms" in the last month? | SELECT COUNT(*) FROM users WHERE country = 'United States' AND game = 'Cybernetic Realms' AND last_played >= DATE_SUB(NOW(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE swimming_pools (id INT, name VARCHAR(50), location VARCHAR(50), length INT); | Show the swimming pools with a length of 50 meters | SELECT name FROM swimming_pools WHERE length = 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabrics (id INT, name TEXT); INSERT INTO fabrics (id, name) VALUES (1, 'Cotton'), (2, 'Polyester'), (3, 'Wool'); CREATE TABLE garments (id INT, name TEXT, fabric_id INT, quantity INT); INSERT INTO garments (id, name, fabric_id, quantity) VALUES (1, 'Shirt', 1, 50), (2, 'Pants', 2, 75), (3, 'Jacket', 3, 30)... | List the total quantity of each fabric type used in garment manufacturing in France. | SELECT f.name, SUM(g.quantity) FROM fabrics f JOIN garments g ON f.id = g.fabric_id JOIN garment_manufacturers gm ON g.id = gm.garment_id JOIN manufacturers m ON gm.manufacturer_id = m.id WHERE m.country = 'France' GROUP BY f.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback(service VARCHAR(20), region VARCHAR(20), feedback_id INT); INSERT INTO Feedback VALUES ('ServiceA', 'RegionC', 1001), ('ServiceA', 'RegionC', 1002), ('ServiceB', 'RegionD', 2001), ('ServiceB', 'RegionD', 2002), ('ServiceA', 'RegionA', 1501), ('ServiceA', 'RegionA', 1502); | How many citizen feedback records are there for 'ServiceA' in 'RegionA'? | SELECT COUNT(*) FROM Feedback WHERE service = 'ServiceA' AND region = 'RegionA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hockey_teams (team_id INT, team_name VARCHAR(50), goals INT); INSERT INTO hockey_teams (team_id, team_name, goals) VALUES (1, 'Montreal Canadiens', 187), (2, 'Toronto Maple Leafs', 201), (3, 'Vancouver Canucks', 178); | What is the total number of goals scored by each hockey team in the 2022 season? | SELECT team_name, SUM(goals) as total_goals FROM hockey_teams GROUP BY team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE advertisers (id INT PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE ad_revenue (advertiser_id INT, revenue DECIMAL(10, 2), date DATE); | Find total revenue for each advertiser, per quarter | SELECT advertisers.name, CONCAT(QUARTER(ad_revenue.date), '/', YEAR(ad_revenue.date)) as quarter, SUM(ad_revenue.revenue) as total_revenue FROM advertisers INNER JOIN ad_revenue ON advertisers.id = ad_revenue.advertiser_id GROUP BY advertisers.name, quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE productivity(id INT, worker TEXT, department TEXT, year INT, productivity FLOAT);INSERT INTO productivity(id, worker, department, year, productivity) VALUES (1, 'John', 'mining', 2020, 12.5), (2, 'Jane', 'mining', 2020, 13.7), (3, 'Mike', 'mining', 2020, 11.8), (4, 'Lucy', 'geology', 2020, 15.1), (5, 'Ella... | What is the average productivity of workers in each department for the year 2020? | SELECT department, AVG(productivity) FROM productivity WHERE year = 2020 GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_exploration (site_id INT, name VARCHAR(255), depth FLOAT); INSERT INTO deep_sea_exploration (site_id, name, depth) VALUES (1, 'Atlantis', 5000.0), (2, 'Challenger Deep', 10994.0), (3, 'Sirena Deep', 8098.0); | What is the average depth of all deep-sea exploration sites? | SELECT AVG(depth) FROM deep_sea_exploration; | gretelai_synthetic_text_to_sql |
CREATE TABLE bioprocess_projects (id INT, project_name VARCHAR(50), location VARCHAR(50), funding_amount INT); INSERT INTO bioprocess_projects (id, project_name, location, funding_amount) VALUES (1, 'Project G', 'UK', 12000000); INSERT INTO bioprocess_projects (id, project_name, location, funding_amount) VALUES (2, 'Pr... | What is the total funding for bioprocess engineering projects in the UK? | SELECT SUM(funding_amount) FROM bioprocess_projects WHERE location = 'UK' AND technology = 'Bioprocess Engineering'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.startups (id INT, name VARCHAR(50), location VARCHAR(50), funding DECIMAL(10, 2)); INSERT INTO biotech.startups (id, name, location, funding) VALUES (1, 'BioGen', 'Indonesia', 3000000.00), (2, 'Cell Therapy Asia', 'Thailand', 5000000.00), (3, 'Bio ... | What is the total funding received by biotech startups in Indonesia, Thailand, and Malaysia? | SELECT SUM(funding) FROM biotech.startups WHERE location IN ('Indonesia', 'Thailand', 'Malaysia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_ownership (id INT, city VARCHAR(25), vehicle_type VARCHAR(20), ownership INT); | What is the total number of electric vehicles in 'vehicle_ownership' table for each city? | SELECT city, SUM(ownership) FROM vehicle_ownership WHERE vehicle_type = 'Electric Vehicle' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Port (PortID INT, PortName VARCHAR(50), City VARCHAR(50), Country VARCHAR(50)); INSERT INTO Port (PortID, PortName, City, Country) VALUES (1, 'Port of Los Angeles', 'Los Angeles', 'USA'); INSERT INTO Port (PortID, PortName, City, Country) VALUES (2, 'Port of Rotterdam', 'Rotterdam', 'Netherlands'); CREATE ... | What is the average gross tonnage of container vessels per country? | SELECT p.Country, AVG(v.GrossTonnage) AS AvgGrossTonnage FROM Vessel v JOIN Port p ON v.PortID = p.PortID WHERE VesselType = 'Container' GROUP BY p.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE offenses (id INT, victim_id INT, offense_type VARCHAR(50), date_of_offense DATE); | Update the "offenses" table to reflect a new offense type | UPDATE offenses SET offense_type = 'Cyberstalking' WHERE id = 2001; | gretelai_synthetic_text_to_sql |
CREATE TABLE Field11 (date DATE, temperature FLOAT); INSERT INTO Field11 VALUES ('2021-08-01', 31), ('2021-08-02', 28); CREATE TABLE Field12 (date DATE, temperature FLOAT); INSERT INTO Field12 VALUES ('2021-08-01', 33), ('2021-08-02', 29); | What is the number of days with temperature above 30 degrees in Field11 and Field12 in the month of August? | SELECT COUNT(*) as days_above_30 FROM (SELECT f11.date FROM Field11 f11 WHERE f11.temperature > 30 UNION ALL SELECT f12.date FROM Field12 f12 WHERE f12.temperature > 30) as days_above_30; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_development (teacher_id INT, teacher_name VARCHAR(50), course_title VARCHAR(100), course_date DATE); INSERT INTO teacher_development (teacher_id, teacher_name, course_title, course_date) VALUES (1, 'John Doe', 'Python Programming', '2021-04-01'), (2, 'Jane Smith', 'Data Analysis with SQL', '2021-05... | What are the unique professional development courses taken by teachers in 'Spring 2021' and 'Fall 2021'? | SELECT DISTINCT course_title FROM teacher_development WHERE course_date BETWEEN '2021-04-01' AND '2021-12-31' ORDER BY course_title; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_id INT, site_name TEXT, country TEXT, num_virtual_tours INT); INSERT INTO cultural_sites (site_id, site_name, country, num_virtual_tours) VALUES (1, 'Temple A', 'Japan', 2), (2, 'Shrine B', 'Japan', 5); | Which cultural heritage sites in Japan have more than 3 virtual tours? | SELECT site_name, country FROM cultural_sites WHERE country = 'Japan' AND num_virtual_tours > 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_developers (id INT, game VARCHAR(20), developer VARCHAR(20)); INSERT INTO game_developers (id, game, developer) VALUES (1, 'Game1', 'Dev1'), (2, 'Game2', 'Dev2'), (3, 'Game3', 'Dev1'); | What is the total number of games released by a specific developer? | SELECT developer, COUNT(DISTINCT game) as count FROM game_developers GROUP BY developer; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_accidents (year INT, location VARCHAR); INSERT INTO marine_accidents (year, location) VALUES (2016, 'Indian Ocean'), (2017, 'Indian Ocean'), (2018, 'Indian Ocean'); | List all marine accidents in the Indian Ocean after 2015. | SELECT * FROM marine_accidents WHERE location = 'Indian Ocean' AND year > 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE AISafetyIncidents (IncidentID INT PRIMARY KEY, IncidentType VARCHAR(20), Country VARCHAR(20)); INSERT INTO AISafetyIncidents (IncidentID, IncidentType, Country) VALUES (1, 'Data Leakage', 'USA'), (2, 'Unexpected Behavior', 'Canada'), (3, 'System Failure', 'Mexico'); | List the number of AI safety incidents per country, sorted by the number of incidents in descending order. | SELECT Country, COUNT(*) AS IncidentCount FROM AISafetyIncidents GROUP BY Country ORDER BY IncidentCount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (ConcertID INT, ArtistID INT, Venue VARCHAR(100), Date DATE); | What is the average concert ticket price for Hip-Hop artists? | SELECT AVG(T.Price) AS AvgPrice FROM Artists A INNER JOIN Concerts C ON A.ArtistID = C.ArtistID INNER JOIN Tickets T ON C.ConcertID = T.ConcertID WHERE A.Genre = 'Hip-Hop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FoodSafetyRecords (RecordID INT, DeleteDate DATE); INSERT INTO FoodSafetyRecords (RecordID, DeleteDate) VALUES (1, '2022-01-01'), (2, '2022-01-05'), (3, '2022-02-10'), (4, '2022-03-20'), (5, '2022-03-30'); | How many food safety records were deleted in each month of 2022? | SELECT EXTRACT(MONTH FROM DeleteDate) AS Month, COUNT(*) FROM FoodSafetyRecords WHERE DeleteDate BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY EXTRACT(MONTH FROM DeleteDate); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_urbanism (property_id INT, city VARCHAR(50), price INT, co_owner_count INT); INSERT INTO sustainable_urbanism (property_id, city, price, co_owner_count) VALUES (1, 'Los Angeles', 900000, 2), (2, 'Portland', 400000, 1), (3, 'Los Angeles', 1000000, 3), (4, 'Seattle', 700000, 1); | Calculate the average price of sustainable urbanism projects in Los Angeles with at least 2 co-owners. | SELECT AVG(price) FROM sustainable_urbanism WHERE city = 'Los Angeles' AND co_owner_count > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_parks (name VARCHAR(255), state VARCHAR(255), established_year INT); INSERT INTO public_parks (name, state, established_year) VALUES ('Central Park', 'NY', 1857); INSERT INTO public_parks (name, state, established_year) VALUES ('Prospect Park', 'NY', 1867); | What is the total number of public parks in the state of New York that were established after the year 2010? | SELECT COUNT(*) FROM public_parks WHERE state = 'NY' AND established_year > 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT PRIMARY KEY, source VARCHAR(255), capacity FLOAT, location VARCHAR(255)); INSERT INTO renewable_energy (id, source, capacity, location) VALUES (1, 'Solar', 50.0, 'California'); INSERT INTO renewable_energy (id, source, capacity, location) VALUES (2, 'Wind', 100.0, 'Texas'); INSERT ... | What is the total capacity of renewable energy sources in New York? | SELECT source, SUM(capacity) FROM renewable_energy WHERE location = 'New York' GROUP BY source; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stores (store_id INT, store_name VARCHAR(255)); INSERT INTO Stores (store_id, store_name) VALUES (1, 'Store A'), (2, 'Store B'), (3, 'Store C'); CREATE TABLE Products (product_id INT, product_name VARCHAR(255), is_organic BOOLEAN); INSERT INTO Products (product_id, product_name, is_organic) VALUES (1, 'App... | What is the total quantity of "organic apples" sold by each store? | SELECT s.store_name, p.product_name, SUM(s.quantity) as total_quantity FROM Sales s JOIN Stores st ON s.store_id = st.store_id JOIN Products p ON s.product_id = p.product_id WHERE p.is_organic = TRUE AND p.product_name = 'Organic Apples' GROUP BY s.store_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE SatelliteLaunchesByISRO (id INT, satellite_name VARCHAR(100), launch_year INT, company VARCHAR(100)); INSERT INTO SatelliteLaunchesByISRO (id, satellite_name, launch_year, company) VALUES (1, 'GSAT-12', 2009, 'ISRO'); INSERT INTO SatelliteLaunchesByISRO (id, satellite_name, launch_year, company) VALUES (2,... | How many satellites have been launched by ISRO before 2015? | SELECT COUNT(*) FROM SatelliteLaunchesByISRO WHERE launch_year < 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE whale_sightings (sighting_date DATE, ocean TEXT); INSERT INTO whale_sightings (sighting_date, ocean) VALUES ('2021-01-01', 'Arctic Ocean'), ('2021-02-01', 'Antarctic Ocean'); | How many whale sightings are there in total? | SELECT COUNT(*) FROM whale_sightings; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, state TEXT, total_donated DECIMAL(10,2)); INSERT INTO donors (id, name, state, total_donated) VALUES (1, 'Sarah Lee', 'Texas', 75.00); CREATE TABLE donations (id INT, donor_id INT, org_id INT, donation_amount DECIMAL(10,2)); INSERT INTO donations (id, donor_id, org_id, donation_a... | Show the number of unique donors who have donated to organizations with 'Animal' in their name, excluding donors who have donated less than $50 in their lifetime. | SELECT COUNT(DISTINCT donor_id) FROM donations JOIN organizations ON donations.org_id = organizations.id WHERE organizations.name LIKE '%Animal%' AND donor_id IN (SELECT donor_id FROM donations JOIN donors ON donations.donor_id = donors.id GROUP BY donor_id HAVING SUM(donation_amount) >= 50.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE projects(id INT, name VARCHAR(50), lead_researcher VARCHAR(50), start_date DATE);INSERT INTO projects (id, name, lead_researcher, start_date) VALUES (1, 'ProjectX', 'Dr. Jane Smith', '2021-01-01');INSERT INTO projects (id, name, lead_researcher, start_date) VALUES (2, 'ProjectY', 'Dr. John Doe', '2020-06-1... | List all genetic research projects, their respective lead researchers, and their start dates. | SELECT name, lead_researcher, start_date FROM projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, name VARCHAR(50), position VARCHAR(50), height FLOAT, weight INT, team_id INT, league VARCHAR(50), salary INT); INSERT INTO players (player_id, name, position, height, weight, team_id, league, salary) VALUES (2, 'Bob', 'Pitcher', 1.9, 95, 201, 'MLB', 10000000); | What is the maximum salary of players in the 'MLB' league who play the 'Pitcher' position? | SELECT MAX(salary) FROM players WHERE position = 'Pitcher' AND league = 'MLB'; | gretelai_synthetic_text_to_sql |
CREATE TABLE team_performance (team_id INT PRIMARY KEY, team_name VARCHAR(50), wins INT, losses INT); CREATE TABLE ticket_sales (sale_id INT PRIMARY KEY, team_id INT, sale_date DATE, quantity INT); ALTER TABLE athlete_wellbeing ADD COLUMN ticket_sales INT; | Drop the 'ticket_sales' column | ALTER TABLE athlete_wellbeing DROP COLUMN ticket_sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE district_stats (district_id INT, year INT, cases INT); INSERT INTO district_stats (district_id, year, cases) VALUES (1, 2019, 12), (2, 2019, 18), (3, 2019, 9), (4, 2019, 15), (5, 2019, 10), (6, 2019, 14); | What is the standard deviation of restorative justice cases per district in 2019? | SELECT d.district_id, STDEV(d.cases) AS std_dev_cases FROM district_stats d WHERE d.year = 2019 GROUP BY d.district_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development(id INT, region TEXT, initiative_name TEXT, status TEXT); | Insert a new community development initiative in 'Amazonas' region with ID 3, name 'Cultural Center', and status 'planning' into the 'community_development' table. | INSERT INTO community_development (id, region, initiative_name, status) VALUES (3, 'Amazonas', 'Cultural Center', 'planning'); | gretelai_synthetic_text_to_sql |
CREATE TABLE local_exhibitions (exhibit_id INT, exhibit_name TEXT, location TEXT); | Insert new records of local art exhibitions in Canada and the United States into the 'local_exhibitions' table. | INSERT INTO local_exhibitions (exhibit_id, exhibit_name, location) VALUES (1, 'Canadian Art Showcase', 'Canada'), (2, 'American Art Experience', 'United States'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai_principles (id INT PRIMARY KEY, principle_name VARCHAR(50), description TEXT); | Insert a new record into the "ethical_ai_principles" table with the name "Fairness", "description" as "AI should be fair and impartial" | INSERT INTO ethical_ai_principles (principle_name, description) VALUES ('Fairness', 'AI should be fair and impartial'); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (name VARCHAR(255), category VARCHAR(255), created_date DATE); INSERT INTO programs (name, category, created_date) VALUES ('Media Literacy 101', 'Media Literacy', '2021-05-01'), ('Critical Thinking', 'Media Literacy', '2020-08-15'); | List the names of all tables and views related to media literacy programs, along with their creation dates. | SELECT name, created_date FROM programs WHERE category = 'Media Literacy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sustainable_Seafood (Species_ID INT, Species_Name VARCHAR(100), Sustainability_Rating INT); INSERT INTO Sustainable_Seafood (Species_ID, Species_Name, Sustainability_Rating) VALUES (1, 'Atlantic Cod', 60), (2, 'Pacific Salmon', 80); | Update the sustainability rating of Atlantic Cod to 70 | UPDATE Sustainable_Seafood SET Sustainability_Rating = 70 WHERE Species_Name = 'Atlantic Cod'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ClimateChangeCommunication (ID INT, CampaignName VARCHAR(255), Region VARCHAR(255), Investment DECIMAL(10,2)); INSERT INTO ClimateChangeCommunication (ID, CampaignName, Region, Investment) VALUES (1, 'Campaign 1', 'Latin America', 50000), (2, 'Campaign 2', 'Asia', 60000), (3, 'Campaign 3', 'Europe', 45000)... | What is the total investment in climate change communication campaigns for Latin America? | SELECT SUM(Investment) FROM ClimateChangeCommunication WHERE Region = 'Latin America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO warehouse (id, name, location) VALUES (1, 'Warehouse A', 'City A'), (2, 'Warehouse B', 'City B'); CREATE TABLE inventory (id INT, warehouse_id INT, product VARCHAR(50), quantity INT); INSERT INTO inventory (id, warehouse_id, product, q... | What is the total quantity of items stored in each warehouse for a specific product category? | SELECT w.name, p.category, SUM(i.quantity) as total_quantity FROM inventory i JOIN warehouse w ON i.warehouse_id = w.id JOIN product p ON i.product = p.name GROUP BY w.name, p.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE china_provinces (id INT, province VARCHAR(50)); CREATE TABLE hospitals (id INT, name VARCHAR(50), province_id INT); INSERT INTO china_provinces (id, province) VALUES (1, 'Anhui'), (2, 'Beijing'), (3, 'Chongqing'); INSERT INTO hospitals (id, name, province_id) VALUES (1, 'Anqing Hospital', 1), (2, 'Beijing ... | How many hospitals are there in each province of China? | SELECT p.province, COUNT(h.id) AS total_hospitals FROM hospitals h JOIN china_provinces p ON h.province_id = p.id GROUP BY p.province; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sightings (Species VARCHAR(25), Ocean VARCHAR(25), Sightings INT); INSERT INTO Sightings (Species, Ocean, Sightings) VALUES ('Dolphin', 'Atlantic Ocean', 200), ('Turtle', 'Pacific Ocean', 350), ('Shark', 'Indian Ocean', 150), ('Whale', 'Pacific Ocean', 400); | Update the sighting frequency of 'Dolphin' in the 'Atlantic Ocean' to 220. | UPDATE Sightings SET Sightings = 220 WHERE Species = 'Dolphin' AND Ocean = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (id INT, name TEXT, city TEXT); INSERT INTO teams (id, name, city) VALUES (1, 'Chicago Bulls', 'Chicago'); CREATE TABLE games (id INT, home_team_id INT, away_team_id INT, points_home INT, points_away INT); | What is the average points scored by the Chicago Bulls in their home games? | SELECT AVG(points_home) FROM games WHERE home_team_id = (SELECT id FROM teams WHERE name = 'Chicago Bulls' AND city = 'Chicago'); | gretelai_synthetic_text_to_sql |
CREATE TABLE australia_droughts (year INT, affected_areas INT); INSERT INTO australia_droughts (year, affected_areas) VALUES (2017, 50), (2018, 75), (2019, 100), (2020, 125); | How many drought-affected areas were reported in Australia between 2017 and 2020? | SELECT SUM(australia_droughts.affected_areas) as total_drought_affected_areas FROM australia_droughts WHERE australia_droughts.year BETWEEN 2017 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE beauty_products_australia (certified_organic BOOLEAN, sale_date DATE, sales_quantity INT, unit_price DECIMAL(5,2)); INSERT INTO beauty_products_australia (certified_organic, sale_date, sales_quantity, unit_price) VALUES (TRUE, '2022-01-01', 130, 26.99), (FALSE, '2022-01-01', 170, 22.99); | What are the total sales and average sales per transaction for beauty products that are certified organic in Australia? | SELECT SUM(sales_quantity * unit_price) AS total_sales, AVG(sales_quantity) AS avg_sales_per_transaction FROM beauty_products_australia WHERE certified_organic = TRUE AND sale_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceExploration (id INT, agency VARCHAR(255), country VARCHAR(255), cost FLOAT, flights INT, year INT); INSERT INTO SpaceExploration VALUES (1, 'NASA', 'USA', 22000000000, 500, 2010), (2, 'ESA', 'Europe', 18000000000, 300, 2015), (3, 'Roscosmos', 'Russia', 15000000000, 450, 2012), (4, 'ISRO', 'India', 700... | What is the minimum number of flights for space exploration missions led by Roscosmos? | SELECT MIN(flights) FROM SpaceExploration WHERE agency = 'Roscosmos'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_satisfaction(hotel_id INT, hotel_name TEXT, country TEXT, is_sustainable BOOLEAN, guest_satisfaction INT); INSERT INTO hotel_satisfaction (hotel_id, hotel_name, country, is_sustainable, guest_satisfaction) VALUES (1, 'Eco Lodge', 'Canada', true, 9), (2, 'Grand Hotel', 'Canada', false, 8), (3, 'Green ... | Which sustainable hotels in Canada have the highest guest satisfaction scores? | SELECT hotel_name, guest_satisfaction FROM hotel_satisfaction WHERE country = 'Canada' AND is_sustainable = true ORDER BY guest_satisfaction DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_activities (region VARCHAR(50), crop VARCHAR(50), planting_date DATE); INSERT INTO farm_activities VALUES ('West Coast', 'Wheat', '2022-04-01'); INSERT INTO farm_activities VALUES ('West Coast', 'Corn', '2022-05-01'); INSERT INTO farm_activities VALUES ('East Coast', 'Rice', '2022-06-01'); | How many different crops were grown in 'farm_activities' table per region? | SELECT region, COUNT(DISTINCT crop) AS num_crops FROM farm_activities GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), rating DECIMAL(3,2), production_country VARCHAR(64)); INSERT INTO movies (id, title, rating, production_country) VALUES (1, 'MovieA', 7.5, 'Spain'), (2, 'MovieB', 8.2, 'Italy'), (3, 'MovieC', 6.8, 'France'); | What is the average rating of movies produced in Spain and Italy? | SELECT AVG(rating) FROM movies WHERE production_country IN ('Spain', 'Italy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Deliveries (order_id INT, delivery_date DATE, material_sustainable BOOLEAN); CREATE TABLE Orders (order_id INT, order_date DATE, country VARCHAR(50)); | What is the percentage of sustainable material orders in each country? | SELECT O.country, (COUNT(D.order_id) * 100.0 / (SELECT COUNT(*) FROM Orders) ) as percentage FROM Deliveries D INNER JOIN Orders O ON D.order_id = O.order_id WHERE D.material_sustainable = TRUE GROUP BY O.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artwork_data (id INT, art_name VARCHAR(50), artist_name VARCHAR(50), value DECIMAL(10, 2)); | What is the total value of artworks by female artists? | SELECT SUM(value) as total_value FROM artwork_data WHERE artist_name LIKE '%female%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE route (route_id INT, route_name VARCHAR(50)); INSERT INTO route (route_id, route_name) VALUES (1, 'Red Line'), (2, 'Green Line'), (3, 'Blue Line'), (4, 'Yellow Line'); CREATE TABLE fare (fare_id INT, route_id INT, fare_amount DECIMAL(5,2), collection_date DATE); INSERT INTO fare (fare_id, route_id, fare_am... | What is the total fare collected from each route on the first day of each month? | SELECT route_name, SUM(fare_amount) FROM route JOIN fare ON route.route_id = fare.route_id WHERE DAY(collection_date) = 1 GROUP BY route_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (OrderID int, OrderDate date, OrderStatus varchar(50)); INSERT INTO Orders VALUES (1, '2022-01-01', 'Pending'), (2, '2022-01-02', 'Shipped'), (3, '2022-01-03', 'Pending'), (4, '2022-01-04', 'Shipped'); | Update the status of all orders in the Orders table to 'Shipped' where the order date is older than 7 days. | UPDATE Orders SET OrderStatus = 'Shipped' WHERE DATEDIFF(day, OrderDate, GETDATE()) > 7 AND OrderStatus = 'Pending'; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(50), community VARCHAR(50), grant_received INT, grant_year INT); | How many research grants were awarded to graduate students from historically underrepresented communities in the past year? | SELECT COUNT(grant_received) FROM graduate_students WHERE community IN ('African American', 'Hispanic', 'Native American') AND grant_year = YEAR(CURRENT_DATE) - 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Agency (Name VARCHAR(50), Region VARCHAR(50)); INSERT INTO Agency (Name, Region) VALUES ('Mossad', 'Middle East'), ('CIA', 'North America'), ('MI6', 'Europe'), ('ASIO', 'Australia'), ('MSS', 'China'); | What are the names of all intelligence agencies in the Middle East? | SELECT Name FROM Agency WHERE Region = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_achievements (player_id INT, achievement_name VARCHAR(255), date_earned DATE); | Display the number of players who earned an achievement on '2022-01-01' or '2022-01-02' in 'player_achievements' table | SELECT COUNT(DISTINCT player_id) FROM player_achievements WHERE date_earned IN ('2022-01-01', '2022-01-02'); | gretelai_synthetic_text_to_sql |
CREATE TABLE user_activity (user_id INT, song_id INT, stream_date DATE); INSERT INTO user_activity (user_id, song_id, stream_date) VALUES (1, 1, '2022-01-01'); INSERT INTO user_activity (user_id, song_id, stream_date) VALUES (2, 2, '2022-01-15'); | Remove users who have not streamed any songs in the past month. | DELETE FROM user_activity WHERE stream_date < DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_code CHAR(3), country_name VARCHAR(100), continent VARCHAR(50));CREATE TABLE destinations (destination_id INT, destination_name VARCHAR(100), is_historical BOOLEAN, continent VARCHAR(50));CREATE TABLE bookings (booking_id INT, guest_id INT, destination_id INT, country_code CHAR(3));CREAT... | What is the percentage of tourists visiting historical sites in Asia that use public transportation? | SELECT 100.0 * COUNT(DISTINCT b.guest_id) / (SELECT COUNT(DISTINCT b.guest_id) FROM bookings b JOIN destinations d ON b.destination_id = d.destination_id JOIN countries c ON b.country_code = c.country_code WHERE d.is_historical = TRUE AND c.continent = 'Asia') AS percentage FROM transportation t JOIN bookings b ON t.bo... | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (state varchar(2), hospital_name varchar(25), num_beds int); INSERT INTO hospitals (state, hospital_name, num_beds) VALUES ('NY', 'NY Presbyterian', 2001), ('CA', 'UCLA Medical', 1012), ('TX', 'MD Anderson', 1543), ('FL', 'Mayo Clinic FL', 1209); | What is the total number of hospital beds and the number of beds per hospital per state? | SELECT state, AVG(num_beds) as avg_beds_per_hospital FROM hospitals GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE regional_water_usage (region TEXT, date DATE, water_consumption FLOAT); INSERT INTO regional_water_usage (region, date, water_consumption) VALUES ('Northeast', '2020-01-01', 1000000), ('Northeast', '2020-02-01', 1200000), ('Southeast', '2020-01-01', 1500000), ('Southeast', '2020-02-01', 1800000); | What is the total water consumption in each region for the last 12 months? | SELECT region, SUM(water_consumption) FROM regional_water_usage WHERE date >= (CURRENT_DATE - INTERVAL '12 month') GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (id INT, name VARCHAR(50), country VARCHAR(50)); INSERT INTO states (id, name, country) VALUES (1, 'Abia', 'Nigeria'); CREATE TABLE smallholder_farmers (id INT, crop_value FLOAT, state_id INT); INSERT INTO smallholder_farmers (id, crop_value, state_id) VALUES (1, 10000.0, 1); CREATE TABLE total_agri... | What is the total value of agricultural crops produced by smallholder farmers in each state of Nigeria, and what percentage do they contribute to the total agricultural production? | SELECT s.name, SUM(sf.crop_value) as total_value, (SUM(sf.crop_value) / tap.total_production) * 100 as percentage FROM smallholder_farmers sf INNER JOIN states s ON sf.state_id = s.id INNER JOIN total_agricultural_production tap ON sf.state_id = tap.state_id GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_companies (id INT, name VARCHAR(100), employees INT, location VARCHAR(100)); CREATE TABLE explainable_papers (id INT, company_id INT, title VARCHAR(100), year INT); | List AI companies in Latin America or Europe with less than 20 employees that have published at least 1 paper on explainable AI in the last 3 years? | SELECT name FROM ai_companies WHERE employees < 20 AND (location = 'Latin America' OR location = 'Europe') AND id IN (SELECT company_id FROM explainable_papers WHERE year BETWEEN YEAR(CURRENT_DATE) - 3 AND YEAR(CURRENT_DATE)); | gretelai_synthetic_text_to_sql |
CREATE TABLE Movies (region VARCHAR(20), year INT, revenue DECIMAL(5,2)); INSERT INTO Movies (region, year, revenue) VALUES ('Australia', 2021, 500000.00), ('Australia', 2021, 750000.00), ('US', 2021, 800000.00); | What is the total revenue for movies in Australia in 2021? | SELECT SUM(revenue) FROM Movies WHERE region = 'Australia' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_app_novelty (id INT, app_name VARCHAR(50), country VARCHAR(50), novelty_score FLOAT); INSERT INTO ai_app_novelty VALUES (1, 'InnovateArt', 'France', 0.94), (2, 'CreativeCodeX', 'Brazil', 0.87), (3, 'ArtGenius', 'Spain', 0.91); | What is the maximum creative AI application novelty score in Europe and South America? | SELECT MAX(novelty_score) FROM ai_app_novelty WHERE country IN ('France', 'Brazil', 'Spain'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (id INT, name VARCHAR(50), city VARCHAR(50), age INT, gender VARCHAR(10), sport VARCHAR(50)); INSERT INTO fans (id, name, city, age, gender, sport) VALUES (1, 'Alice', 'Sydney', 25, 'Male', 'Rugby'); INSERT INTO fans (id, name, city, age, gender, sport) VALUES (2, 'Bob', 'Tokyo', 30, 'Male', 'Baseball... | What is the average age of male fans from Sydney? | SELECT AVG(age) FROM fans WHERE city = 'Sydney' AND gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai (id INT, tool VARCHAR(20), application VARCHAR(50), country VARCHAR(20)); INSERT INTO creative_ai (id, tool, application, country) VALUES (1, 'GAN', 'Art Generation', 'Canada'), (2, 'DALL-E', 'Text-to-Image', 'USA'), (3, 'Diffusion Models', 'Image Generation', 'China'); | Update the 'creative_ai' table, changing 'tool' to 'DreamBooth' for records where 'id' is 3 | UPDATE creative_ai SET tool = 'DreamBooth' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, name VARCHAR(50), state VARCHAR(25), health_equity_metric_score INT); INSERT INTO community_health_workers (worker_id, name, state, health_equity_metric_score) VALUES (1, 'Alex Johnson', 'Florida', 95); INSERT INTO community_health_workers (worker_id, name, state, h... | What is the maximum health equity metric score for community health workers in Florida? | SELECT MAX(health_equity_metric_score) FROM community_health_workers WHERE state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE store (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), sustainable BOOLEAN); CREATE TABLE sales (id INT PRIMARY KEY, store_id INT, product_id INT, quantity INT, date DATE); CREATE TABLE product (id INT PRIMARY KEY, name VARCHAR(100), manufacturer_id INT, price DECIMAL(5,2), sustainable BOOLEAN... | What is the total quantity of sustainable and non-sustainable products sold for each store, and filters the results to only show stores with more than 400 units sold for either category? | SELECT store.name as store_name, SUM(sales.quantity) as total_sold FROM sales INNER JOIN store ON sales.store_id = store.id INNER JOIN product ON sales.product_id = product.id GROUP BY store.name HAVING total_sold > 400; | gretelai_synthetic_text_to_sql |
CREATE TABLE package_weights (package_id INT, warehouse_id VARCHAR(5), weight DECIMAL(5,2)); INSERT INTO package_weights (package_id, warehouse_id, weight) VALUES (1, 'LA', 3.0), (2, 'LA', 2.5), (3, 'NY', 2.0), (4, 'CH', 1.5), (5, 'MI', 4.0), (6, 'MI', 3.5), (7, 'AT', 5.0); | What is the maximum package weight for each warehouse? | SELECT warehouse_id, MAX(weight) FROM package_weights GROUP BY warehouse_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE MonitoringStations (StationID INT, StationName VARCHAR(50), pH DECIMAL(3,2)); INSERT INTO MonitoringStations VALUES (1, 'Station A', 7.8), (2, 'Station B', 7.5), (3, 'Station C', 8.0); | What is the minimum pH value recorded in each monitoring station? | SELECT StationName, MIN(pH) FROM MonitoringStations GROUP BY StationName; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_lifelong_learning_scores (student_id INT, country TEXT, lifelong_learning_score INT); INSERT INTO student_lifelong_learning_scores (student_id, country, lifelong_learning_score) VALUES (1, 'USA', 80), (2, 'Canada', 85), (3, 'Mexico', 90), (4, 'Brazil', 75), (5, 'Argentina', 95); | What is the average lifelong learning score of students in each country? | SELECT country, AVG(lifelong_learning_score) as avg_score FROM student_lifelong_learning_scores GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, title VARCHAR(50), event_type VARCHAR(50), tickets_sold INT); INSERT INTO events (id, title, event_type, tickets_sold) VALUES (1, 'Classical Music Concert', 'concert', 1200); INSERT INTO events (id, title, event_type, tickets_sold) VALUES (2, 'Modern Art Exhibition', 'exhibition', 1500); IN... | What is the total number of tickets sold for each event type (concert, exhibition, workshop) across all cultural centers? | SELECT event_type, SUM(tickets_sold) FROM events GROUP BY event_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, age INT, gender VARCHAR(10)); CREATE TABLE workouts (workout_id INT, member_id INT, date DATE); INSERT INTO members VALUES (1,25,'Female'),(2,35,'Male'),(3,28,'Female'),(4,45,'Female'); INSERT INTO workouts VALUES (1,1,'2022-01-01'),(2,1,'2022-01-02'),(3,2,'2022-01-03'),(4,3,'2022-0... | What is the earliest date a female member started a workout? | SELECT MIN(date) FROM workouts JOIN members ON workouts.member_id = members.member_id WHERE members.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10,2), donation_date DATE); | What is the total donation amount for each month in 'donations' table? | SELECT EXTRACT(MONTH FROM donation_date) as month, SUM(amount) as total_donations FROM donations GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE sea_level_data (id INTEGER, location TEXT, value FLOAT, date DATE); | Find the average sea level rise in the 'Arctic' over the past 10 years. | SELECT AVG(value) FROM sea_level_data WHERE location = 'Arctic' AND date >= DATEADD(year, -10, CURRENT_DATE); | 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.