instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
How many new users joined from countries with stricter data privacy laws than the United States in the past month?
CREATE TABLE users (user_id INT,country VARCHAR(50),joined_date DATE);CREATE TABLE data_privacy_laws (country VARCHAR(50),privacy_level INT); INSERT INTO users (user_id,country,joined_date) VALUES (1,'USA','2023-02-15'),(2,'Germany','2023-02-27'); INSERT INTO data_privacy_laws (country,privacy_level) VALUES ('USA',5),(...
SELECT COUNT(user_id) FROM users JOIN data_privacy_laws ON users.country = data_privacy_laws.country WHERE data_privacy_laws.privacy_level > (SELECT privacy_level FROM data_privacy_laws WHERE country = 'USA') AND joined_date >= DATEADD(month, -1, CURRENT_DATE);
What is the average fine for traffic violations in each district?
CREATE TABLE TrafficViolations (ID INT,District VARCHAR(20),Fine FLOAT); INSERT INTO TrafficViolations (ID,District,Fine) VALUES (1,'District1',100.0),(2,'District2',150.0),(3,'District1',120.0),(4,'District3',75.0);
SELECT District, AVG(Fine) OVER (PARTITION BY District) AS AvgFine FROM TrafficViolations;
List all clinical trials that were conducted in Canada and have a status of 'Completed' or 'Terminated'.
CREATE TABLE clinical_trials (country TEXT,trial_status TEXT); INSERT INTO clinical_trials (country,trial_status) VALUES ('Canada','Completed'),('Canada','Terminated');
SELECT * FROM clinical_trials WHERE country = 'Canada' AND trial_status IN ('Completed', 'Terminated');
Get disease prevalence per state
CREATE TABLE if not exists 'disease_data' (id INT,state TEXT,disease TEXT,prevalence INT,PRIMARY KEY(id));
SELECT state, AVG(prevalence) FROM 'disease_data' GROUP BY state;
What is the total salary expense for the HR department?
CREATE TABLE departments (id INT,name VARCHAR(50),budget FLOAT); INSERT INTO departments (id,name,budget) VALUES (1,'HR',300000.00),(2,'IT',500000.00); CREATE TABLE employees (id INT,name VARCHAR(50),department VARCHAR(50),salary FLOAT); INSERT INTO employees (id,name,department,salary) VALUES (1,'John Doe','HR',60000....
SELECT SUM(e.salary) FROM employees e INNER JOIN departments d ON e.department = d.name WHERE d.name = 'HR';
What is the average budget for each department in Q3 of 2021?
CREATE TABLE Departments (DepartmentID INT,Name TEXT,Budget DECIMAL(10,2)); INSERT INTO Departments VALUES (1,'Marketing',50000.00),(2,'Operations',70000.00);
SELECT Name, AVG(Budget) FROM Departments WHERE QUARTER(Date) = 3 AND YEAR(Date) = 2021 GROUP BY Name;
Show the total amount of funding for programs in 'Theater' category, excluding programs with a budget over $50,000.
CREATE TABLE Programs (id INT,name TEXT,category TEXT,budget INT); INSERT INTO Programs (id,name,category,budget) VALUES (1,'Dance Performance','Theater',50000),(2,'Film Festival','Music',75000),(3,'Photography Exhibition','Visual Arts',100000);
SELECT SUM(budget) FROM Programs WHERE category = 'Theater' AND budget <= 50000;
What are the names of clients who have had cases in both the first quarter and the fourth quarter?
CREATE TABLE Clients (ClientID INT,Name TEXT); INSERT INTO Clients VALUES (1,'Thomas'),(2,'Ramirez'),(3,'Gonzalez'),(4,'Clark'); CREATE TABLE Cases (CaseID INT,ClientID INT,Quarter TEXT); INSERT INTO Cases VALUES (1,1,'Q1'),(2,2,'Q2'),(3,3,'Q3'),(4,1,'Q4'),(5,4,'Q4');
SELECT c.Name FROM Clients c INNER JOIN Cases n ON c.ClientID = n.ClientID WHERE n.Quarter = 'Q1' INTERSECT SELECT c.Name FROM Clients c INNER JOIN Cases t ON c.ClientID = t.ClientID WHERE t.Quarter = 'Q4';
Delete all donations made in January 2022
CREATE TABLE donations (id INT,nonprofit_id INT,donation_date DATE,amount DECIMAL(10,2));
DELETE FROM donations WHERE donation_date BETWEEN '2022-01-01' AND '2022-01-31';
What is the number of peacekeeping operations participated in by each country in the 'peacekeeping' table, excluding those with less than 3 operations, ordered by the number of operations in ascending order?
CREATE TABLE peacekeeping (id INT,country VARCHAR(50),num_operations INT);
SELECT country, COUNT(*) as num_operations FROM peacekeeping GROUP BY country HAVING COUNT(*) >= 3 ORDER BY num_operations ASC;
How many regulatory frameworks have been implemented in Africa per year?
CREATE TABLE regulatory_frameworks (framework_id INT,framework_name VARCHAR(50),framework_jurisdiction VARCHAR(50),enforcement_agency VARCHAR(50),implementation_year INT);
CREATE VIEW africa_frameworks_per_year AS SELECT TO_CHAR(implementation_year, 'YYYY') AS implementation_year, COUNT(framework_id) AS frameworks_implemented FROM regulatory_frameworks WHERE framework_jurisdiction = 'Africa' GROUP BY implementation_year ORDER BY implementation_year;
Count the number of penalties taken by 'Messi' in all competitions.
CREATE TABLE players (player_id INT,name TEXT); INSERT INTO players (player_id,name) VALUES (1,'Messi'),(2,'Ronaldo'); CREATE TABLE penalties (penalty_id INT,player_id INT); INSERT INTO penalties (penalty_id,player_id) VALUES (1,1),(2,1),(3,2);
SELECT COUNT(*) FROM penalties JOIN players ON penalties.player_id = players.player_id WHERE players.name = 'Messi';
Update the food safety records for the 'Sushi Bar' restaurant to 'Fail' for the 'Health Inspector' with ID 890.
CREATE TABLE food_safety(inspection_id INT,inspector VARCHAR(255),restaurant VARCHAR(255),inspection_date DATE,result ENUM('Pass','Fail'));
UPDATE food_safety SET result = 'Fail' WHERE restaurant = 'Sushi Bar' AND inspector = '890';
What is the average negotiation duration for defense projects in the Middle East?
CREATE TABLE Projects (id INT,name VARCHAR(30),region VARCHAR(20),negotiation_start_date DATE,negotiation_end_date DATE);
SELECT AVG(DATEDIFF(negotiation_end_date, negotiation_start_date)) as avg_negotiation_duration FROM Projects WHERE region = 'Middle East';
What is the total number of games sold in the last month?
CREATE TABLE GameSales (GameID INT,GameType VARCHAR(10),SaleDate DATE); INSERT INTO GameSales (GameID,GameType,SaleDate) VALUES (1,'Mobile','2022-01-01'),(2,'PC','2022-01-02');
SELECT COUNT(*) FROM GameSales WHERE SaleDate >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
What is the distribution of AI research areas in South America?
CREATE TABLE ai_research (research_id INT,area VARCHAR(50),region VARCHAR(20)); INSERT INTO ai_research (research_id,area,region) VALUES (1,'computer vision','South America'),(2,'natural language processing','South America'),(3,'machine learning','North America'),(4,'reinforcement learning','Europe');
SELECT area, COUNT(*) as frequency FROM ai_research WHERE region = 'South America' GROUP BY area;
What are the average soil moisture levels for each crop type in the month of June?
CREATE TABLE crop_moisture (crop_type TEXT,measurement_date DATE,soil_moisture INT); INSERT INTO crop_moisture (crop_type,measurement_date,soil_moisture) VALUES ('Corn','2022-06-01',650),('Soybeans','2022-06-01',700),('Wheat','2022-06-01',550);
SELECT crop_type, AVG(soil_moisture) FROM crop_moisture WHERE measurement_date BETWEEN '2022-06-01' AND '2022-06-30' GROUP BY crop_type;
What is the total playtime for each game in the 'games_v2' table?
CREATE TABLE games_v2 (game_id INT,game_name VARCHAR(50),playtime INT); INSERT INTO games_v2 (game_id,game_name,playtime) VALUES (4,'GameD',4000),(5,'GameE',5000);
SELECT game_name, SUM(playtime) FROM games_v2 GROUP BY game_name;
Delete records in the 'Faculty_Members' table where the 'Title' is 'Visiting Scholar' and 'Hire_Date' is before '2018-01-01
CREATE TABLE Faculty_Members (Faculty_ID INT,First_Name VARCHAR(50),Last_Name VARCHAR(50),Title VARCHAR(20),Department VARCHAR(50),Hire_Date DATE,Salary DECIMAL(10,2));
DELETE FROM Faculty_Members WHERE Title = 'Visiting Scholar' AND Hire_Date < '2018-01-01';
Delete virtual tours in New York City with a length less than 30 minutes.
CREATE TABLE virtual_tour (tour_id INT,name TEXT,city TEXT,length INT); INSERT INTO virtual_tour (tour_id,name,city,length) VALUES (3,'NYC Skyline','New York City',45);
DELETE FROM virtual_tour WHERE city = 'New York City' AND length < 30;
what are the top 3 fish species in terms of global production?
CREATE TABLE FishProduction (Species TEXT,Quantity INT); INSERT INTO FishProduction (Species,Quantity) VALUES ('Tilapia',6000000),('Salmon',3500000),('Shrimp',5000000),('Cod',2000000),('Pangasius',1200000);
SELECT Species, Quantity FROM FishProduction ORDER BY Quantity DESC LIMIT 3;
How many cases were handled by attorneys who passed the bar exam on the first attempt?
CREATE TABLE Attorneys (AttorneyID INT,BarExamAttempts INT);
SELECT COUNT(*) FROM Attorneys WHERE BarExamAttempts = 1;
What is the maximum budget for a biosensor technology project in each city?
CREATE TABLE biosensors(id INT,project VARCHAR(50),city VARCHAR(50),budget DECIMAL(10,2)); INSERT INTO biosensors VALUES (1,'ProjectA','LA',3000000.00),(2,'ProjectB','NYC',5000000.00),(3,'ProjectC','LA',4000000.00);
SELECT city, MAX(budget) FROM biosensors GROUP BY city;
How many times was each type of research conducted in the 'arctic_research' table, excluding 'climate change' research?
CREATE TABLE arctic_research (id INTEGER,type TEXT);
SELECT type, COUNT(*) FROM arctic_research WHERE type != 'climate change' GROUP BY type;
Find the top 2 countries with the highest total donation amounts in 2021 and their respective average donation amounts?
CREATE TABLE country_donations (country_id INT,country_name VARCHAR(50),total_donations DECIMAL(10,2),donation_year INT,avg_donation DECIMAL(10,2)); INSERT INTO country_donations (country_id,country_name,total_donations,donation_year,avg_donation) VALUES (1,'USA',50000.00,2021,100.00),(2,'Canada',40000.00,2021,200.00),...
SELECT donation_year, country_name, total_donations, AVG(avg_donation) avg_donation, RANK() OVER (ORDER BY total_donations DESC) country_rank FROM country_donations WHERE donation_year = 2021 AND country_rank <= 2 GROUP BY donation_year, country_name, total_donations;
Which sites in 'North America' have no excavated artifacts?
CREATE TABLE Sites (SiteID int,Name text,Country text); INSERT INTO Sites (SiteID,Name,Country) VALUES (1,'SiteA','USA'); CREATE TABLE Artifacts (ArtifactID int,Name text,SiteID int,ExcavationYear int); INSERT INTO Artifacts (ArtifactID,Name,SiteID,ExcavationYear) VALUES (1,'Artifact1',2,2005);
SELECT Name FROM Sites LEFT JOIN Artifacts ON Sites.SiteID = Artifacts.SiteID WHERE Artifacts.SiteID IS NULL AND Country = 'North America';
What is the total revenue for each game genre in 2019 and 2020?
CREATE TABLE Games (GameID INT,Genre VARCHAR(20),Revenue INT,ReleaseYear INT); INSERT INTO Games (GameID,Genre,Revenue,ReleaseYear) VALUES (1,'Sports',5000000,2019),(2,'RPG',7000000,2020),(3,'Strategy',6000000,2019),(4,'Sports',8000000,2020),(5,'RPG',9000000,2019);
SELECT Genre, ReleaseYear, SUM(Revenue) as TotalRevenue FROM Games GROUP BY Genre, ReleaseYear
Display the total number of cases and the number of dismissed cases for each judge, ordered by the total number of cases?
CREATE TABLE judges (judge_id INT,name VARCHAR(50)); INSERT INTO judges (judge_id,name) VALUES (1,'John Doe'),(2,'Jane Smith'),(3,'Robert Johnson'); CREATE TABLE cases (case_id INT,judge_id INT,case_status VARCHAR(10)); INSERT INTO cases (case_id,judge_id,case_status) VALUES (101,1,'open'),(102,1,'dismissed'),(103,2,'o...
SELECT judge_id, COUNT(*) as total_cases, SUM(CASE WHEN case_status = 'dismissed' THEN 1 ELSE 0 END) as dismissed_cases FROM cases GROUP BY judge_id ORDER BY total_cases DESC;
Which mine produced the most REE in 2021?
CREATE TABLE mines (id INT,name TEXT,location TEXT,annual_production INT); INSERT INTO mines (id,name,location,annual_production) VALUES (1,'Mine A','Country X',1500),(2,'Mine B','Country Y',2000),(3,'Mine C','Country Z',1750);
SELECT name, MAX(annual_production) as max_production FROM mines WHERE YEAR(timestamp) = 2021 GROUP BY name;
What is the revenue of sustainable fashion sales in Tokyo and Sydney?
CREATE TABLE REVENUE(city VARCHAR(20),revenue DECIMAL(5,2)); INSERT INTO REVENUE(city,revenue) VALUES('Tokyo',2000.00),('Tokyo',1800.00),('Sydney',2500.00),('Sydney',2200.00);
SELECT SUM(revenue) FROM REVENUE WHERE city IN ('Tokyo', 'Sydney') AND revenue > 1500.00;
What is the average waiting time for buses in the Rome public transportation network?
CREATE TABLE bus_waiting_times (bus_id INT,waiting_time INT); INSERT INTO bus_waiting_times (bus_id,waiting_time) VALUES (1,10),(2,5),(3,15),(4,8),(5,12);
SELECT AVG(waiting_time) FROM bus_waiting_times;
What are the names and populations of indigenous communities in Canada that speak Inuktitut or Yupik?
CREATE TABLE Indigenous_Communities (id INT,name VARCHAR(100),population INT,location VARCHAR(100),language VARCHAR(100)); INSERT INTO Indigenous_Communities (id,name,population,location,language) VALUES (1,'Inuit',80000,'Canada','Inuktitut'); INSERT INTO Indigenous_Communities (id,name,population,location,language) VA...
SELECT name, population FROM Indigenous_Communities WHERE (language = 'Inuktitut' OR language = 'Yupik') AND location = 'Canada'
What is the total number of military innovation projects for each region?
CREATE TABLE military_innovation (id INT,region VARCHAR,project_count INT);
SELECT region, SUM(project_count) FROM military_innovation GROUP BY region;
Which expeditions have a budget greater than $500,000 and were completed in the last 3 years?
CREATE TABLE expeditions (id INT PRIMARY KEY,name VARCHAR(255),objective VARCHAR(255),start_date DATE,end_date DATE,budget FLOAT);
SELECT name, budget FROM expeditions WHERE budget > 500000 AND end_date >= DATE_SUB(CURDATE(), INTERVAL 3 YEAR);
determine the average sale price of cruelty-free makeup products in the USA
CREATE TABLE CrueltyFreeMakeupSales (sale_id INT,product_name TEXT,is_cruelty_free BOOLEAN,sale_amount FLOAT,sale_date DATE,country TEXT); INSERT INTO CrueltyFreeMakeupSales (sale_id,product_name,is_cruelty_free,sale_amount,sale_date,country) VALUES (1,'Cruelty-Free Lipstick',TRUE,25.00,'2021-01-10','USA'); INSERT INTO...
SELECT AVG(sale_amount) FROM CrueltyFreeMakeupSales WHERE is_cruelty_free = TRUE AND country = 'USA';
What is the maximum ocean acidity level in the Indian Ocean near Indonesia?
CREATE TABLE ocean_acidity (ocean VARCHAR(255),region VARCHAR(255),acidity FLOAT); INSERT INTO ocean_acidity (ocean,region,acidity) VALUES ('Indian','Indonesia',8.2); INSERT INTO ocean_acidity (ocean,region,acidity) VALUES ('Indian','Sri Lanka',8.1);
SELECT MAX(acidity) FROM ocean_acidity WHERE ocean = 'Indian' AND region = 'Indonesia';
What is the total number of mobile subscribers in each country?
CREATE TABLE mobile_subscribers (subscriber_id INT,name VARCHAR(255),country VARCHAR(255)); INSERT INTO mobile_subscribers (subscriber_id,name,country) VALUES (1,'Jane Doe','USA'),(2,'Maria Garcia','Mexico');
SELECT country, COUNT(*) FROM mobile_subscribers GROUP BY country;
What is the average time taken for disability policy advocacy initiatives to be implemented, categorized by initiative type?
CREATE TABLE PolicyAdvocacy (AdvocacyID INT,AdvocacyType VARCHAR(50),InitiativeID INT,StartDate DATE,EndDate DATE); INSERT INTO PolicyAdvocacy (AdvocacyID,AdvocacyType,InitiativeID,StartDate,EndDate) VALUES (1,'Legislation',1,'2020-01-01','2020-04-15'); INSERT INTO PolicyAdvocacy (AdvocacyID,AdvocacyType,InitiativeID,S...
SELECT AdvocacyType, AVG(DATEDIFF(DAY, StartDate, EndDate)) AS AvgTime FROM PolicyAdvocacy GROUP BY AdvocacyType;
Display the event name and its corresponding city for all events with attendance greater than 250
CREATE TABLE events (event_id INT,event_name VARCHAR(50),city VARCHAR(30),attendance INT); INSERT INTO events (event_id,event_name,city,attendance) VALUES (1,'Theater Play','New York',200),(2,'Art Exhibit','Los Angeles',300),(3,'Music Festival','New York',400);
SELECT event_name, city FROM events WHERE attendance > 250;
List all species in the marine_life table with their population counts for the arctic_ocean region, ordered by population in descending order.
CREATE TABLE marine_life (id INT,species VARCHAR(255),population INT,region VARCHAR(255)); INSERT INTO marine_life (id,species,population,region) VALUES (1,'Salmon',15000,'pacific_ocean'); INSERT INTO marine_life (id,species,population,region) VALUES (2,'Lionfish',1200,'atlantic_ocean'); INSERT INTO marine_life (id,spe...
SELECT species, population, region FROM marine_life WHERE region = 'arctic_ocean' ORDER BY population DESC;
List all genetic research data tables that have a 'sample_date' column.
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.research_data_1 (id INT PRIMARY KEY,sample_id VARCHAR(50),sample_date DATE);CREATE TABLE if not exists genetics.research_data_2 (id INT PRIMARY KEY,sample_id VARCHAR(50),sample_result INT);CREATE TABLE if not exists genetics.research_data_3 (id IN...
SELECT table_name FROM information_schema.columns WHERE table_schema = 'genetics' AND column_name = 'sample_date';
What is the average temperature for all regions growing 'Corn'?
CREATE TABLE farm (id INT PRIMARY KEY,name VARCHAR(50),region_id INT,avg_temp DECIMAL(5,2)); CREATE TABLE region (id INT PRIMARY KEY,name VARCHAR(50)); INSERT INTO region (id,name) VALUES (1,'Midwest'),(2,'South'); INSERT INTO farm (id,name,region_id,avg_temp) VALUES (1,'Smith Farm',1,15.5),(2,'Jones Farm',1,16.3),(3,'...
SELECT AVG(f.avg_temp) FROM farm f INNER JOIN region r ON f.region_id = r.id WHERE r.name IN (SELECT name FROM region WHERE id IN (SELECT region_id FROM farm WHERE name = 'Corn'));
Find the number of flu cases for each age group in Florida in 2019?
CREATE TABLE flu_cases (id INT,age INT,location TEXT,year INT); INSERT INTO flu_cases (id,age,location,year) VALUES (1,5,'Florida',2019); INSERT INTO flu_cases (id,age,location,year) VALUES (2,25,'Florida',2018); INSERT INTO flu_cases (id,age,location,year) VALUES (3,65,'Florida',2019);
SELECT flu_cases.age, COUNT(flu_cases.id) FROM flu_cases WHERE flu_cases.location = 'Florida' AND flu_cases.year = 2019 GROUP BY flu_cases.age;
What is the average mental health survey score for students in urban schools who have participated in open pedagogy programs?
CREATE TABLE urban_schools (student_id INT,survey_score INT); INSERT INTO urban_schools VALUES (1001,80),(1002,85),(1003,90); CREATE TABLE open_pedagogy_programs (student_id INT,program_type VARCHAR(50)); INSERT INTO open_pedagogy_programs VALUES (1001,'Online'),(1002,'Blended'),(1003,'In-person');
SELECT AVG(survey_score) FROM urban_schools JOIN open_pedagogy_programs ON urban_schools.student_id = open_pedagogy_programs.student_id WHERE program_type = 'Online' OR program_type = 'Blended';
What is the average safety score of creative AI applications by region, ordered by the highest average score?
CREATE TABLE CreativeAI (app_id INT,app_name VARCHAR(255),region VARCHAR(255),safety_score DECIMAL(5,2)); INSERT INTO CreativeAI (app_id,app_name,region,safety_score) VALUES (1,'DreamApp','US',85.2),(2,'Invento','India',88.7),(3,'AIArtist','Canada',91.5),(4,'ScriptBot','UK',96.8);
SELECT region, AVG(safety_score) as avg_safety_score FROM CreativeAI GROUP BY region ORDER BY avg_safety_score DESC;
List all wildlife habitats with a population density over 5
CREATE TABLE wildlife_habitats (id INT,name VARCHAR(255),population INT,density FLOAT);
SELECT * FROM wildlife_habitats WHERE density > 5;
Count the number of unique players who have played sports games and have spent more than 30 hours on them, regardless of platform.
CREATE TABLE Players (PlayerID INT,Name VARCHAR(100),Country VARCHAR(50),TotalHoursPlayed INT,Platform VARCHAR(50)); INSERT INTO Players VALUES (1,'Michael Brown','USA',50,'PC'); INSERT INTO Players VALUES (2,'Emily White','Canada',35,'Console'); CREATE TABLE GameDesign (GameID INT,GameName VARCHAR(100),Genre VARCHAR(5...
SELECT COUNT(DISTINCT P.PlayerID) as UniquePlayers FROM Players P JOIN GameDesign GD ON P.PlayerID = GD.GameID WHERE GD.Genre = 'Sports' AND P.TotalHoursPlayed > 30;
List all food safety violations for 'Budget Burger' in Q2 2020.
CREATE TABLE Inspections (restaurant_id INT,inspection_date DATE,violation_count INT); INSERT INTO Inspections (restaurant_id,inspection_date,violation_count) VALUES (2,'2020-04-01',3),(2,'2020-07-15',2);
SELECT * FROM Inspections WHERE restaurant_id = 2 AND EXTRACT(QUARTER FROM inspection_date) = 2 AND EXTRACT(YEAR FROM inspection_date) = 2020;
Identify the community engagement programs in North America that have the most diverse range of traditional art forms.
CREATE TABLE programs (name VARCHAR(255),location VARCHAR(255),arts VARCHAR(255)); INSERT INTO programs (name,location,arts) VALUES ('Program1','North America','Art1,Art2'),('Program2','North America','Art2,Art3'),('Program3','Europe','Art1');
SELECT location, COUNT(DISTINCT arts) AS diversity FROM programs WHERE location = 'North America' GROUP BY location ORDER BY diversity DESC;
What is the total number of posts with the hashtag "#music" for users from the UK in the "user_posts" and "post_hashtags" tables?
CREATE TABLE user_posts (post_id INT,user_id INT,hashtags VARCHAR(255)); INSERT INTO user_posts (post_id,user_id) VALUES (1,1),(2,2),(3,3); CREATE TABLE post_hashtags (post_id INT,hashtags VARCHAR(255)); INSERT INTO post_hashtags (post_id,hashtags) VALUES (1,'#music'),(1,'#food'),(2,'#nature'),(3,'#music'),(3,'#travel'...
SELECT COUNT(DISTINCT up.post_id) FROM user_posts up JOIN post_hashtags ph ON up.post_id = ph.post_id JOIN user_profiles upr ON up.user_id = upr.id WHERE ph.hashtags LIKE '%#music%' AND upr.country = 'UK';
What is the minimum salary for workers in the 'healthcare_database' database who are not members of a union and work in the 'nursing' department?
CREATE TABLE nurses (id INT,name VARCHAR(50),salary DECIMAL(10,2),is_union_member BOOLEAN,department VARCHAR(50)); INSERT INTO nurses (id,name,salary,is_union_member,department) VALUES (1,'Peter',60000.00,false,'nursing'),(2,'Penny',65000.00,true,'nursing'),(3,'Patrick',55000.00,false,'nursing');
SELECT MIN(salary) FROM nurses WHERE is_union_member = false AND department = 'nursing';
What is the total quantity of ethically sourced materials in stock?
CREATE TABLE materials (id INT,name TEXT,ethical_source BOOLEAN); CREATE TABLE inventory (id INT,material_id INT,quantity INT); INSERT INTO materials (id,name,ethical_source) VALUES (1,'Material A',true),(2,'Material B',false),(3,'Material C',true); INSERT INTO inventory (id,material_id,quantity) VALUES (1,1,50),(2,2,8...
SELECT SUM(inventory.quantity) FROM inventory INNER JOIN materials ON inventory.material_id = materials.id WHERE materials.ethical_source = true;
Identify the monthly trend of CO2 emissions in the past year.
CREATE TABLE environmental_impact (id INT,date DATE,co2_emissions FLOAT);
SELECT EXTRACT(MONTH FROM date) as month, AVG(co2_emissions) as avg_co2_emissions FROM environmental_impact WHERE date >= DATEADD(year, -1, CURRENT_DATE) GROUP BY EXTRACT(MONTH FROM date) ORDER BY EXTRACT(MONTH FROM date);
What is the number of criminal justice reform advocacy groups in each country?
CREATE TABLE criminal_justice_reform_groups (group_id INT,country VARCHAR(50));
SELECT country, COUNT(*) FROM criminal_justice_reform_groups GROUP BY country;
Add a new autonomous shuttle to the fleet table.
CREATE TABLE fleet (id INT PRIMARY KEY,name VARCHAR(255),type VARCHAR(255)); INSERT INTO fleet (id,name,type) VALUES (1,'City Bus','Conventional'),(2,'Trolley','Electric'),(3,'Autonomous Shuttle',NULL);
UPDATE fleet SET type = 'Autonomous' WHERE id = 3;
What is the average occupancy rate of eco-friendly hotels in Europe with certification level 5?
CREATE TABLE eco_hotels (hotel_id INT,hotel_name TEXT,country TEXT,certification_level INT,occupancy_rate DECIMAL); INSERT INTO eco_hotels (hotel_id,hotel_name,country,certification_level,occupancy_rate) VALUES (401,'Asia Eco Lodge','India',4,0.85),(402,'Bali Green Resort','Indonesia',5,0.90),(403,'Japan Eco Hotel','Ja...
SELECT AVG(occupancy_rate) as avg_occupancy_rate FROM eco_hotels WHERE country IN ('France') AND certification_level = 5;
What is the percentage of users who have accepted our data privacy policy in each country, in the past 6 months?
CREATE TABLE users (user_id INT,first_name VARCHAR(50),last_name VARCHAR(50),age INT,gender VARCHAR(10),country VARCHAR(50),accepted_privacy_policy BOOLEAN);
SELECT country, ROUND(100.0 * SUM(CASE WHEN accepted_privacy_policy THEN 1 ELSE 0 END) / COUNT(user_id) OVER (PARTITION BY country), 2) AS acceptance_percentage FROM users WHERE accepted_privacy_policy IS NOT NULL AND post_date >= (CURRENT_DATE - INTERVAL '6 months') GROUP BY country;
What is the average distance from rural healthcare professionals to their patients?
CREATE TABLE Patients (PatientID int,PatientName varchar(50),ClinicID int); CREATE TABLE Addresses (AddressID int,Address varchar(50),ClinicID int,Longitude decimal(10,8),Latitude decimal(10,8)); INSERT INTO Patients (PatientID,PatientName,ClinicID) VALUES (1,'Patient A',1); INSERT INTO Addresses (AddressID,Address,Cli...
SELECT AVG(ST_Distance(Patients.Address, Addresses)) AS AvgDistance FROM Patients JOIN Addresses ON Patients.ClinicID = Addresses.ClinicID;
What are the average gas fees for Ethereum smart contracts executed by developers in the EU and Asia?
CREATE TABLE Smart_Contracts (Contract_ID INT,Gas_Fees DECIMAL(10,2),Developer_Location VARCHAR(50)); INSERT INTO Smart_Contracts (Contract_ID,Gas_Fees,Developer_Location) VALUES (1,50.50,'Germany'),(2,75.25,'China'),(3,30.00,'France');
SELECT AVG(Gas_Fees) FROM Smart_Contracts WHERE Developer_Location IN ('EU', 'Asia');
What is the total number of traffic accidents in Canada, by province, for the last 10 years?
CREATE TABLE canada_traffic_accidents (id INT,year INT,province VARCHAR(255),num_accidents INT); INSERT INTO canada_traffic_accidents (id,year,province,num_accidents) VALUES (1,2012,'Ontario',187000);
SELECT province, SUM(num_accidents) AS total_accidents FROM canada_traffic_accidents WHERE year BETWEEN 2012 AND 2021 GROUP BY province;
What is the number of clinical trials approved in 'CountryB' in 2020?
CREATE TABLE clinical_trials(trial_id TEXT,country TEXT,approval_date DATE); INSERT INTO clinical_trials (trial_id,country,approval_date) VALUES ('Trial1','CountryA','2020-03-15'),('Trial2','CountryB','2019-12-20'),('Trial3','CountryC','2020-06-30'),('Trial4','CountryB','2020-08-01');
SELECT COUNT(*) FROM clinical_trials WHERE country = 'CountryB' AND EXTRACT(YEAR FROM approval_date) = 2020;
What is the average allocation for all climate initiatives in 'Asia'?
CREATE TABLE climate_funding (id INT,allocation FLOAT,initiative_type TEXT,region_id INT); CREATE TABLE regions (id INT,region TEXT); INSERT INTO climate_funding (id,allocation,initiative_type,region_id) VALUES (1,500000.00,'Mitigation',1),(2,750000.00,'Adaptation',2),(3,300000.00,'Communication',1),(4,450000.00,'Mitig...
SELECT AVG(allocation) FROM climate_funding INNER JOIN regions ON climate_funding.region_id = regions.id WHERE regions.region = 'Asia';
What is the average water temperature for each species in the fish_stock table?
CREATE TABLE fish_stock (species VARCHAR(50),location VARCHAR(50),water_temp DECIMAL(5,2));
SELECT species, AVG(water_temp) as avg_temp FROM fish_stock GROUP BY species;
Insert new record into effective_altruism table
CREATE TABLE effective_altruism (id INT PRIMARY KEY,name VARCHAR(100),amount INT,cause VARCHAR(20));
INSERT INTO effective_altruism (id, name, amount, cause) VALUES (5, 'Donation to Animal Welfare', 300000, 'Animal Welfare');
How many customers live in 'California'?
CREATE TABLE savings (customer_id INT,name TEXT,state TEXT,savings DECIMAL(10,2)); INSERT INTO savings (customer_id,name,state,savings) VALUES (5,'Emma Wilson','California',9000.00),(6,'Oliver Brown','California',10000.00);
SELECT COUNT(*) FROM savings WHERE state = 'California';
Insert a new TV show 'Nubian Tales' by Afro Entertainment with 12 episodes.
CREATE TABLE studio (studio_id INT,name VARCHAR(100)); INSERT INTO studio (studio_id,name) VALUES (1,'Afro Entertainment'); CREATE TABLE tv_show (tv_show_id INT,title VARCHAR(100),studio_id INT,episodes INT);
INSERT INTO tv_show (tv_show_id, title, studio_id, episodes) VALUES (1, 'Nubian Tales', 1, 12);
How many artists from each country participated in the "artists" table, joined with the "countries" table, for artists who joined between 2016 and 2021?
CREATE TABLE artists (artist_id INT,artist_name VARCHAR(50),country_id INT); CREATE TABLE countries (country_id INT,country_name VARCHAR(50));
SELECT c.country_name, COUNT(a.artist_id) as total_artists FROM artists a INNER JOIN countries c ON a.country_id = c.country_id WHERE a.artist_date BETWEEN '2016-01-01' AND '2021-12-31' GROUP BY c.country_name;
What are the total sales for artworks created by artists born before 1900?
CREATE TABLE artists (id INT,name TEXT,birth_year INT); CREATE TABLE sales (id INT,artwork_id INT,sale_price INT); INSERT INTO artists (id,name,birth_year) VALUES (1,'Vincent Van Gogh',1853),(2,'Pablo Picasso',1881),(3,'Claude Monet',1840); INSERT INTO sales (id,artwork_id,sale_price) VALUES (1,1,82000000),(2,3,1100000...
SELECT SUM(sale_price) FROM sales sa INNER JOIN artworks a ON sa.artwork_id = a.id INNER JOIN artists ar ON a.artist_id = ar.id WHERE ar.birth_year < 1900;
Display the total weight (in kg) of organic ingredients for each dish in the organic_ingredients and dish_ingredients tables.
CREATE TABLE organic_ingredients (ingredient_id INT,ingredient_name TEXT,is_organic BOOLEAN); CREATE TABLE dish_ingredients (dish_id INT,ingredient_id INT,weight REAL);
SELECT dish_ingredients.dish_id, SUM(dish_ingredients.weight) FROM dish_ingredients INNER JOIN organic_ingredients ON dish_ingredients.ingredient_id = organic_ingredients.ingredient_id WHERE organic_ingredients.is_organic = TRUE GROUP BY dish_ingredients.dish_id;
What is the earliest shipment date for each warehouse?
CREATE TABLE shipments (shipment_id INT,shipment_date DATE,warehouse_id INT); INSERT INTO shipments (shipment_id,shipment_date,warehouse_id) VALUES (1,'2021-01-01',1),(2,'2021-01-02',2),(3,'2021-01-03',3);
SELECT warehouse_id, MIN(shipment_date) FROM shipments GROUP BY warehouse_id;
How many climate mitigation projects were initiated in Asia and Africa from 2015 to 2020, and how many of those projects received funding?
CREATE TABLE climate_projects (region VARCHAR(255),year INT,project_type VARCHAR(255),funded BOOLEAN);
SELECT project_type, COUNT(*) AS num_projects, SUM(funded) AS num_funded FROM climate_projects WHERE year BETWEEN 2015 AND 2020 AND region IN ('Asia', 'Africa') GROUP BY project_type;
What is the average age of employees in the "mining_operations" table, who are working in the "sustainability" department?
CREATE TABLE mining_operations (id INT,name VARCHAR(50),department VARCHAR(50),age INT);
SELECT AVG(age) FROM mining_operations WHERE department = 'sustainability';
Find the total biomass of Salmon farmed in Asia by year.
CREATE TABLE asian_salmon_farms (farm_id INT,year INT,biomass FLOAT); INSERT INTO asian_salmon_farms (farm_id,year,biomass) VALUES (1,2020,800.2),(2,2021,900.1),(3,2020,700.3);
SELECT year, SUM(biomass) total_biomass FROM asian_salmon_farms GROUP BY year;
What is the total budget for departments in 'France'?
CREATE TABLE Department (id INT,Name VARCHAR(255),City_id INT,Head VARCHAR(255),Country VARCHAR(255)); INSERT INTO Department (id,Name,City_id,Head,Country) VALUES (1,'DeptA',1,'DeptHeadA','France'); INSERT INTO Department (id,Name,City_id,Head,Country) VALUES (2,'DeptB',2,'DeptHeadB','Germany');
SELECT Name, SUM(Amount) FROM Department INNER JOIN Budget ON Department.id = Budget.Department_id WHERE Country = 'France' GROUP BY Name;
What is the maximum trip duration for shared bicycles in 'New York'?
CREATE TABLE if not exists Cities (id int,name text); INSERT INTO Cities (id,name) VALUES (1,'Los Angeles'),(2,'New York'); CREATE TABLE if not exists Vehicles (id int,type text,capacity int,city_id int); INSERT INTO Vehicles (id,type,capacity,city_id) VALUES (1,'Electric Bus',50,1),(2,'Diesel Bus',60,1),(3,'Electric B...
SELECT MAX(duration) FROM Trips JOIN Vehicles ON Trips.vehicle_id = Vehicles.id WHERE Vehicles.type = 'Shared Bicycle' AND Vehicles.city_id = (SELECT id FROM Cities WHERE name = 'New York');
What is the total funding raised by startups in the healthcare industry?
CREATE TABLE startups (id INT,name TEXT,industry TEXT); CREATE TABLE investments (id INT,startup_id INT,funding_amount INT);
SELECT SUM(investments.funding_amount) FROM startups JOIN investments ON startups.id = investments.startup_id WHERE startups.industry = 'Healthcare';
What is the difference in TEU handling between the ports with the highest and lowest handling counts in the cargo_handling table?
CREATE TABLE cargo_handling (port_id INT,port_name VARCHAR(50),teu_count INT,handling_date DATE); INSERT INTO cargo_handling (port_id,port_name,teu_count,handling_date) VALUES (1,'Port_A',35000,'2022-01-01'),(2,'Port_B',40000,'2022-01-02'),(3,'Port_C',20000,'2022-01-03');
SELECT MAX(teu_count) - MIN(teu_count) FROM cargo_handling;
Which artists have their art exhibited in the 'ModernArt' gallery?
CREATE TABLE Artists (ArtistID INT,Name VARCHAR(50),Nationality VARCHAR(50)); INSERT INTO Artists (ArtistID,Name,Nationality) VALUES (1,'Vincent Van Gogh','Dutch'); INSERT INTO Artists (ArtistID,Name,Nationality) VALUES (2,'Pablo Picasso','Spanish'); CREATE TABLE Exhibitions (ExhibitionID INT,Gallery VARCHAR(50),Artist...
SELECT Name FROM Artists JOIN Exhibitions ON Artists.ArtistID = Exhibitions.ArtistID WHERE Gallery = 'ModernArt';
What is the minimum cultural competency score for mental health facilities in Arctic regions?
CREATE TABLE mental_health_facilities (facility_id INT,location TEXT,score INT); INSERT INTO mental_health_facilities (facility_id,location,score) VALUES (1,'Arctic',70),(2,'Tropics',80),(3,'Temperate',85);
SELECT MIN(score) FROM mental_health_facilities WHERE location = 'Arctic';
What is the total amount of donations received from each country?
CREATE TABLE DonorCountries (Country VARCHAR(20),DonationID INT,DonationAmount DECIMAL(10,2)); INSERT INTO DonorCountries (Country,DonationID,DonationAmount) VALUES ('USA',1,500.00),('Canada',2,750.00),('Mexico',3,250.00),('Brazil',4,1000.00),('Argentina',5,1250.00);
SELECT Country, SUM(DonationAmount) as TotalDonations FROM DonorCountries GROUP BY Country;
Which donors have donated more than the average donation amount?
CREATE TABLE Donors (DonorName VARCHAR(50),DonationAmount DECIMAL(10,2)); INSERT INTO Donors (DonorName,DonationAmount) VALUES ('John Smith',5000.00),('Jane Doe',3000.00),('Mike Johnson',7000.00),('Sara Connor',6000.00);
SELECT DonorName FROM Donors WHERE DonationAmount > (SELECT AVG(DonationAmount) FROM Donors);
What is the minimum rating of hotels in Canada offering sustainable tourism packages?
CREATE TABLE hotels (hotel_id INT,name VARCHAR(255),country VARCHAR(255),rating FLOAT,sustainable_package BOOLEAN); INSERT INTO hotels (hotel_id,name,country,rating,sustainable_package) VALUES (1,'Canada Eco Hotel','Canada',4.2,true),(2,'Green Lodge','Canada',4.5,false),(3,'Sustainable Inn','Canada',4.7,true);
SELECT MIN(rating) FROM hotels WHERE country = 'Canada' AND sustainable_package = true;
List the names of authors who have only published articles on a single topic
CREATE TABLE Authors (id INT,name VARCHAR(50)); CREATE TABLE Articles (id INT,author_id INT,topic VARCHAR(50),published_date DATE); INSERT INTO Authors (id,name) VALUES (1,'John Doe'); INSERT INTO Authors (id,name) VALUES (2,'Jane Smith'); INSERT INTO Articles (id,author_id,topic,published_date) VALUES (1,1,'Politics',...
SELECT a.name FROM Authors a INNER JOIN (SELECT author_id, COUNT(DISTINCT topic) as topic_count FROM Articles GROUP BY author_id) b ON a.id = b.author_id WHERE b.topic_count = 1;
What is the total number of manufacturers producing garments in the European Union?
CREATE TABLE countries (country_id INT,country_name VARCHAR(255),region VARCHAR(50));CREATE TABLE manufacturers (manufacturer_id INT,manufacturer_name VARCHAR(255),country_id INT);
SELECT COUNT(DISTINCT m.manufacturer_id) AS total_manufacturers FROM manufacturers m JOIN countries c ON m.country_id = c.country_id WHERE c.region = 'European Union';
Identify the unique vessels between 'FisheryEnforcement' and 'MaritimeSecurity' organizations
CREATE TABLE VesselOrganizations (vessel VARCHAR(255),organization VARCHAR(255)); INSERT INTO VesselOrganizations (vessel,organization) VALUES ('Vessel1','FisheryEnforcement'),('Vessel2','MaritimeSecurity'),('Vessel3','FisheryEnforcement'),('Vessel4','MaritimeSecurity'),('Vessel5','MaritimeSecurity');
(SELECT vessel FROM VesselOrganizations WHERE organization = 'FisheryEnforcement' EXCEPT SELECT vessel FROM VesselOrganizations WHERE organization = 'MaritimeSecurity') UNION (SELECT vessel FROM VesselOrganizations WHERE organization = 'MaritimeSecurity' EXCEPT SELECT vessel FROM VesselOrganizations WHERE organization ...
Update the investment amount for "Series C" to 20000000 in the "investment_rounds" table
CREATE TABLE investment_rounds (round_name VARCHAR(50),investment_year INT,investment_amount INT,investment_type VARCHAR(50));
UPDATE investment_rounds SET investment_amount = 20000000 WHERE round_name = 'Series C';
What is the total number of reported crimes in the Watts district in the last 6 months?
CREATE TABLE districts (id INT,name TEXT); INSERT INTO districts (id,name) VALUES (1,'Watts'),(2,'Compton'),(3,'Inglewood'); CREATE TABLE crimes (id INT,district_id INT,report_date DATE); INSERT INTO crimes (id,district_id,report_date) VALUES (1,1,'2023-01-01'),(2,1,'2023-01-15'),(3,1,'2023-02-10'),(4,2,'2023-01-02'),(...
SELECT COUNT(*) FROM crimes WHERE district_id = 1 AND report_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH);
Which destinations were visited on the first and last days of the month?
CREATE TABLE if not exists destinations (destination_id int,destination_name varchar(50),region_id int); INSERT INTO destinations (destination_id,destination_name,region_id) VALUES (1,'Seattle',1),(2,'Portland',1),(3,'London',2); CREATE TABLE if not exists visitor_stats (visitor_id int,destination_id int,visit_date dat...
SELECT vs.destination_id, d.destination_name, vs.visit_date FROM visitor_stats vs JOIN destinations d ON vs.destination_id = d.destination_id WHERE DATE_TRUNC('month', vs.visit_date) = DATE_TRUNC('month', vs.visit_date) AND (vs.visit_date = (SELECT MIN(visit_date) FROM visitor_stats WHERE DATE_TRUNC('month', visit_date...
What is the maximum installed capacity (in MW) of renewable energy projects in the 'europe' region, partitioned by country?
CREATE TABLE renewable_energy_projects (id INT,country VARCHAR(50),region VARCHAR(50),capacity FLOAT); INSERT INTO renewable_energy_projects (id,country,region,capacity) VALUES (1,'Germany','europe',3000.00),(2,'France','europe',2500.00),(3,'Spain','europe',3500.00);
SELECT region, country, MAX(capacity) as max_capacity FROM renewable_energy_projects WHERE region = 'europe' GROUP BY country, region;
What is the maximum number of assists by a single player in a hockey game in the 'hockey_games' table?
CREATE TABLE hockey_games (id INT,home_team VARCHAR(50),away_team VARCHAR(50),date DATE,assists_home INT,assists_away INT); INSERT INTO hockey_games (id,home_team,away_team,date,assists_home,assists_away) VALUES (1,'Montreal Canadiens','Toronto Maple Leafs','2022-03-01',5,2); INSERT INTO hockey_games (id,home_team,away...
SELECT MAX(GREATEST(assists_home, assists_away)) FROM hockey_games;
What is the total donation amount for each organization?
CREATE TABLE org_donation (org_id INT,donation_id INT,donation_amount INT); INSERT INTO org_donation (org_id,donation_id,donation_amount) VALUES (1,1,500),(1,2,750),(2,3,1000),(3,4,250),(4,5,300);
SELECT org_id, SUM(donation_amount) as total_donations FROM org_donation GROUP BY org_id;
Delete an employee record from the 'employees' table
CREATE TABLE employees (id INT PRIMARY KEY,first_name VARCHAR(50),last_name VARCHAR(50),department VARCHAR(50),hire_date DATE);
DELETE FROM employees WHERE id = 101;
List all cases where the client is from the state of 'California' and the case is still open.
CREATE TABLE cases (case_id INT,client_state VARCHAR(20),close_date DATE); INSERT INTO cases (case_id,client_state,close_date) VALUES (1,'California',NULL),(2,'Texas','2022-05-15'),(3,'California','2022-02-28');
SELECT case_id, client_state, close_date FROM cases WHERE client_state = 'California' AND close_date IS NULL;
What is the total quantity of each strain sold in 'dispensary_sales' table?
CREATE TABLE dispensary_sales (id INT,strain VARCHAR(255),quantity INT,revenue FLOAT);
SELECT strain, SUM(quantity) as total_quantity FROM dispensary_sales GROUP BY strain;
What are the top 3 infectious diseases by number of cases, and which countries have the highest incidence rates?
CREATE TABLE InfectiousDiseases (Country VARCHAR(255),Disease VARCHAR(255),Cases DECIMAL(10,2)); INSERT INTO InfectiousDiseases (Country,Disease,Cases) VALUES ('Country A','Disease A',1200.00),('Country A','Disease B',800.00),('Country A','Disease C',500.00),('Country B','Disease A',1500.00),('Country B','Disease B',90...
SELECT Disease, SUM(Cases) AS TotalCases FROM InfectiousDiseases GROUP BY Disease ORDER BY TotalCases DESC LIMIT 3; SELECT Country, IncidenceRate FROM IncidenceRates WHERE IncidenceRate IN (SELECT MAX(IncidenceRate) FROM IncidenceRates) ORDER BY Country;
Add a new product type to the Policy table.
CREATE TABLE Policy (PolicyID INT,PolicyholderID INT,Product VARCHAR(10)); INSERT INTO Policy (PolicyID,PolicyholderID,Product) VALUES (1,1,'Auto'),(2,1,'Auto'),(3,2,'Home'),(4,3,'Auto'),(5,4,'Home'),(6,4,'Home');
ALTER TABLE Policy ADD COLUMN Product2 VARCHAR(10); UPDATE Policy SET Product2 = 'Motorcycle';
Which AI safety research papers were published in the last 3 years, ordered by the number of authors in descending order?
CREATE TABLE research_papers (title VARCHAR(255),publication_year INT,authors INT); INSERT INTO research_papers (title,publication_year,authors) VALUES ('Paper1',2020,4),('Paper2',2021,3),('Paper3',2019,2),('Paper4',2022,5);
SELECT title FROM (SELECT title, ROW_NUMBER() OVER (ORDER BY authors DESC) as rn FROM research_papers WHERE publication_year >= YEAR(CURRENT_DATE) - 3) t WHERE rn <= 10;
What is the total assets under management (AUM) for each investment strategy?
CREATE TABLE investment_strategies (strategy_id INT,strategy_name VARCHAR(50),AUM DECIMAL(10,2)); INSERT INTO investment_strategies (strategy_id,strategy_name,AUM) VALUES (1,'Equity',5000000.00),(2,'Bond',3000000.00),(3,'Real Estate',7000000.00);
SELECT strategy_name, SUM(AUM) FROM investment_strategies GROUP BY strategy_name;
List the graduate students who have not published any research in the past year.
CREATE TABLE GraduateStudentPublications(StudentID INT,PublicationDate DATE); INSERT INTO GraduateStudentPublications (StudentID,PublicationDate) VALUES (1,'2021-01-01'),(2,'2020-01-01');
SELECT g.StudentID, g.Name FROM GraduateStudents g LEFT JOIN GraduateStudentPublications p ON g.StudentID = p.StudentID WHERE p.PublicationDate IS NULL AND YEAR(p.PublicationDate) = YEAR(CURRENT_DATE()) - 1;
Identify the average development cost of biosensors launched in Asia.
CREATE TABLE biosensor_development (name TEXT,cost FLOAT,launch_location TEXT); INSERT INTO biosensor_development (name,cost,launch_location) VALUES ('BioSensor1',25000,'Tokyo'); INSERT INTO biosensor_development (name,cost,launch_location) VALUES ('BioSensor2',30000,'Seoul');
SELECT AVG(cost) FROM biosensor_development WHERE launch_location = 'Asia';