instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Which water conservation initiatives in Egypt had savings greater than 70% of the cost? | CREATE TABLE water_conservation_egypt(id INT,location VARCHAR(50),initiative VARCHAR(50),cost FLOAT,savings FLOAT); INSERT INTO water_conservation_egypt(id,location,initiative,cost,savings) VALUES (1,'Cairo','Drip Irrigation',1800,1560); | SELECT location, initiative, savings FROM water_conservation_egypt WHERE savings > (cost * 0.7); |
Which regions have the highest teacher professional development budgets? | CREATE TABLE regions (id INT,region VARCHAR(50),budget INT); INSERT INTO regions (id,region,budget) VALUES (1,'North',50000),(2,'South',60000),(3,'East',70000),(4,'West',40000); CREATE TABLE pd_budgets (id INT,region_id INT,amount INT); INSERT INTO pd_budgets (id,region_id,amount) VALUES (1,1,40000),(2,2,50000),(3,3,60... | SELECT r.region, SUM(pd_budgets.amount) as total_budget FROM regions r JOIN pd_budgets ON r.id = pd_budgets.region_id GROUP BY r.region ORDER BY total_budget DESC; |
How many traffic accidents were there in each community policing sector last year? | CREATE TABLE sectors (sid INT,sector_name TEXT); CREATE TABLE accidents (aid INT,sector_id INT,accident_date TEXT); INSERT INTO sectors VALUES (1,'Sector A'); INSERT INTO sectors VALUES (2,'Sector B'); INSERT INTO accidents VALUES (1,1,'2021-12-15'); INSERT INTO accidents VALUES (2,1,'2022-02-10'); INSERT INTO accident... | SELECT s.sector_name, COUNT(a.aid) FROM accidents a JOIN sectors s ON a.sector_id = s.sid WHERE a.accident_date >= DATEADD(year, -1, GETDATE()) GROUP BY s.sector_name; |
What was the total revenue for the state of California in March 2022? | CREATE TABLE sales (id INT,state VARCHAR(50),month VARCHAR(50),revenue FLOAT); INSERT INTO sales (id,state,month,revenue) VALUES (1,'California','March',50000.0),(2,'California','March',60000.0),(3,'California','April',70000.0); | SELECT SUM(revenue) FROM sales WHERE state = 'California' AND month = 'March'; |
Minimum weight of stone artifacts in 'south_american_sites'? | CREATE TABLE south_american_sites (artifact_id INT,weight FLOAT,material VARCHAR(255)); | SELECT MIN(weight) FROM south_american_sites WHERE material = 'stone'; |
What is the distribution of article topics in 'The Washington Post'? | CREATE TABLE article_topics (id INT,newspaper VARCHAR(255),topic VARCHAR(255)); INSERT INTO article_topics (id,newspaper,topic) VALUES (1,'The Washington Post','Politics'); INSERT INTO article_topics (id,newspaper,topic) VALUES (2,'The Washington Post','Sports'); INSERT INTO article_topics (id,newspaper,topic) VALUES (... | SELECT topic, COUNT(*) as count FROM article_topics WHERE newspaper = 'The Washington Post' GROUP BY topic; |
What is the average word count of articles published in each month? | CREATE TABLE monthly_articles (id INT,author VARCHAR(255),publication_month DATE,word_count INT); INSERT INTO monthly_articles (id,author,publication_month,word_count) VALUES (1,'John Doe','2022-02-01',800),(2,'Jane Smith','2022-03-05',1200),(3,'John Doe','2022-02-15',1000); | SELECT publication_month, AVG(word_count) as avg_word_count FROM monthly_articles GROUP BY publication_month; |
Get the names of all countries that have conducted intelligence operations in the Asia-Pacific region. | CREATE TABLE countries (id INT,name VARCHAR(255),region VARCHAR(255));CREATE TABLE operations (id INT,name VARCHAR(255),country_id INT,region VARCHAR(255));INSERT INTO countries (id,name,region) VALUES (1,'USA','North America'),(2,'China','Asia-Pacific'),(3,'Canada','North America');INSERT INTO operations (id,name,coun... | SELECT c.name FROM countries c INNER JOIN operations o ON c.id = o.country_id WHERE o.region = 'Asia-Pacific'; |
What is the total sales volume for the 'Summer_2022' collection? | CREATE TABLE sales_volume (collection VARCHAR(20),units_sold INT); INSERT INTO sales_volume (collection,units_sold) VALUES ('Summer_2022',1200),('Summer_2022',1500),('Summer_2022',1300); | SELECT SUM(units_sold) FROM sales_volume WHERE collection = 'Summer_2022'; |
What is the total number of episodes and average runtime for TV shows in the reality genre? | CREATE TABLE tv_shows_data (id INT,title VARCHAR(255),genre VARCHAR(255),episodes INT,runtime INT); INSERT INTO tv_shows_data (id,title,genre,episodes,runtime) VALUES (1,'Show1','Reality',15,30),(2,'Show2','Reality',20,45),(3,'Show3','Documentary',10,60),(4,'Show4','Reality',12,60),(5,'Show5','Drama',20,60); | SELECT genre, AVG(runtime) AS avg_runtime, SUM(episodes) AS total_episodes FROM tv_shows_data WHERE genre = 'Reality' GROUP BY genre; |
Which artist has the most songs in the Music_Streaming table? | CREATE TABLE Music_Streaming (song_id INT,artist VARCHAR(50),genre VARCHAR(50)); INSERT INTO Music_Streaming (song_id,artist,genre) VALUES (1,'Taylor Swift','Pop'),(2,'The Rolling Stones','Rock'),(3,'Miles Davis','Jazz'),(4,'Taylor Swift','Pop'),(5,'Jay Z','Hip Hop'); | SELECT artist, COUNT(*) as num_songs FROM Music_Streaming GROUP BY artist ORDER BY num_songs DESC LIMIT 1; |
What is the monthly data usage for the top 10 subscribers in the 'east' region, ordered by usage in descending order? | CREATE TABLE subscribers (subscriber_id INT,data_usage FLOAT,region VARCHAR(10)); INSERT INTO subscribers (subscriber_id,data_usage,region) VALUES (1,20,'east'),(2,30,'east'),(3,15,'east'); | SELECT subscriber_id, data_usage FROM (SELECT subscriber_id, data_usage, ROW_NUMBER() OVER (PARTITION BY region ORDER BY data_usage DESC) as rn FROM subscribers WHERE region = 'east') subquery WHERE rn <= 10 ORDER BY data_usage DESC; |
What is the total volume of plastic waste in the Indian and Arctic Oceans? | CREATE TABLE plastic_pollution(ocean VARCHAR(255),volume FLOAT);INSERT INTO plastic_pollution(ocean,volume) VALUES ('Indian Ocean',9000000),('Arctic Ocean',50000); | SELECT SUM(volume) FROM plastic_pollution WHERE ocean IN ('Indian Ocean', 'Arctic Ocean'); |
What is the ratio of citizens satisfied with police services to those dissatisfied in 2022? | CREATE TABLE PoliceSatisfaction (Year INT,Satisfied INT,Dissatisfied INT); INSERT INTO PoliceSatisfaction (Year,Satisfied,Dissatisfied) VALUES (2022,60,10); | SELECT Satisfied/(Satisfied + Dissatisfied) AS Ratio FROM PoliceSatisfaction WHERE Year = 2022; |
What is the total number of hours spent on lifelong learning courses in the past month, grouped by teachers who have completed at least 20 hours? | CREATE TABLE lifelong_learning_courses (course_id INT,teacher_id INT,hours INT,completion_date DATE); INSERT INTO lifelong_learning_courses (course_id,teacher_id,hours,completion_date) VALUES (1,1,5,'2022-01-01'),(2,2,22,'2022-02-10'),(3,3,8,'2022-03-05'); | SELECT teacher_id, SUM(hours) as total_hours FROM lifelong_learning_courses WHERE completion_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY teacher_id HAVING SUM(hours) >= 20; |
What is the highest number of goals scored in a single game in Premier League history? | CREATE TABLE Premier_League_Matches (MatchID INT,HomeTeam VARCHAR(50),AwayTeam VARCHAR(50),HomeTeamScore INT,AwayTeamScore INT); INSERT INTO Premier_League_Matches (MatchID,HomeTeam,AwayTeam,HomeTeamScore,AwayTeamScore) VALUES (1,'Arsenal','Manchester United',7,3); | SELECT MAX(HomeTeamScore + AwayTeamScore) FROM Premier_League_Matches; |
What is the total waste generation in the city of Toronto in 2021? | CREATE TABLE waste_generation(city VARCHAR(20),year INT,amount INT); INSERT INTO waste_generation VALUES('Toronto',2021,250000); | SELECT amount FROM waste_generation WHERE city = 'Toronto' AND year = 2021; |
What is the average age of athletes from Brazil in Athletics? | CREATE TABLE BrazilianAthletes (AthleteID INT,Name VARCHAR(50),Age INT,Sport VARCHAR(20),Country VARCHAR(50)); INSERT INTO BrazilianAthletes (AthleteID,Name,Age,Sport,Country) VALUES (1,'Ana Silva',27,'Athletics','Brazil'); INSERT INTO BrazilianAthletes (AthleteID,Name,Age,Sport,Country) VALUES (2,'Thiago Braz',30,'Ath... | SELECT AVG(Age) FROM BrazilianAthletes WHERE Sport = 'Athletics' AND Country = 'Brazil'; |
List all astronauts and their total flight hours, ordered by country. | CREATE TABLE astronauts (astronaut_name VARCHAR(50),country VARCHAR(50),flight_hours FLOAT); | SELECT country, astronaut_name, SUM(flight_hours) as total_flight_hours FROM astronauts GROUP BY country, astronaut_name ORDER BY country, total_flight_hours DESC; |
Update the marine_protected_areas table to reflect a new name for the Great Barrier Reef | CREATE TABLE marine_protected_areas (name TEXT,depth FLOAT); INSERT INTO marine_protected_areas (name,depth) VALUES ('Galapagos Islands',2000.0),('Great Barrier Reef',500.0); | UPDATE marine_protected_areas SET name = 'Great Coral Reef' WHERE name = 'Great Barrier Reef'; |
What is the total number of genetic research projects by technology type? | CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.research_projects (id INT,name VARCHAR(100),technology_type VARCHAR(50));INSERT INTO genetics.research_projects (id,name,technology_type) VALUES (1,'ProjectX','Genomic Sequencing'),(2,'ProjectY','CRISPR'),(3,'ProjectZ','Stem Cell Research'); | SELECT technology_type, COUNT(*) as total_projects FROM genetics.research_projects GROUP BY technology_type; |
Update the patient records to mark if they are from a rural or urban area based on the zip code provided in the zipcodes table. | CREATE TABLE patients (patient_id INT,patient_name VARCHAR(255),zip_code INT); CREATE TABLE zipcodes (zip_code INT,area_type VARCHAR(255)); INSERT INTO zipcodes (zip_code,area_type) VALUES (12345,'rural'),(67890,'urban'),(54321,'rural'),(98765,'urban'); | UPDATE patients p SET rural_urban = (CASE WHEN z.area_type = 'rural' THEN 'rural' ELSE 'urban' END) FROM zipcodes z WHERE p.zip_code = z.zip_code; |
Find the carbon offset projects in the 'carbon_offset_projects' table that have a completion date on or after January 1, 2020, and display the project_name and completion_date. | CREATE TABLE carbon_offset_projects (id INT,project_name VARCHAR(255),completion_date DATE); INSERT INTO carbon_offset_projects (id,project_name,completion_date) VALUES (1,'ForestRestoration1','2020-05-01'),(2,'SoilCarbonSequestration2','2019-12-31'),(3,'BlueCarbon3','2021-03-15'); | SELECT project_name, completion_date FROM carbon_offset_projects WHERE completion_date >= '2020-01-01'; |
What is the highest score in each sport in the last 3 months? | CREATE TABLE scores (sport VARCHAR(50),date DATE,score INT); INSERT INTO scores (sport,date,score) VALUES ('Swimming','2022-01-01',500),('Swimming','2022-02-01',600),('Athletics','2022-01-01',2000),('Athletics','2022-02-01',2200); | SELECT sport, MAX(score) AS highest_score FROM scores WHERE date >= DATEADD(month, -3, GETDATE()) GROUP BY sport |
Which community centers were built in the last 5 years, and how many computers were installed in them? | CREATE TABLE community_centers (id INT,name VARCHAR(255),build_date DATE,num_computers INT); INSERT INTO community_centers (id,name,build_date,num_computers) VALUES (1,'CC1','2020-01-01',50),(2,'CC2','2019-07-15',60),(3,'CC3','2017-03-04',40); | SELECT name, num_computers FROM community_centers WHERE build_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) |
What is the average price of eco-friendly accommodations in Australia? | CREATE TABLE accommodations (accommodation_id INT,name TEXT,country TEXT,is_eco_friendly BOOLEAN,price DECIMAL); INSERT INTO accommodations (accommodation_id,name,country,is_eco_friendly,price) VALUES (1,'Eco Lodge','Australia',TRUE,150.00),(2,'Budget Hotel','Australia',FALSE,80.00); | SELECT AVG(price) FROM accommodations WHERE is_eco_friendly = TRUE AND country = 'Australia'; |
How many teachers have participated in professional development courses in 'technology integration'? | CREATE TABLE teacher_pd (teacher_id INT,course VARCHAR(20),hours INT); INSERT INTO teacher_pd (teacher_id,course,hours) VALUES (1,'technology integration',12),(2,'classroom_management',10),(3,'technology integration',15); | SELECT COUNT(*) FROM teacher_pd WHERE course = 'technology integration'; |
How many graduate students are there in each department? | CREATE TABLE students (id INT,department VARCHAR(255)); INSERT INTO students (id,department) VALUES (1,'Computer Science'),(2,'Physics'),(3,'Computer Science'),(4,'Mathematics'),(5,'Physics'); | SELECT department, COUNT(*) FROM students GROUP BY department; |
What is the total area of all community gardens in New York City? | CREATE TABLE community_gardens (garden_id INT,name TEXT,location TEXT,area REAL,city TEXT,state TEXT,zip_code TEXT); INSERT INTO community_gardens (garden_id,name,location,area,city,state,zip_code) VALUES (1,'Green Oasis','123 Main St',0.25,'New York','NY','10001'); | SELECT SUM(area) FROM community_gardens WHERE city = 'New York' AND state = 'NY'; |
List all suppliers with organic certification | CREATE TABLE suppliers (supplier_id INT,name VARCHAR(50),certified_organic BOOLEAN); INSERT INTO suppliers (supplier_id,name,certified_organic) VALUES (1,'Green Earth Farms',true),(2,'Sunny Harvest',false),(3,'Organic Roots',true); | SELECT * FROM suppliers WHERE certified_organic = true; |
Delete all records from the 'incidents' table where the incident type is 'poaching' | CREATE TABLE incidents (id INT,animal_id INT,incident_type VARCHAR(20),timestamp TIMESTAMP); | DELETE FROM incidents WHERE incident_type = 'poaching'; |
Which countries have more than 5 cultural heritage sites with virtual tours? | CREATE TABLE CulturalHeritageSites (site_id INT,site_name TEXT,country TEXT,has_virtual_tour BOOLEAN); INSERT INTO CulturalHeritageSites (site_id,site_name,country,has_virtual_tour) VALUES (1,'Site A','Germany',TRUE),(2,'Site B','Italy',FALSE),(3,'Site C','Greece',TRUE),(4,'Site D','Greece',TRUE),(5,'Site E','Greece',T... | SELECT country, COUNT(*) FROM CulturalHeritageSites WHERE has_virtual_tour = TRUE GROUP BY country HAVING COUNT(*) > 5; |
Update the "country" column to "United States" for records in the "warehouses" table where the "city" column is "New York" | CREATE TABLE warehouses (id INT PRIMARY KEY,name VARCHAR(50),city VARCHAR(50),country VARCHAR(50)); | UPDATE warehouses SET country = 'United States' WHERE city = 'New York'; |
What is the total number of properties with green building certifications in each borough? | CREATE TABLE Boroughs (BoroughID INT,BoroughName VARCHAR(255)); CREATE TABLE Properties (PropertyID INT,BoroughID INT,GreenBuildingCertification VARCHAR(50)); | SELECT B.BoroughName, COUNT(P.PropertyID) as TotalCertifiedProperties FROM Boroughs B JOIN Properties P ON B.BoroughID = P.BoroughID WHERE P.GreenBuildingCertification IS NOT NULL GROUP BY B.BoroughName; |
What is the total weight of packages shipped to India from any Asian country in the last month? | CREATE TABLE package_origins (id INT,package_weight FLOAT,origin_country VARCHAR(20),destination_country VARCHAR(20),shipped_date DATE); INSERT INTO package_origins (id,package_weight,origin_country,destination_country,shipped_date) VALUES (1,1.8,'Japan','India','2022-01-10'); | SELECT SUM(package_weight) FROM package_origins WHERE origin_country LIKE 'Asia%' AND destination_country = 'India' AND shipped_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); |
What is the total number of emergency calls in the city of Chicago for each month of the year 2021? | CREATE TABLE emergency_calls (id INT,city VARCHAR(20),call_date DATE); INSERT INTO emergency_calls (id,city,call_date) VALUES (1,'Chicago','2021-01-01'),(2,'Chicago','2021-02-01'),(3,'Chicago','2021-03-01'); | SELECT EXTRACT(MONTH FROM call_date) as month, COUNT(*) FROM emergency_calls WHERE city = 'Chicago' AND call_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY month; |
List all mobile subscribers in the Americas who have exceeded their data usage limit in the last month. | CREATE TABLE mobile_subscribers (id INT,region VARCHAR(20),data_usage INT,usage_date DATE); CREATE TABLE data_limits (id INT,subscriber_id INT,limit INT); | SELECT m.id, m.region, m.data_usage, m.usage_date FROM mobile_subscribers m INNER JOIN data_limits d ON m.id = d.subscriber_id WHERE m.region = 'Americas' AND m.usage_date > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND m.data_usage > d.limit; |
Which volunteers contributed more than 20 hours in a single month? | CREATE TABLE Volunteers (VolunteerID int,VolunteerName varchar(255),TotalHours int); INSERT INTO Volunteers VALUES (1,'John Doe',15),(2,'Jane Smith',22),(3,'Alice Johnson',30),(4,'Bob Brown',18); | SELECT VolunteerName FROM (SELECT VolunteerName, ROW_NUMBER() OVER (ORDER BY TotalHours DESC) as Rank FROM Volunteers) as VolunteerRanks WHERE Rank <= 3; |
What is the total area of sustainable aquaculture farms in Oceania? | CREATE TABLE AquacultureFarms (region VARCHAR(50),area_size INT,is_sustainable BOOLEAN); INSERT INTO AquacultureFarms (region,area_size,is_sustainable) VALUES ('Oceania',90000,true),('Oceania',80000,false),('Asia',120000,true),('Asia',100000,false),('Europe',130000,true); | SELECT SUM(area_size) as total_area FROM AquacultureFarms WHERE region = 'Oceania' AND is_sustainable = true; |
What is the total value of military equipment sold to African countries by Raytheon in 2021? | CREATE TABLE MilitaryEquipmentSales (seller VARCHAR(255),buyer VARCHAR(255),equipment VARCHAR(255),sale_value FLOAT,sale_date DATE); INSERT INTO MilitaryEquipmentSales (seller,buyer,equipment,sale_value,sale_date) VALUES ('Raytheon','Egypt','Patriot Missile System',100000000,'2021-02-14'); | SELECT SUM(sale_value) FROM MilitaryEquipmentSales WHERE seller = 'Raytheon' AND buyer LIKE 'Africa%' AND sale_date BETWEEN '2021-01-01' AND '2021-12-31'; |
How many employees have been trained in circular economy principles in the last 6 months? | CREATE TABLE employee_training (employee_id INT,training_date DATE,topic VARCHAR(50)); | SELECT COUNT(*) FROM employee_training WHERE training_date >= (CURRENT_DATE - INTERVAL '6 months') AND topic = 'Circular Economy'; |
Identify the top 3 employers of veterans, by state, and the number of veterans they employ? | CREATE TABLE Employer (EID INT,Name VARCHAR(100),State VARCHAR(20)); CREATE TABLE VeteranEmployment (VEID INT,EmployerID INT,NumVeterans INT); INSERT INTO Employer (EID,Name,State) VALUES (1,'Lockheed Martin','Texas'),(2,'Boeing','California'),(3,'Northrop Grumman','Virginia'); INSERT INTO VeteranEmployment (VEID,Emplo... | SELECT e.State, e.Name, SUM(ve.NumVeterans) as NumVeterans FROM Employer e JOIN VeteranEmployment ve ON e.EID = ve.EmployerID GROUP BY e.State, e.Name ORDER BY NumVeterans DESC LIMIT 3; |
What is the total number of customer complaints related to billing in Canada? | CREATE TABLE customer_complaints (complaint_id INT,complaint_type VARCHAR(20),country VARCHAR(20)); INSERT INTO customer_complaints (complaint_id,complaint_type,country) VALUES (1,'network coverage','USA'),(2,'billing','Canada'),(3,'network coverage','USA'),(4,'billing','Canada'),(5,'billing','Mexico'); | SELECT COUNT(*) FROM customer_complaints WHERE complaint_type = 'billing' AND country = 'Canada'; |
What are the unique sources used in articles on 'corruption' or 'government' in 'investigative_reports'? | CREATE TABLE investigative_reports (title VARCHAR(255),source VARCHAR(255),topic VARCHAR(255)); | SELECT DISTINCT source FROM investigative_reports WHERE topic IN ('corruption', 'government') ORDER BY source; |
What is the minimum salary of workers in the 'Testing' department for each factory? | CREATE TABLE factories (factory_id INT,department VARCHAR(255)); INSERT INTO factories VALUES (1,'Assembly'),(1,'Quality Control'),(2,'Design'),(2,'Testing'); CREATE TABLE workers (worker_id INT,factory_id INT,department VARCHAR(255),role VARCHAR(255),salary INT); INSERT INTO workers VALUES (1,1,'Assembly','Engineer',5... | SELECT f.factory_id, MIN(w.salary) as min_salary FROM factories f JOIN workers w ON f.factory_id = w.factory_id WHERE f.department = 'Testing' GROUP BY f.factory_id; |
Delete all charging stations for electric bikes in Toronto. | CREATE TABLE charging_stations (station_id INT,type VARCHAR(20),city VARCHAR(20)); INSERT INTO charging_stations (station_id,type,city) VALUES (1,'Car','Toronto'),(2,'Bike','Toronto'),(3,'Bike','Toronto'); | DELETE FROM charging_stations WHERE city = 'Toronto' AND type = 'Bike'; |
List all military equipment maintenance records for the 'F-35' aircraft in 2021. | CREATE TABLE EquipmentMaintenance (equipment VARCHAR(255),year INT,maintenance_type VARCHAR(255),duration FLOAT); INSERT INTO EquipmentMaintenance (equipment,year,maintenance_type,duration) VALUES ('F-35',2021,'Inspection',2),('F-35',2021,'Repair',5); | SELECT * FROM EquipmentMaintenance WHERE equipment = 'F-35' AND year = 2021; |
What is the total area of all wildlife habitats in hectares, grouped by region? | CREATE TABLE wildlife_habitat (id INT,region VARCHAR(255),habitat_type VARCHAR(255),area FLOAT); INSERT INTO wildlife_habitat (id,region,habitat_type,area) VALUES (1,'North America','Forest',150000.0),(2,'North America','Wetlands',120000.0),(3,'South America','Forest',200000.0),(4,'South America','Grasslands',180000.0)... | SELECT region, SUM(area) FROM wildlife_habitat WHERE habitat_type = 'Forest' OR habitat_type = 'Wetlands' GROUP BY region; |
What is the revenue generated by online travel agencies in Africa? | CREATE TABLE online_travel_agencies (ota_id INT,ota_name TEXT,country TEXT,revenue FLOAT); INSERT INTO online_travel_agencies (ota_id,ota_name,country,revenue) VALUES (1,'OTA A','South Africa',500000),(2,'OTA B','Egypt',600000),(3,'OTA C','Nigeria',700000),(4,'OTA D','Morocco',800000); | SELECT country, SUM(revenue) as total_revenue FROM online_travel_agencies WHERE country IN ('South Africa', 'Egypt', 'Nigeria', 'Morocco') GROUP BY country; |
What is the total value of all grants awarded for pollution control initiatives in the 'Grants' schema? | CREATE SCHEMA Grants; CREATE TABLE PollutionGrants (grant_id INT,grant_amount DECIMAL(10,2),grant_type VARCHAR(255)); INSERT INTO PollutionGrants (grant_id,grant_amount,grant_type) VALUES (1,50000.00,'OceanMapping'),(2,75000.00,'MarineLifeResearch'),(3,30000.00,'PollutionControl'); | SELECT SUM(grant_amount) FROM Grants.PollutionGrants WHERE grant_type = 'PollutionControl'; |
Create a view for displaying healthcare facility inspection scores by quarter | CREATE TABLE inspection_results (id INT PRIMARY KEY,facility_id INT,inspection_date DATE,inspection_score INT); | CREATE VIEW quarterly_facility_inspection_scores AS SELECT facility_id, DATE_TRUNC('quarter', inspection_date) AS quarter, AVG(inspection_score) AS avg_inspection_score FROM inspection_results GROUP BY facility_id, quarter ORDER BY facility_id, quarter; |
What is the maximum medical risk score for each astronaut on the ISS? | CREATE TABLE Astronauts (id INT,name VARCHAR(100),medical_risk_score FLOAT); CREATE TABLE Missions (id INT,astronaut_id INT,name VARCHAR(100),mission_start_date DATE,mission_end_date DATE); INSERT INTO Astronauts VALUES (1,'Mark Watney',15); INSERT INTO Missions VALUES (1,1,'ISS','2022-01-01','2022-12-31'); | SELECT Astronauts.name, MAX(Astronauts.medical_risk_score) FROM Astronauts INNER JOIN Missions ON Astronauts.id = Missions.astronaut_id WHERE Missions.name = 'ISS' GROUP BY Astronauts.name; |
Delete all military equipment sales records to India in 2022. | CREATE TABLE MilitaryEquipmentSales (id INT PRIMARY KEY,sale_year INT,equipment_type VARCHAR(50),country VARCHAR(50),sale_value FLOAT); INSERT INTO MilitaryEquipmentSales (id,sale_year,equipment_type,country,sale_value) VALUES (1,2020,'Aircraft','United States',12000000),(2,2021,'Vehicles','United States',8000000),(3,2... | DELETE FROM MilitaryEquipmentSales WHERE sale_year = 2022 AND country = 'India'; |
What is the total labor cost for each supplier? | CREATE TABLE suppliers (id INT,name VARCHAR(255),labor_cost DECIMAL(10,2)); INSERT INTO suppliers (id,name,labor_cost) VALUES (1,'SupplierA',5000.00),(2,'SupplierB',7000.00),(3,'SupplierC',3000.00); | SELECT name, SUM(labor_cost) AS total_labor_cost FROM suppliers GROUP BY name; |
Calculate the overall average salary for all manufacturing jobs, and list the corresponding job title and country. | CREATE TABLE global_jobs (id INT,country VARCHAR(50),job VARCHAR(50),salary DECIMAL(10,2)); INSERT INTO global_jobs (id,country,job,salary) VALUES (1,'USA','Engineer',80000.00),(2,'China','Assembler',15000.00),(3,'Germany','Engineer',70000.00),(4,'India','Assembler',12000.00),(5,'Japan','Engineer',90000.00); | SELECT job, country, salary FROM global_jobs; SELECT country, job, AVG(salary) as avg_salary FROM global_jobs GROUP BY country, job; |
What is the total volume of timber harvested in each country in Europe? | CREATE TABLE Countries (id INT,name VARCHAR(255),continent VARCHAR(255)); INSERT INTO Countries (id,name,continent) VALUES (1,'France','Europe'),(2,'China','Asia'),(3,'Mexico','America'),(4,'Germany','Europe'),(5,'Brazil','America'); CREATE TABLE CountryHarvest (country_id INT,volume INT); INSERT INTO CountryHarvest (c... | SELECT Ch.country_id, SUM(Ch.volume) as total_volume FROM CountryHarvest Ch INNER JOIN Countries Cn ON Ch.country_id = Cn.id WHERE Cn.continent = 'Europe' GROUP BY Ch.country_id; |
What is the average donation amount by continent, for donations greater than $1000? | CREATE TABLE Donations (id INT,donor_name VARCHAR(100),donation_amount DECIMAL(10,2),donation_date DATE,event_id INT,continent VARCHAR(50)); | SELECT continent, AVG(donation_amount) as avg_donation FROM Donations WHERE donation_amount > 1000 GROUP BY continent; |
Delete all records related to transportation services in the year 2019, for the state of New York. | CREATE SCHEMA gov_data;CREATE TABLE services (year INT,service TEXT,state TEXT);INSERT INTO services (year,service,state) VALUES (2019,'Transportation','New York'); INSERT INTO services (year,service,state) VALUES (2018,'Transportation','New York'); | DELETE FROM services WHERE year = 2019 AND service = 'Transportation' AND state = 'New York'; |
Update the conservation_efforts table to reflect a failed conservation project for species with id 2, 5, and 8 | CREATE TABLE conservation_efforts (id INT,species_id INT,project_status VARCHAR(20)); | UPDATE conservation_efforts SET project_status = 'failed' WHERE species_id IN (2, 5, 8); |
List all the paintings and their curators. | CREATE TABLE Artworks (ArtworkID INT,Name VARCHAR(100),Type VARCHAR(50),ArtistID INT); INSERT INTO Artworks (ArtworkID,Name,Type,ArtistID) VALUES (1,'The Starry Night','Painting',1),(2,'The Persistence of Memory','Painting',2),(3,'David','Sculpture',1),(4,'Guernica','Painting',2); CREATE TABLE Curations (CuratorID INT,... | SELECT A.Name, C.Curator FROM Artworks A JOIN Curations C ON A.ArtworkID = C.ArtworkID WHERE A.Type = 'Painting'; |
Get the count of artworks by 'Vincent van Gogh' in the 'Post-Impressionism' period. | CREATE TABLE Artworks (id INT,artist_name VARCHAR(100),period VARCHAR(50),artwork_name VARCHAR(100)); INSERT INTO Artworks (id,artist_name,period,artwork_name) VALUES (1,'Vincent van Gogh','Post-Impressionism','Starry Night'); INSERT INTO Artworks (id,artist_name,period,artwork_name) VALUES (2,'Vincent van Gogh','Post-... | SELECT COUNT(*) as artwork_count FROM Artworks WHERE artist_name = 'Vincent van Gogh' AND period = 'Post-Impressionism'; |
What is the maximum daily production of Praseodymium in 2018 from the Daily_Production_2 table? | CREATE TABLE Daily_Production_2 (date DATE,praseodymium_production FLOAT); | SELECT MAX(praseodymium_production) FROM Daily_Production_2 WHERE EXTRACT(YEAR FROM date) = 2018; |
Add a new energy storage capacity record for New York in 2024 | CREATE TABLE energy_storage (id INT,region VARCHAR(50),year INT,capacity FLOAT); | INSERT INTO energy_storage (id, region, year, capacity) VALUES (1, 'New York', 2024, 8000); |
What is the bioprocess engineering information for process 'BPE001'? | CREATE TABLE bioprocess_engineering (id INT,process_id TEXT,equipment TEXT,parameters TEXT); | SELECT equipment, parameters FROM bioprocess_engineering WHERE process_id = 'BPE001'; |
Which products were sold in a specific region? | CREATE TABLE sales_data (sale_id INT,product VARCHAR(255),region VARCHAR(255),sales FLOAT); INSERT INTO sales_data (sale_id,product,region,sales) VALUES (1,'ProductA','North',4000),(2,'ProductB','South',5000),(3,'ProductC','East',6000),(4,'ProductD','West',7000); | SELECT product FROM sales_data WHERE region = 'North'; |
Which non-profit organizations have no record of donations in the past year? | CREATE TABLE non_profit (id INT,name TEXT); INSERT INTO non_profit (id,name) VALUES (1,'Habitat for Humanity'),(2,'American Red Cross'),(3,'Doctors Without Borders'); CREATE TABLE donations (non_profit_id INT,donation_date DATE); INSERT INTO donations (non_profit_id,donation_date) VALUES (1,'2021-05-12'),(2,'2022-03-15... | SELECT n.name FROM non_profit n LEFT JOIN donations d ON n.id = d.non_profit_id WHERE d.donation_date IS NULL OR d.donation_date < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); |
Show the total number of followers for influencers who posted about sustainable fashion in the past month, sorted in descending order. | CREATE TABLE influencers (id INT,name VARCHAR(50),followers INT,topic VARCHAR(50)); CREATE TABLE posts (id INT,influencer_id INT,content TEXT,timestamp DATETIME); | SELECT influencers.name, influencers.followers FROM influencers JOIN posts ON influencers.id = posts.influencer_id WHERE posts.content LIKE '%sustainable fashion%' AND posts.timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW() GROUP BY influencers.id ORDER BY influencers.followers DESC; |
What is the number of drought impact assessments in the Drought_Impact table for the region 'Southwest'? | CREATE TABLE Drought_Impact (id INT,region VARCHAR(20),assessment_count INT); INSERT INTO Drought_Impact (id,region,assessment_count) VALUES (1,'Northeast',2),(2,'Southeast',3),(3,'Midwest',4),(4,'Southwest',5),(5,'West',6); | SELECT assessment_count FROM Drought_Impact WHERE region = 'Southwest'; |
Identify AI algorithms with the lowest fairness scores in Asia. | CREATE TABLE ai_algorithms (algorithm_name TEXT,region TEXT,fairness_score FLOAT); INSERT INTO ai_algorithms (algorithm_name,region,fairness_score) VALUES ('Alg1','Asia',0.6),('Alg2','Asia',0.7),('Alg3','Europe',0.85); | SELECT algorithm_name, fairness_score FROM ai_algorithms WHERE region = 'Asia' ORDER BY fairness_score LIMIT 1; |
What is the total weight of seafood products certified as sustainable in Europe? | CREATE TABLE SeafoodProducts (product_id INT,product_name VARCHAR(255),origin VARCHAR(255),is_sustainable BOOLEAN,weight INT); INSERT INTO SeafoodProducts (product_id,product_name,origin,is_sustainable,weight) VALUES (1,'Salmon Fillet','Europe',true,800),(2,'Tuna Steak','South America',false,600),(3,'Shrimp','Asia',fal... | SELECT SUM(weight) FROM SeafoodProducts WHERE origin = 'Europe' AND is_sustainable = true; |
Identify the daily trend of user posts about 'veganism' in the past month, and the average number of likes for those posts. | CREATE TABLE users (user_id INT,username VARCHAR(255),post_date DATE); CREATE TABLE posts (post_id INT,user_id INT,content VARCHAR(255),likes INT,post_date DATE); | SELECT DATE(p.post_date) as post_day, COUNT(p.post_id) as daily_posts, AVG(p.likes) as avg_likes FROM posts p INNER JOIN users u ON p.user_id = u.user_id WHERE p.content LIKE '%veganism%' AND p.post_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH) GROUP BY post_day ORDER BY post_day; |
What is the average ticket price for traditional music events in India? | CREATE TABLE music_events (id INT,location VARCHAR(50),genre VARCHAR(50),price DECIMAL(5,2)); INSERT INTO music_events (id,location,genre,price) VALUES (1,'India','Traditional Music',30.00),(2,'Brazil','Pop Music',50.00),(3,'South Africa','Jazz',40.00); | SELECT AVG(price) FROM music_events WHERE location = 'India' AND genre = 'Traditional Music'; |
What is the maximum range of electric vehicles with a battery capacity over 100 kWh in the 'EVSpecs' database? | CREATE TABLE EVSpecs (Id INT,Make VARCHAR(50),Model VARCHAR(50),BatteryCapacity FLOAT,Range FLOAT); | SELECT MAX(Range) FROM EVSpecs WHERE BatteryCapacity > 100; |
Show the AI safety incidents that occurred in the same region and on the same date, partitioned by incident type. | CREATE TABLE SafetyIncidents (incident_id INT,incident_date DATE,region VARCHAR(255),incident_type VARCHAR(255)); INSERT INTO SafetyIncidents (incident_id,incident_date,region,incident_type) VALUES (1,'2022-01-01','US','Algorithm Malfunction'),(2,'2022-01-10','Canada','Data Breach'),(3,'2022-01-15','US','System Failure... | SELECT incident_type, incident_date, region, COUNT(*) as num_incidents FROM SafetyIncidents GROUP BY incident_type, incident_date, region HAVING num_incidents > 1 ORDER BY incident_type, incident_date, region; |
Which strain was the most popular in the state of Michigan in the year 2020? | CREATE TABLE sales (id INT,strain VARCHAR(50),state VARCHAR(50),year INT,quantity INT); INSERT INTO sales (id,strain,state,year,quantity) VALUES (1,'Green Crack','Michigan',2020,15000); | SELECT strain, SUM(quantity) FROM sales WHERE state = 'Michigan' AND year = 2020 GROUP BY strain ORDER BY SUM(quantity) DESC LIMIT 1; |
List all residential broadband customers in New York who have a monthly data usage over 60 GB. | CREATE TABLE residential_customers (customer_id INT,state VARCHAR(255),monthly_data_usage DECIMAL(5,2)); INSERT INTO residential_customers (customer_id,state,monthly_data_usage) VALUES (1,'New York',65.5),(2,'New York',45.3),(3,'New York',70.8); | SELECT customer_id FROM residential_customers WHERE state = 'New York' AND monthly_data_usage > 60; |
Add a new record to the 'Arctic_Flora' table for a rare Arctic poppy species found in Canada. | CREATE TABLE Arctic_Flora (id INT,species VARCHAR(30),country VARCHAR(20)); | INSERT INTO Arctic_Flora (id, species, country) VALUES (1, 'Arctic Poppy', 'Canada'); |
Analyze production figures and infrastructure spend in the North Sea | CREATE TABLE if not exists fact_production (production_id INT PRIMARY KEY,well_id INT,date DATE,oil_volume DECIMAL(10,2),gas_volume DECIMAL(10,2)); CREATE TABLE if not exists dim_well (well_id INT PRIMARY KEY,well_name VARCHAR(255),location VARCHAR(255),infrastructure_cost DECIMAL(10,2)); CREATE TABLE if not exists dim... | SELECT dim_well.location, SUM(fact_production.oil_volume) AS total_oil_volume, SUM(fact_production.gas_volume) AS total_gas_volume, AVG(dim_well.infrastructure_cost) AS avg_infrastructure_cost FROM fact_production INNER JOIN dim_well ON fact_production.well_id = dim_well.well_id INNER JOIN dim_date ON fact_production.d... |
What is the total retail sales for garments in the 'Sustainable_Materials' category? | CREATE TABLE Sales(id INT,category VARCHAR(20),retail_sales DECIMAL(5,2)); INSERT INTO Sales(id,category,retail_sales) VALUES (1,'Sustainable_Materials',50.00),(2,'Sustainable_Materials',30.00); | SELECT SUM(retail_sales) FROM Sales WHERE category = 'Sustainable_Materials'; |
How many patients with mental health disorders were seen by each community health worker? | CREATE TABLE patients (patient_id INT,worker_id INT,mental_health_disorder BOOLEAN); INSERT INTO patients (patient_id,worker_id,mental_health_disorder) VALUES (1,1,true),(2,1,true),(3,2,false),(4,2,true),(5,3,true); | SELECT worker_id, COUNT(*) as num_patients FROM patients WHERE mental_health_disorder = true GROUP BY worker_id; |
How many organizations received grants in Italy and Spain between 2017 and 2019? | CREATE TABLE Grants (GrantID INT,OrganizationID INT,Country TEXT,GrantYear INT); CREATE TABLE Organizations (OrganizationID INT,OrganizationName TEXT); INSERT INTO Grants (GrantID,OrganizationID,Country,GrantYear) VALUES (1,1,'Italy',2017),(2,2,'Spain',2018),(3,1,'Italy',2019); INSERT INTO Organizations (OrganizationID... | SELECT COUNT(DISTINCT o.OrganizationID) FROM Grants g JOIN Organizations o ON g.OrganizationID = o.OrganizationID WHERE g.Country IN ('Italy', 'Spain') AND g.GrantYear BETWEEN 2017 AND 2019; |
What is the minimum weight of all stone artifacts in the 'artifact_analysis' table? | CREATE TABLE artifact_analysis (id INT,artifact_name VARCHAR(50),material VARCHAR(50),weight INT); INSERT INTO artifact_analysis (id,artifact_name,material,weight) VALUES (1,'stone_tool','stone',10); | SELECT MIN(weight) FROM artifact_analysis WHERE material = 'stone'; |
What is the total quantity of items shipped to each country in Africa? | CREATE TABLE Warehouse (id INT,city VARCHAR(50),country VARCHAR(50)); INSERT INTO Warehouse (id,city,country) VALUES (1,'Johannesburg','South Africa'),(2,'Cairo','Egypt'),(3,'Nairobi','Kenya'),(4,'Accra','Ghana'); CREATE TABLE Shipment (id INT,quantity INT,warehouse_id INT,destination_country VARCHAR(50)); INSERT INTO ... | SELECT Shipment.destination_country, SUM(Shipment.quantity) FROM Shipment INNER JOIN Warehouse ON Shipment.warehouse_id = Warehouse.id GROUP BY Shipment.destination_country; |
List all carbon offset initiatives and their corresponding carbon offset amounts from the 'carbon_offset_initiatives' table. | CREATE TABLE carbon_offset_initiatives (initiative_name TEXT,carbon_offset_amount INTEGER); | SELECT initiative_name, carbon_offset_amount FROM carbon_offset_initiatives; |
List the names of all accessibility features in technologies developed by companies in the technology for social good domain. | CREATE TABLE company (company_id INT,company_name TEXT,domain TEXT); CREATE TABLE technology (tech_id INT,tech_name TEXT,company_id INT,accessibility_feature TEXT); INSERT INTO company (company_id,company_name,domain) VALUES (1,'Helping Hands Inc.','technology for social good'); INSERT INTO technology (tech_id,tech_nam... | SELECT company_name, accessibility_feature FROM company INNER JOIN technology ON company.company_id = technology.company_id WHERE domain = 'technology for social good'; |
What is the maximum funding received by startups founded by persons from Asia in the technology sector? | CREATE TABLE companies (id INT,name TEXT,industry TEXT,founder_region TEXT); INSERT INTO companies (id,name,industry,founder_region) VALUES (1,'TechAsia','Technology','Asia'); INSERT INTO companies (id,name,industry,founder_region) VALUES (2,'GreenTechMale','GreenTech','Europe'); CREATE TABLE funding (company_id INT,am... | SELECT MAX(funding.amount) FROM companies INNER JOIN funding ON companies.id = funding.company_id WHERE companies.founder_region = 'Asia' AND companies.industry = 'Technology'; |
Delete all crime records before 2010 | CREATE TABLE crimes (id INT PRIMARY KEY,incident_date DATE,location VARCHAR(50),crime_type VARCHAR(50),description TEXT,FOREIGN KEY (incident_date) REFERENCES dates(date)); | DELETE FROM crimes WHERE incident_date < '2010-01-01'; |
Count the number of community education programs by program type. | CREATE TABLE EducationPrograms (id INT,program_type VARCHAR(255),date DATE,animals_reached INT); INSERT INTO EducationPrograms (id,program_type,date,animals_reached) VALUES (1,'Workshop','2021-01-01',50),(2,'Webinar','2021-01-15',30),(3,'Field Trip','2021-02-01',75); | SELECT program_type, COUNT(*) FROM EducationPrograms WHERE animals_reached IS NOT NULL GROUP BY program_type; |
What are the details of all public parks in the city of Los Angeles, along with the number of trees in each park? | CREATE TABLE parks(id INT,name VARCHAR(100),location VARCHAR(100));CREATE TABLE trees(id INT,park_id INT,species VARCHAR(50)); | SELECT parks.name, parks.location, COUNT(trees.id) as tree_count FROM parks LEFT JOIN trees ON parks.id = trees.park_id WHERE parks.city = 'Los Angeles' GROUP BY parks.name, parks.location; |
How many countries have launched objects into space? | CREATE TABLE space_objects (object_name TEXT,launch_country TEXT); INSERT INTO space_objects (object_name,launch_country) VALUES ('Sputnik 1','USSR'),('Explorer 1','USA'); | SELECT launch_country, COUNT(DISTINCT launch_country) as country_count FROM space_objects GROUP BY launch_country HAVING COUNT(DISTINCT launch_country) > 1; |
How many renewable energy projects were completed per year in Canada? | CREATE TABLE renewable_energy_projects (id INT,project_name VARCHAR(100),completion_date DATE,country VARCHAR(50)); | SELECT YEAR(completion_date) AS project_year, COUNT(*) AS projects_per_year FROM renewable_energy_projects WHERE country = 'Canada' GROUP BY project_year ORDER BY project_year; |
What is the total number of visitors to digital exhibits in North America? | CREATE TABLE DigitalExhibits (ExhibitID INT,Title VARCHAR(50),Curator VARCHAR(50),City VARCHAR(50)); INSERT INTO DigitalExhibits (ExhibitID,Title,Curator,City) VALUES (1,'Digital Art Museum','Alice Johnson','New York'); INSERT INTO DigitalExhibits (ExhibitID,Title,Curator,City) VALUES (2,'Virtual Reality Experience','B... | SELECT SUM(Attendance.VisitorID) FROM Attendance INNER JOIN Visitors ON Attendance.VisitorID = Visitors.VisitorID INNER JOIN DigitalExhibits ON Attendance.ExhibitID = DigitalExhibits.ExhibitID WHERE Visitors.City = 'North America'; |
List unique investors who have invested in at least one startup founded by a person with a disability. | CREATE TABLE investors(id INT,name TEXT); CREATE TABLE startups(id INT,name TEXT,founder TEXT,disability BOOLEAN); CREATE TABLE investments(investor_id INT,startup_id INT); INSERT INTO investors(id,name) VALUES (1,'Firm A'),(2,'Firm B'),(3,'Firm C'),(4,'Firm D'); INSERT INTO startups(id,name,founder,disability) VALUES ... | SELECT DISTINCT investors.name FROM investors JOIN investments ON investors.id = investments.investor_id JOIN startups ON investments.startup_id = startups.id WHERE startups.disability = true; |
What is the average CO2 emission reduction from green buildings in Japan? | CREATE TABLE co2_emission_reduction (id INT,green_building_id INT,reduction FLOAT); CREATE VIEW green_buildings_japan AS SELECT * FROM green_buildings WHERE country = 'Japan'; | SELECT AVG(reduction) FROM co2_emission_reduction JOIN green_buildings_japan ON co2_emission_reduction.green_building_id = green_buildings_japan.id; |
What was the total economic diversification investment in Philippines in 2017? | CREATE TABLE economic_diversification (project_id INT,country TEXT,project TEXT,investment INT,year INT); INSERT INTO economic_diversification (project_id,country,project,investment,year) VALUES (1,'Philippines','Renewable energy',1100000,2016),(2,'Philippines','Education',1300000,2017),(3,'Philippines','Healthcare',15... | SELECT SUM(investment) FROM economic_diversification WHERE country = 'Philippines' AND year = 2017; |
How can I update the budget for the 'Adaptive Equipment' program in 'New York' for 2023? | CREATE TABLE budget (budget_id INT,program_name VARCHAR(50),state VARCHAR(50),year INT,amount INT); INSERT INTO budget (budget_id,program_name,state,year,amount) VALUES (1,'Accessible Transportation','New York',2022,50000),(2,'Sign Language Interpretation','New York',2022,30000),(3,'Adaptive Equipment','New York',2022,... | UPDATE budget SET amount = 45000 WHERE program_name = 'Adaptive Equipment' AND state = 'New York' AND year = 2023; |
Who are the top 3 vendors selling the most sustainable products in New York? | CREATE TABLE vendors (vendor_id INT,vendor_name VARCHAR(50),state VARCHAR(50)); INSERT INTO vendors VALUES (1,'VendorA','New York'); INSERT INTO vendors VALUES (2,'VendorB','Texas'); CREATE TABLE products (product_id INT,product_name VARCHAR(50),vendor_id INT,sustainability_rating INT); INSERT INTO products VALUES (1,'... | SELECT vendors.vendor_name, SUM(products.sustainability_rating) as total_rating FROM vendors JOIN products ON vendors.vendor_id = products.vendor_id WHERE vendors.state = 'New York' GROUP BY vendors.vendor_id, vendors.vendor_name ORDER BY total_rating DESC LIMIT 3; |
What is the average temperature recorded by sensor 001 in the 'temps' table? | CREATE TABLE sensors (sensor_id INT,location VARCHAR(50)); INSERT INTO sensors (sensor_id,location) VALUES (001,'Field A'); CREATE TABLE temps (sensor_id INT,temp FLOAT,timestamp TIMESTAMP); INSERT INTO temps (sensor_id,temp,timestamp) VALUES (001,23.5,'2022-01-01 10:00:00'); INSERT INTO temps (sensor_id,temp,timestamp... | SELECT AVG(temp) FROM temps WHERE sensor_id = 001; |
What is the average funding amount for Canadian biotech startups? | CREATE TABLE biotech_startups (id INT,name VARCHAR(100),location VARCHAR(100),funding FLOAT); INSERT INTO biotech_startups (id,name,location,funding) VALUES (1,'Startup A','Canada',12000000); INSERT INTO biotech_startups (id,name,location,funding) VALUES (2,'Startup B','Canada',18000000); | SELECT AVG(funding) FROM biotech_startups WHERE location = 'Canada'; |
Which Rare earth element had the lowest production in 2017? | CREATE TABLE RareEarthElements_Production (Year INT,Element VARCHAR(10),Quantity INT); INSERT INTO RareEarthElements_Production (Year,Element,Quantity) VALUES (2017,'Neodymium',1800),(2017,'Dysprosium',1600),(2017,'Praseodymium',1400); | SELECT Element, MIN(Quantity) FROM RareEarthElements_Production WHERE Year = 2017; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.