instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Find the average age of trees in the 'young_forest' table.
CREATE TABLE young_forest (id INT,species VARCHAR(50),age INT);
SELECT AVG(age) FROM young_forest;
What is the average caseload per parole officer, partitioned by region, for the year 2020?
CREATE TABLE parole_officers (officer_id INT,region VARCHAR(255),cases_assigned INT,case_year INT); INSERT INTO parole_officers (officer_id,region,cases_assigned,case_year) VALUES (1,'Northeast',35,2020),(2,'Northeast',28,2020),(3,'Southeast',45,2020),(4,'Southeast',32,2020);
SELECT region, AVG(cases_assigned) avg_cases FROM (SELECT officer_id, region, cases_assigned, case_year, ROW_NUMBER() OVER (PARTITION BY region ORDER BY case_year DESC) rn FROM parole_officers WHERE case_year = 2020) x WHERE rn = 1 GROUP BY region;
Find the top 3 recipients of grants in the 'grants' table by the grant amount in descending order, and display their names, regions, and grant amounts.
CREATE TABLE grants (grant_id INT,recipient_name VARCHAR(255),region VARCHAR(255),grant_amount FLOAT); INSERT INTO grants (grant_id,recipient_name,region,grant_amount) VALUES (1,'Organization A','North',20000),(2,'Organization B','South',15000),(3,'Organization C','East',25000),(4,'Organization A','North',18000);
SELECT recipient_name, region, grant_amount FROM (SELECT recipient_name, region, grant_amount, ROW_NUMBER() OVER (ORDER BY grant_amount DESC) as rank FROM grants) AS subquery WHERE rank <= 3;
How many safety incidents were reported per vessel in the last year?
CREATE TABLE vessels (id INT,name VARCHAR(255),imo INT); CREATE TABLE incidents (id INT,vessel_id INT,incident_date DATE,incident_type VARCHAR(255));
SELECT v.name, COUNT(i.id) as num_incidents FROM incidents i JOIN vessels v ON i.vessel_id = v.id WHERE i.incident_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY v.name;
Get the total quantity of sustainable seafood products
CREATE TABLE products (id INT,name VARCHAR(50),is_sustainable BOOLEAN,category VARCHAR(50),quantity INT); INSERT INTO products (id,name,is_sustainable,category,quantity) VALUES (1,'Tuna',TRUE,'Seafood',300),(2,'Beef',FALSE,'Meat',500),(3,'Salmon',TRUE,'Seafood',400);
SELECT SUM(quantity) FROM products WHERE is_sustainable = TRUE AND category = 'Seafood';
What is the average points scored by player 'Lebron James' in the 'NBA'?
CREATE TABLE players (player_id INT,player_name TEXT,position TEXT,team TEXT,league TEXT); INSERT INTO players (player_id,player_name,position,team,league) VALUES (1,'Lebron James','Forward','Los Angeles Lakers','NBA'); CREATE TABLE games (game_id INT,player_id INT,points INT); INSERT INTO games (game_id,player_id,poin...
SELECT AVG(points) FROM games JOIN players ON games.player_id = players.player_id WHERE players.player_name = 'Lebron James' AND players.league = 'NBA';
What is the average waste generated per garment by manufacturer 'ABC Clothing'?
CREATE TABLE waste (waste_id INT,waste_amount FLOAT,garment_id INT,manufacturer VARCHAR(20)); INSERT INTO waste (waste_id,waste_amount,garment_id,manufacturer) VALUES (1,2.5,1001,'ABC Clothing'),(2,3.0,1002,'XYZ Fashion');
SELECT AVG(waste_amount) FROM waste WHERE manufacturer = 'ABC Clothing';
What is the average temperature recorded by IoT sensors in vineyards located in France?
CREATE TABLE vineyard_sensors (vineyard_id INT,sensor_id INT,temperature DECIMAL(5,2),reading_date DATE); INSERT INTO vineyard_sensors (vineyard_id,sensor_id,temperature,reading_date) VALUES (1,101,22.5,'2021-07-01'),(1,101,23.2,'2021-07-02'),(2,102,19.8,'2021-07-01'),(2,102,20.3,'2021-07-02'); CREATE TABLE vineyards (...
SELECT AVG(temperature) FROM vineyard_sensors JOIN vineyards ON vineyard_sensors.vineyard_id = vineyards.vineyard_id WHERE vineyards.country = 'France';
display the percentage of the arctic that is covered by glaciers
CREATE TABLE glaciers (glacier_id INT PRIMARY KEY,glacier_name TEXT,area REAL); INSERT INTO glaciers (glacier_id,glacier_name,area) VALUES (1,'Glacier A',1234.56);
SELECT (SUM(area) / (SELECT SUM(area) FROM glaciers) * 100) AS percentage FROM glaciers;
List all geopolitical risk assessments for the Middle East region in the last 3 years.
CREATE TABLE geopolitical_risk_assessments (id INT,region VARCHAR(255),assessment_date DATE,assessment_text TEXT); INSERT INTO geopolitical_risk_assessments (id,region,assessment_date,assessment_text) VALUES (1,'Middle East','2018-01-01','Assessment 1'); INSERT INTO geopolitical_risk_assessments (id,region,assessment_d...
SELECT * FROM geopolitical_risk_assessments WHERE region = 'Middle East' AND assessment_date >= DATE_SUB(CURDATE(), INTERVAL 3 YEAR);
Update the 'Northern Lights' production record from May 15, 2021 to 8.2 units.
CREATE TABLE Production (id INT,strain VARCHAR(255),produced_date DATE,weight FLOAT); INSERT INTO Production (id,strain,produced_date,weight) VALUES (1,'Northern Lights','2021-05-15',10.3);
UPDATE Production SET weight = 8.2 WHERE strain = 'Northern Lights' AND produced_date = '2021-05-15';
What is the average social impact score by region?
CREATE TABLE social_impact_data (id INT,region VARCHAR(50),score INT); INSERT INTO social_impact_data (id,region,score) VALUES (1,'Northeast',80),(2,'Southeast',85),(3,'Midwest',75),(4,'West',90);
SELECT region, AVG(score) as avg_score FROM social_impact_data GROUP BY region;
Find the number of escalators at each station on the Green Line.
CREATE TABLE Escalators (station VARCHAR(20),line VARCHAR(20),escalators INTEGER); INSERT INTO Escalators (station,line,escalators) VALUES ('Kenmore','Green Line',3),('Northeastern','Green Line',2);
SELECT station, escalators FROM Escalators WHERE line = 'Green Line';
List the top 3 brands with the highest average cruelty-free product price.
CREATE TABLE prices (id INT,brand VARCHAR(255),is_cruelty_free BOOLEAN,price DECIMAL(10,2)); INSERT INTO prices (id,brand,is_cruelty_free,price) VALUES (1,'Lush',true,25.99),(2,'NYX',false,12.99),(3,'Lush',true,34.99),(4,'Burt’s Bees',true,15.99),(5,'Tarte',true,28.99),(6,'Urban Decay',false,21.99);
SELECT brand, AVG(price) FROM prices WHERE is_cruelty_free = true GROUP BY brand ORDER BY AVG(price) DESC LIMIT 3;
Update the location of the inventory with id 1 in the "inventory" table to "Warehouse 2"
CREATE TABLE inventory (id INT PRIMARY KEY,product_id INT,quantity INT,location VARCHAR(50)); INSERT INTO inventory (id,product_id,quantity,location) VALUES (1,1,100,'Warehouse 1'),(2,2,50,'Warehouse 2');
UPDATE inventory SET location = 'Warehouse 2' WHERE id = 1;
What is the total number of artworks in the modern and contemporary categories?
CREATE TABLE Artworks (category VARCHAR(20),quantity INT); INSERT INTO Artworks (category,quantity) VALUES ('Modern',1200),('Modern',1500),('Contemporary',800),('Contemporary',900);
SELECT SUM(quantity) FROM Artworks WHERE category IN ('Modern', 'Contemporary');
Find the top 3 countries with the highest number of accessible classrooms.
CREATE TABLE classrooms (id INT,country VARCHAR(50),num_accessible INT); INSERT INTO classrooms (id,country,num_accessible) VALUES (1,'USA',500),(2,'Canada',300),(3,'Mexico',200),(4,'Brazil',400),(5,'Argentina',350);
SELECT country, num_accessible, ROW_NUMBER() OVER (ORDER BY num_accessible DESC) as rank FROM classrooms WHERE num_accessible > 0 GROUP BY country HAVING rank <= 3;
What is the difference in average age between male and female community health workers, by state?
CREATE TABLE CommunityHealthWorkers (WorkerID INT,Age INT,Gender VARCHAR(10),State VARCHAR(20)); INSERT INTO CommunityHealthWorkers (WorkerID,Age,Gender,State) VALUES (1,34,'Female','California'),(2,42,'Male','Texas'),(3,50,'Female','California'),(4,48,'Non-binary','New York');
SELECT State, AVG(CASE WHEN Gender = 'Male' THEN Age END) - AVG(CASE WHEN Gender = 'Female' THEN Age END) as AgeDifference FROM CommunityHealthWorkers GROUP BY State;
What is the average temperature change in the Arctic each decade?
CREATE TABLE ArcticTemperatureChange(decade INT,temperature_change FLOAT);INSERT INTO ArcticTemperatureChange(decade,temperature_change) VALUES(1980,0.5),(1990,1.0),(2000,1.5),(2010,2.0);
SELECT decade, AVG(temperature_change) FROM ArcticTemperatureChange GROUP BY decade;
What are the renewable energy projects in the United States and their respective capacities in MW?
CREATE TABLE renewable_projects (project_name VARCHAR(255),country VARCHAR(255),capacity INT);
SELECT project_name, capacity FROM renewable_projects WHERE country = 'United States';
Delete vessels with no safety incidents from the Vessels table.
CREATE TABLE Vessels (ID INT,Name VARCHAR(50),Type VARCHAR(50)); CREATE TABLE SafetyIncidents (ID INT,VesselID INT,Location VARCHAR(50),IncidentType VARCHAR(50)); INSERT INTO SafetyIncidents (ID,VesselID,Location,IncidentType) VALUES (1,1,'Mediterranean Sea','Collision'); INSERT INTO SafetyIncidents (ID,VesselID,Locati...
DELETE v FROM Vessels v LEFT JOIN SafetyIncidents si ON v.ID = si.VesselID WHERE si.ID IS NULL;
Count the number of users who prefer each product category, for products that include natural ingredients, partitioned by product category.
CREATE TABLE ProductPreferences (UserID INT,PreferredCategory VARCHAR(50),PreferredProduct VARCHAR(50),PreferredIngredients VARCHAR(255)); INSERT INTO ProductPreferences (UserID,PreferredCategory,PreferredProduct,PreferredIngredients) VALUES (1,'Skincare','Ginzing Energy-Boosting Gel Moisturizer','Water,Glycerin,Natura...
SELECT PreferredCategory, PreferredProduct, PreferredIngredients, COUNT(*) OVER (PARTITION BY PreferredCategory) as 'CategoryPopularity' FROM ProductPreferences WHERE PreferredIngredients LIKE '%Natural%';
What is the 3-month moving average of AI safety papers published by institution?
CREATE TABLE safety_paper (id INT,title VARCHAR(255),institution VARCHAR(255),publication_date DATE); INSERT INTO safety_paper (id,title,institution,publication_date) VALUES (1,'Safe AI Systems','MIT','2021-05-15'),(2,'Robust AI Design','Stanford University','2020-08-23'),(3,'Secure AI Development','Oxford University',...
SELECT institution, AVG(COUNT(*)) OVER (PARTITION BY institution ORDER BY MIN(publication_date) ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) as moving_avg FROM safety_paper GROUP BY institution, publication_date ORDER BY publication_date;
How many security incidents were reported by each department in the past year?
CREATE TABLE security_incidents (id INT,department VARCHAR,date DATE); INSERT INTO security_incidents (id,department,date) VALUES (1,'IT','2021-01-01'),(2,'HR','2021-02-01'),(3,'Finance','2021-03-01'),(4,'Marketing','2021-04-01'),(5,'Sales','2021-05-01');
SELECT department, COUNT(*) FROM security_incidents WHERE date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY department;
What is the total number of military vehicles by manufacturer, for contracts awarded in the last 6 months?
CREATE TABLE contracts (id INT,equipment_type VARCHAR(255),manufacturer VARCHAR(255),quantity INT,contract_value FLOAT,contract_date DATE); INSERT INTO contracts (id,equipment_type,manufacturer,quantity,contract_value,contract_date) VALUES (1,'Tank','General Dynamics',50,10000000,'2022-01-01'); INSERT INTO contracts (i...
SELECT manufacturer, SUM(quantity) as total_quantity FROM contracts WHERE contract_date >= DATEADD(month, -6, GETDATE()) GROUP BY manufacturer;
What was the total revenue generated by 'Red Defense' in the last month?
CREATE TABLE Sales(id INT,seller VARCHAR(255),buyer VARCHAR(255),equipment VARCHAR(255),quantity INT,sale_price DECIMAL(10,2),sale_date DATE);
SELECT SUM(quantity * sale_price) FROM Sales WHERE seller = 'Red Defense' AND sale_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH);
What is the minimum salary in the IT department?
CREATE TABLE employees (id INT,name VARCHAR(50),department VARCHAR(50),salary FLOAT); INSERT INTO employees (id,name,department,salary) VALUES (1,'John Doe','IT',85000.00),(2,'Jane Smith','IT',88000.00);
SELECT MIN(salary) FROM employees WHERE department = 'IT';
How many rides started between 6-7 AM for each system in May 2022?
CREATE TABLE trips (trip_id INT,trip_start_time DATETIME,trip_end_time DATETIME,system_name VARCHAR(20));
SELECT system_name, COUNT(*) FROM trips WHERE trip_start_time BETWEEN '2022-05-01 06:00:00' AND '2022-05-31 07:00:00' GROUP BY system_name;
What is the average concert attendance for all concerts in 2022?
CREATE TABLE Venues (VenueID INT,VenueName VARCHAR(100),Country VARCHAR(50),Capacity INT); INSERT INTO Venues VALUES (10,'Venue X','United States',15000),(11,'Venue Y','Canada',20000),(12,'Venue Z','Mexico',12000);
SELECT AVG(Attendees) FROM Concerts WHERE ConcertDate >= '2022-01-01' AND ConcertDate < '2023-01-01';
What is the total funding raised by startups with at least one female founder and headquartered in Oceania?
CREATE TABLE funding (id INT,company_id INT,investment_round TEXT,amount INT,date DATE); INSERT INTO funding (id,company_id,investment_round,amount,date) VALUES (1,1,'Seed',1000000,'2020-01-01'),(2,2,'Series A',5000000,'2021-01-01'),(3,3,'Seed',2000000,'2019-01-01');
SELECT SUM(funding.amount) FROM funding JOIN companies ON funding.company_id = companies.id WHERE funding.investment_round != 'Pre-seed' AND companies.founder_gender = 'Female' AND companies.location = 'Oceania';
Delete all records from 'mine_sites' table where 'region' is 'Appalachian'
CREATE TABLE mine_sites (site_id INT PRIMARY KEY,site_name VARCHAR(255),region VARCHAR(255));
DELETE FROM mine_sites WHERE region = 'Appalachian';
What is the total waste generated for each ingredient?
CREATE TABLE waste (ingredient VARCHAR(255),quantity INT); INSERT INTO waste VALUES ('Garlic',50); INSERT INTO waste VALUES ('Tomatoes',200); CREATE TABLE ingredient_uses (ingredient VARCHAR(255),dish VARCHAR(255)); INSERT INTO ingredient_uses VALUES ('Garlic','Bruschetta'); INSERT INTO ingredient_uses VALUES ('Tomatoe...
SELECT i.ingredient, SUM(w.quantity) AS total_waste FROM waste w INNER JOIN ingredient_uses u ON w.ingredient = u.ingredient GROUP BY i.ingredient;
Which local stores carry eco-friendly cleaning products and what are their current stock levels?
CREATE TABLE stores (id INT,name VARCHAR(50),city VARCHAR(50),region VARCHAR(50)); CREATE TABLE store_inventory (store_id INT,product_id INT,quantity INT); CREATE TABLE products (id INT,name VARCHAR(50),category VARCHAR(50),eco_friendly BOOLEAN);
SELECT stores.name AS store_name, products.name AS product_name, store_inventory.quantity FROM stores JOIN store_inventory ON stores.id = store_inventory.store_id JOIN products ON store_inventory.product_id = products.id WHERE products.eco_friendly = TRUE;
Show all records from the 'top_ethical_companies' view
CREATE VIEW top_ethical_companies AS SELECT company_name,ethical_certification FROM ethical_manufacturing ORDER BY ethical_certification DESC LIMIT 5;
SELECT * FROM top_ethical_companies;
What is the number of unique donors for each cause, with a grand total row?
CREATE TABLE donors (donor_id INT,donor_name VARCHAR(255),donation_date DATE,cause VARCHAR(255)); INSERT INTO donors (donor_id,donor_name,donation_date,cause) VALUES (1,'John Doe','2022-01-01','Education'); INSERT INTO donors (donor_id,donor_name,donation_date,cause) VALUES (2,'Jane Smith','2022-01-15','Health'); INSER...
SELECT cause, COUNT(DISTINCT donor_id) AS num_unique_donors FROM donors GROUP BY cause WITH ROLLUP;
Count the number of mental health parity violations in the 'MentalHealthParity' table, where the violation type is 'Financial' and the year is 2020.
CREATE TABLE MentalHealthParity (ViolationID INT,ViolationType VARCHAR(255),ViolationYear INT);
SELECT COUNT(*) as FinancialViolations2020 FROM MentalHealthParity WHERE ViolationType = 'Financial' AND ViolationYear = 2020;
Calculate the average energy efficiency rating for projects in Spain
CREATE TABLE energy_efficiency (project_id INT,name VARCHAR(50),location VARCHAR(50),rating FLOAT); INSERT INTO energy_efficiency (project_id,name,location,rating) VALUES (1,'Spain Project 1','Spain',80.0);
SELECT AVG(rating) FROM energy_efficiency WHERE location = 'Spain';
Delete all records from the 'inspections' table where the 'grade' is 'A'
CREATE TABLE inspections (id INT,restaurant_name TEXT,grade TEXT,inspection_date DATE);
DELETE FROM inspections WHERE grade = 'A';
Determine the percentage of microloans in the 'microfinance' schema's 'loans' table that are disbursed to female borrowers.
CREATE TABLE microfinance.loans (loan_id INT,loan_type VARCHAR(20),borrower_gender VARCHAR(10)); INSERT INTO microfinance.loans (loan_id,loan_type,borrower_gender) VALUES (1,'microloan','female'),(2,'small_business','male'),(3,'microloan','male'),(4,'microloan','female'),(5,'small_business','female');
SELECT 100.0 * COUNT(*) FILTER (WHERE loan_type = 'microloan' AND borrower_gender = 'female') / COUNT(*) FILTER (WHERE loan_type = 'microloan') FROM microfinance.loans;
Which climate mitigation projects have the highest investment amounts in Europe?
CREATE TABLE climate_investments (project_name VARCHAR(255),type VARCHAR(255),investment_amount INT); INSERT INTO climate_investments (project_name,type,investment_amount) VALUES ('Hydroelectric Power Plant','Mitigation',5000000),('Carbon Capture','Mitigation',4000000),('Smart Grid','Mitigation',3000000);
SELECT project_name, investment_amount FROM climate_investments WHERE type = 'Mitigation' ORDER BY investment_amount DESC;
How many professional development workshops did each teacher attend?
CREATE TABLE teacher_pd (teacher_id INT,workshop_id INT); INSERT INTO teacher_pd (teacher_id,workshop_id) VALUES (1,101),(1,102),(2,101),(3,102),(3,103);
SELECT teacher_id, COUNT(*) OVER (PARTITION BY teacher_id) AS workshops_attended FROM teacher_pd;
Who are the patients that received both CBT and medication?
CREATE TABLE patients (id INT,name TEXT,age INT,treatment TEXT); INSERT INTO patients (id,name,age,treatment) VALUES (1,'John Doe',35,'CBT'),(2,'Jane Smith',40,'Medication'),(3,'Bob Johnson',50,'CBT,Medication');
SELECT name FROM patients WHERE treatment LIKE '%CBT%' AND treatment LIKE '%Medication%';
Find the total number of games played in Ligue 1 where the home team won, for the 2020-2021 season.
CREATE TABLE Ligue_1_Matches (Season VARCHAR(50),HomeTeam VARCHAR(50),AwayTeam VARCHAR(50),HomeTeamScore INT,AwayTeamScore INT); INSERT INTO Ligue_1_Matches (Season,HomeTeam,AwayTeam,HomeTeamScore,AwayTeamScore) VALUES ('2020-2021','Paris Saint-Germain','Olympique Marseille',3,0);
SELECT SUM(HomeTeamScore > AwayTeamScore) FROM Ligue_1_Matches WHERE Season = '2020-2021';
What is the percentage of fair trade garments in each production country?
CREATE TABLE EthicalFashion.FairTradeGarments (garment_id INT,is_fair_trade BOOLEAN,production_country VARCHAR(20)); INSERT INTO EthicalFashion.FairTradeGarments (garment_id,is_fair_trade,production_country) VALUES (1,true,'Bangladesh'),(2,false,'Ethiopia'),(3,true,'Peru');
SELECT production_country, COUNT(*) FILTER (WHERE is_fair_trade = true) * 100.0 / COUNT(*) AS fair_trade_percentage FROM EthicalFashion.FairTradeGarments GROUP BY production_country;
What is the percentage of uninsured individuals in Houston, TX in 2020?
CREATE TABLE HealthInsurance (ID INT,Insured BOOLEAN,Age INT,City VARCHAR(50),Year INT); INSERT INTO HealthInsurance (ID,Insured,Age,City,Year) VALUES (1,FALSE,30,'Houston',2020); INSERT INTO HealthInsurance (ID,Insured,Age,City,Year) VALUES (2,TRUE,40,'Houston',2020);
SELECT (SUM(Insured = FALSE) * 100.0 / COUNT(*)) FROM HealthInsurance WHERE City = 'Houston' AND Year = 2020;
Show the average digital literacy rate for countries in Southeast Asia, South Asia, and the Middle East with a population of over 50 million in 2020.
CREATE TABLE digital_literacy (country_name VARCHAR(50),region VARCHAR(20),population INT,literacy_rate DECIMAL(5,2),year INT);INSERT INTO digital_literacy (country_name,region,population,literacy_rate,year) VALUES ('India','South Asia',1380000000,0.68,2020),('Indonesia','Southeast Asia',273500000,0.52,2020),('Pakistan...
SELECT AVG(literacy_rate) FROM digital_literacy WHERE year = 2020 AND population > 50000000 AND region IN ('Southeast Asia', 'South Asia', 'Middle East');
What is the highest number of goals scored by a single player in a single soccer match?
CREATE TABLE matches (id INT,team1 TEXT,team2 TEXT,goals1 INT,goals2 INT,match_date DATE); INSERT INTO matches (id,team1,team2,goals1,goals2,match_date) VALUES (1,'Real Madrid','Barcelona',4,2,'2021-10-25'),(2,'Manchester United','Liverpool',1,3,'2022-02-20');
SELECT MAX(GREATEST(goals1, goals2)) FROM matches;
List the top 3 chemicals with the highest waste generation in the 'Central' plant in 2022.
CREATE TABLE waste_chemicals (plant varchar(10),year int,chemical varchar(20),waste_amount int); INSERT INTO waste_chemicals (plant,year,chemical,waste_amount) VALUES ('North Plant',2022,'Chemical A',50),('North Plant',2022,'Chemical B',75),('Central Plant',2022,'Chemical C',100),('Central Plant',2022,'Chemical D',120)...
SELECT chemical, SUM(waste_amount) as total_waste FROM waste_chemicals WHERE plant = 'Central Plant' GROUP BY chemical ORDER BY total_waste DESC LIMIT 3;
Insert new records for 3 additional organizations in the 'Southeast' region.
CREATE TABLE organizations (id INT,name TEXT,region TEXT); INSERT INTO organizations (id,name,region) VALUES (1,'Doctors Without Borders','Southwest'),(2,'Habitat for Humanity Chicago','Midwest');
INSERT INTO organizations (id, name, region) VALUES (3, 'Atlanta Community Food Bank', 'Southeast'), (4, 'Habitat for Humanity Atlanta', 'Southeast'), (5, 'Southeast Habitat for Humanity', 'Southeast');
Update the 'national_security_advisors' table to set the 'advisor_status' to 'Inactive' for advisors who have been serving for more than 10 years
CREATE TABLE national_security_advisors (id INT,name VARCHAR(20),service_years INT,advisor_status VARCHAR(10)); INSERT INTO national_security_advisors (id,name,service_years,advisor_status) VALUES (1,'Oliver',12,'Active'),(2,'Pamela',5,'Active'),(3,'Quentin',8,'Active');
UPDATE national_security_advisors SET advisor_status = 'Inactive' WHERE service_years > 10;
What is the total number of employees in each department?
CREATE TABLE Employees (EmployeeID INT,Department VARCHAR(20)); INSERT INTO Employees (EmployeeID,Department) VALUES (1,'IT'),(2,'IT'),(3,'Finance'),(4,'Marketing'),(5,'IT'),(6,'Finance');
SELECT Department, COUNT(*) FROM Employees GROUP BY Department;
What is the total revenue for the month of February 2022?
CREATE TABLE sales_data_4 (sale_id INT,location_id INT,item_id INT,quantity_sold INT,sale_price DECIMAL(5,2),sale_date DATE); INSERT INTO sales_data_4 (sale_id,location_id,item_id,quantity_sold,sale_price,sale_date) VALUES (1,1,1,5,15.99,'2022-02-05'),(2,2,2,10,12.99,'2022-02-07');
SELECT SUM(quantity_sold * sale_price) FROM sales_data_4 WHERE EXTRACT(MONTH FROM sale_date) = 2 AND EXTRACT(YEAR FROM sale_date) = 2022;
What is the total number of cases handled by restorative justice programs in Washington and Oregon?
CREATE TABLE restorative_justice_wa (case_id INT,state VARCHAR(20)); INSERT INTO restorative_justice_wa VALUES (1,'Washington'),(2,'Washington'),(3,'Washington'); CREATE TABLE restorative_justice_or (case_id INT,state VARCHAR(20)); INSERT INTO restorative_justice_or VALUES (4,'Oregon'),(5,'Oregon');
SELECT COUNT(*) FROM restorative_justice_wa UNION ALL SELECT COUNT(*) FROM restorative_justice_or;
What are the total sales for each garment type in Q1 2022?
CREATE TABLE sales (sale_id INT,garment_type VARCHAR(50),sale_date DATE,total_sales DECIMAL(10,2));
SELECT garment_type, SUM(total_sales) FROM sales WHERE sale_date BETWEEN '2022-01-01' AND '2022-03-31' GROUP BY garment_type;
Calculate the average production from wells in the North Sea
CREATE TABLE wells (id INT,well_name VARCHAR(100),location VARCHAR(50),status VARCHAR(20),production FLOAT); INSERT INTO wells VALUES (1,'Well A','North Sea','Producing',1000.5); INSERT INTO wells VALUES (2,'Well B','Gulf of Mexico','Abandoned',1200.3); INSERT INTO wells VALUES (3,'Well C','Gulf of Mexico','Producing',...
SELECT AVG(production) FROM wells WHERE location = 'North Sea';
What is the total quantity of sustainable textiles used in the production of clothing in Africa?
CREATE TABLE production (sustainable BOOLEAN,quantity INT); INSERT INTO production (sustainable,quantity) VALUES (true,4000),(false,2000);
SELECT SUM(quantity) FROM production WHERE sustainable = true;
Delete all records of hospitals located in the state of New York.
CREATE TABLE hospitals (id INT,state VARCHAR(255),name VARCHAR(255)); INSERT INTO hospitals (id,state,name) VALUES (1,'California','Hospital A'); INSERT INTO hospitals (id,state,name) VALUES (2,'New York','Hospital B'); INSERT INTO hospitals (id,state,name) VALUES (3,'Texas','Clinic C');
DELETE FROM hospitals WHERE state = 'New York';
How many virtual tours were conducted in Japan in the past month?
CREATE TABLE virtual_tours (tour_id INT,tour_name TEXT,country TEXT,tour_date DATE); INSERT INTO virtual_tours (tour_id,tour_name,country,tour_date) VALUES (1,'Mt. Fuji Tour','Japan','2022-03-05'),(2,'Tokyo City Tour','Japan','2022-03-10');
SELECT COUNT(*) FROM virtual_tours WHERE country = 'Japan' AND tour_date >= DATEADD(day, -30, CURRENT_DATE);
Identify the number of students who received accommodations in the last 3 years, grouped by the type of accommodation and their ethnicity, and show the top 5 most common combinations?
CREATE TABLE students (student_id INT,student_name VARCHAR(255),ethnicity VARCHAR(255),accommodation_date DATE);
SELECT a.accommodation_type, s.ethnicity, COUNT(*) as accommodation_count FROM students s JOIN (SELECT EXTRACT(YEAR FROM accommodation_date) as accommodation_year, accommodation_type FROM accommodations WHERE accommodation_date >= DATEADD(year, -3, CURRENT_DATE)) a ON s.student_id = a.student_id GROUP BY a.accommodatio...
What percentage of workplace safety incidents in each state are related to falls?
CREATE TABLE safety_reports (report_id INT,state VARCHAR(2),incident_type VARCHAR(15)); INSERT INTO safety_reports (report_id,state,incident_type) VALUES (1,'NY','Fall'),(2,'CA','Electrocution'),(3,'IL','Fall');
SELECT state, 100.0 * COUNT(*) / (SELECT COUNT(*) FROM safety_reports WHERE state = sr.state) as pct_falls FROM safety_reports sr WHERE incident_type = 'Fall' GROUP BY state;
What is the total number of cases heard by alternative dispute resolution mechanisms in New York city for the year 2020?
CREATE TABLE cases (case_id INT,case_type VARCHAR(20),location VARCHAR(20),year INT); INSERT INTO cases (case_id,case_type,location,year) VALUES (1,'mediation','New York',2020);
SELECT COUNT(*) FROM cases WHERE case_type = 'alternative dispute resolution' AND location = 'New York' AND year = 2020;
What is the number of volunteers and total volunteer hours for each program?
CREATE TABLE volunteers (volunteer_id INT,program_id VARCHAR(20),hours INT); INSERT INTO volunteers (volunteer_id,program_id,hours) VALUES (1,'Education',50),(2,'Health',75),(3,'Education',100); CREATE TABLE donations (donor_id INT,program_id VARCHAR(20),amount DECIMAL(10,2)); INSERT INTO donations (donor_id,program_id...
SELECT program_id, COUNT(DISTINCT volunteer_id) AS num_volunteers, SUM(hours) AS total_hours FROM volunteers GROUP BY program_id;
How many unique users visited the website from each country?
CREATE TABLE user_visits (id INT,user_id INT,country VARCHAR(255)); INSERT INTO user_visits (id,user_id,country) VALUES
SELECT country, COUNT(DISTINCT user_id) as num_unique_users FROM user_visits GROUP BY country
What is the percentage of bookings made through OTA channels for each hotel?
CREATE TABLE hotels (hotel_id INT,hotel_name TEXT); INSERT INTO hotels (hotel_id,hotel_name) VALUES (1,'Hotel X'),(2,'Hotel Y'); CREATE TABLE bookings (booking_id INT,hotel_id INT,booking_channel TEXT); INSERT INTO bookings (booking_id,hotel_id,booking_channel) VALUES (1,1,'OTA'),(2,1,'Direct'),(3,2,'OTA');
SELECT hotels.hotel_name, (COUNT(CASE WHEN bookings.booking_channel = 'OTA' THEN 1 END) * 100.0 / COUNT(bookings.booking_channel)) AS percentage FROM hotels INNER JOIN bookings ON hotels.hotel_id = bookings.hotel_id GROUP BY hotels.hotel_name;
Find defense contracts awarded to companies in Texas
CREATE TABLE defense_contracts (contract_id INT,vendor_name VARCHAR(100),value FLOAT,contract_date DATE,vendor_state VARCHAR(2)); INSERT INTO defense_contracts (contract_id,vendor_name,value,contract_date,vendor_state) VALUES (1,'ABC Corporation',500000,'2020-01-01','TX'); INSERT INTO defense_contracts (contract_id,ven...
SELECT vendor_name, value FROM defense_contracts WHERE vendor_state = 'TX';
What is the average installed capacity (in MW) for hydro power projects in the state of Washington, grouped by project owner?
CREATE TABLE hydro_projects (id INT,project_name VARCHAR(255),state VARCHAR(255),project_owner VARCHAR(255),installed_capacity FLOAT);
SELECT project_owner, AVG(installed_capacity) FROM hydro_projects WHERE state = 'Washington' GROUP BY project_owner;
What is the sum of funding raised by companies founded by individuals who identify as LGBTQ+ and have their headquarters in New York City?
CREATE TABLE companies (id INT,name TEXT,founder_identity TEXT,city TEXT,state TEXT); CREATE TABLE funding_rounds (id INT,company_id INT,size INT);
SELECT SUM(funding_rounds.size) FROM companies INNER JOIN funding_rounds ON companies.id = funding_rounds.company_id WHERE companies.founder_identity = 'LGBTQ+' AND companies.city = 'New York' AND companies.state = 'NY';
What is the total revenue of organic products in the 'sales_data' table?
CREATE TABLE sales_data (id INT,product VARCHAR(30),price DECIMAL(5,2),is_organic BOOLEAN);
SELECT SUM(price * (CASE WHEN is_organic THEN 1 ELSE 0 END)) FROM sales_data;
List all the captains who have operated Container vessels in the last month, along with the number of dockings for each captain.
CREATE TABLE Captains (captain_name VARCHAR(50),captain_id INT); INSERT INTO Captains VALUES ('Captain Smith',1),('Captain Johnson',2),('Captain Lee',3),('Captain Garcia',4); CREATE TABLE CaptainVessels (captain_id INT,vessel_name VARCHAR(50),vessel_type VARCHAR(50)); INSERT INTO CaptainVessels VALUES (1,'Vessel A','Co...
SELECT C.captain_name, COUNT(CV.vessel_name) as dock_count FROM Captains C INNER JOIN CaptainVessels CV ON C.captain_id = CV.captain_id INNER JOIN Vessels V ON CV.vessel_name = V.vessel_name WHERE V.vessel_type = 'Container' AND V.last_dock_date >= DATEADD(WEEK, -1, GETDATE()) GROUP BY C.captain_name;
What is the average budget allocated per service category in the Infrastructure sector in 2018 and 2019?
CREATE TABLE InfrastructureBudget (Year INT,Service VARCHAR(20),Budget FLOAT); INSERT INTO InfrastructureBudget (Year,Service,Budget) VALUES (2018,'Roads',3000000),(2018,'Bridges',2500000),(2018,'Railways',3500000),(2019,'Roads',3200000),(2019,'Bridges',2800000),(2019,'Railways',3700000);
SELECT Service, AVG(Budget) as Avg_Budget FROM InfrastructureBudget GROUP BY Service;
What is the total length of all underwater cables in each ocean?
CREATE TABLE underwater_cables (cable_name TEXT,location TEXT,length FLOAT); INSERT INTO underwater_cables VALUES ('Trans-Atlantic Cable','Atlantic Ocean',6600),('Tasman Cable','Pacific Ocean',2300);
SELECT location, SUM(length) FROM underwater_cables GROUP BY location;
Which explainable AI techniques were used in the 'Healthcare' sector?
CREATE TABLE explainable_ai (sector TEXT,technique TEXT); INSERT INTO explainable_ai (sector,technique) VALUES ('Healthcare','SHAP'),('Finance','LIME'),('Education','Partial Dependence Plot');
SELECT technique FROM explainable_ai WHERE sector = 'Healthcare';
What is the average transaction value (in USD) for the Bitcoin network in the last week?
CREATE TABLE BitcoinTransactions (id INT,txid VARCHAR(100),value DECIMAL(20,2),timestamp BIGINT); INSERT INTO BitcoinTransactions (id,txid,value,timestamp) VALUES (1,'...',100,1643324480),(2,'...',200,1643410880);
SELECT AVG(value * (SELECT rate FROM ExchangeRates WHERE currency = 'BTC' AND timestamp = tx.timestamp)) as avg_value_usd FROM BitcoinTransactions tx WHERE timestamp >= UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK)) * 1000;
What is the average daily revenue, by genre, for the last 6 months?
CREATE TABLE genre_revenue (revenue_id INT,genre VARCHAR(255),revenue DECIMAL,revenue_date DATE); CREATE VIEW daily_genre_revenue AS SELECT genre,DATE_TRUNC('day',revenue_date) as date,AVG(revenue) as avg_daily_revenue FROM genre_revenue WHERE revenue_date >= DATEADD(day,-180,CURRENT_DATE) GROUP BY genre,date;
SELECT * FROM daily_genre_revenue;
What is the minimum age of athletes in the 'athletes' table?
CREATE TABLE athletes (athlete_id INT,name VARCHAR(50),age INT,sport VARCHAR(20)); INSERT INTO athletes (athlete_id,name,age,sport) VALUES (1,'John Doe',25,'Basketball'); INSERT INTO athletes (athlete_id,name,age,sport) VALUES (2,'Jane Smith',30,'Soccer');
SELECT MIN(age) FROM athletes;
What is the total climate finance provided by private investors in 2020?
CREATE TABLE climate_finance_data (id INT,investor_type VARCHAR(50),year INT,finance_amount DECIMAL); INSERT INTO climate_finance_data (id,investor_type,year,finance_amount) VALUES (1,'Private Investor 1',2020,5000000); INSERT INTO climate_finance_data (id,investor_type,year,finance_amount) VALUES (2,'Public Investor 1...
SELECT SUM(finance_amount) FROM climate_finance_data WHERE investor_type = 'Private Investor' AND year = 2020;
What is the total cybersecurity spending in the Americas?
CREATE TABLE CybersecuritySpending (region TEXT,budget INTEGER); INSERT INTO CybersecuritySpending (region,budget) VALUES ('USA',20000000),('Canada',5000000),('Brazil',3000000),('Mexico',2000000),('Argentina',1000000);
SELECT SUM(budget) FROM CybersecuritySpending WHERE region IN ('USA', 'Canada', 'Brazil', 'Mexico', 'Argentina');
What is the total number of naval equipment sales and their total cost for region X?
CREATE TABLE NavalEquipmentSales (sale_id INT,region VARCHAR(50),sale_price DECIMAL(10,2)); INSERT INTO NavalEquipmentSales (sale_id,region,sale_price) VALUES (1,'X',5000000.00); INSERT INTO NavalEquipmentSales (sale_id,region,sale_price) VALUES (2,'X',3000000.00);
SELECT region, COUNT(*) as total_sales, SUM(sale_price) as total_cost FROM NavalEquipmentSales WHERE region = 'X' GROUP BY region;
Count the number of male patients in the rural_hospitals table.
CREATE TABLE rural_hospitals (patient_id INT,age INT,gender VARCHAR(10),admission_date DATE);
SELECT COUNT(*) FROM rural_hospitals WHERE gender = 'Male';
What is the total cost of 'AccessibleDocumentTraining' events in the 'TrainingEvents' table?
CREATE TABLE TrainingEvents (event_id INT,event_name VARCHAR(255),cost DECIMAL(10,2)); INSERT INTO TrainingEvents (event_id,event_name,cost) VALUES (1001,'WebAccessibilityWorkshop',500.00),(1002,'AccessibleDocumentTraining',750.00),(1003,'ScreenReaderBasics',600.00);
SELECT SUM(cost) FROM TrainingEvents WHERE event_name = 'AccessibleDocumentTraining';
How many repeat visitors returned to our exhibits from the previous year?
CREATE TABLE visitors (id INT,visit_year INT,exhibit_id INT); INSERT INTO visitors (id,visit_year,exhibit_id) VALUES (1,2021,101),(2,2021,102),(3,2022,101),(4,2022,103),(5,2021,103);
SELECT COUNT(DISTINCT visitor_id) FROM (SELECT visitor_id, exhibit_id FROM visitors WHERE visit_year = 2021 INTERSECT SELECT visitor_id, exhibit_id FROM visitors WHERE visit_year = 2022) AS repeat_visitors;
How many mobile subscribers have made international calls in the Southeast region?
CREATE TABLE mobile_subscribers (subscriber_id INT,international_calls BOOLEAN,region VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id,international_calls,region) VALUES (1,TRUE,'Southeast'),(2,FALSE,'Northeast'),(3,FALSE,'Southeast');
SELECT COUNT(*) FROM mobile_subscribers WHERE international_calls = TRUE AND region = 'Southeast';
What is the total cost of all flood control projects in Florida?
CREATE TABLE projects (id INT,name TEXT,state TEXT,budget FLOAT); INSERT INTO projects (id,name,state,budget) VALUES (1,'FL-1 Floodgate Construction','FL',15000000);
SELECT SUM(budget) FROM projects WHERE state = 'FL' AND name LIKE '%Flood%';
What are the most common types of pollution in the Indian Ocean and their impact on marine life?
CREATE TABLE Pollution (pollution_type VARCHAR(50),impact_description TEXT,region VARCHAR(50),PRIMARY KEY(pollution_type)); INSERT INTO Pollution (pollution_type,impact_description,region) VALUES ('Oil Spills','Destruction of marine habitats and wildlife','Indian Ocean'),('Plastic Waste','Ingestion and entanglement of ...
SELECT Pollution.pollution_type, Pollution.impact_description FROM Pollution WHERE Pollution.region = 'Indian Ocean';
Who is the police officer with the longest average response time to emergency calls?
CREATE TABLE police_officers (officer_id INT,name VARCHAR(255),rank VARCHAR(255)); INSERT INTO police_officers (officer_id,name,rank) VALUES (1,'Maria Rodriguez','Sergeant'),(2,'Jamal Johnson','Officer'),(3,'Sophia Kim','Lieutenant'); CREATE TABLE emergency_calls (call_id INT,officer_id INT,response_time INT); INSERT I...
SELECT officer_id, name, AVG(response_time) as avg_response_time FROM emergency_calls ec JOIN police_officers po ON ec.officer_id = po.officer_id GROUP BY officer_id, name ORDER BY avg_response_time DESC LIMIT 1;
Identify the transaction date with the highest transaction amount for each customer.
CREATE TABLE transactions (transaction_date DATE,customer_id INT,transaction_amt DECIMAL(10,2)); INSERT INTO transactions (transaction_date,customer_id,transaction_amt) VALUES ('2022-01-01',1,200.00),('2022-01-02',2,300.50),('2022-01-03',3,150.25);
SELECT transaction_date, customer_id, transaction_amt, RANK() OVER (PARTITION BY customer_id ORDER BY transaction_amt DESC) AS rank FROM transactions;
Find the number of events funded by 'Government' funding source
CREATE TABLE Funding (id INT,name TEXT,type TEXT); INSERT INTO Funding (id,name,type) VALUES (1,'Government','Public'),(2,'Foundation','Public'),(3,'Individual','Private'); CREATE TABLE Events (id INT,name TEXT,funding_source_id INT); INSERT INTO Events (id,name,funding_source_id) VALUES (1,'Art Exhibition',1),(2,'Thea...
SELECT COUNT(*) FROM Events JOIN Funding ON Events.funding_source_id = Funding.id WHERE Funding.type = 'Public';
Which countries have the highest production cost for garments made of sustainable materials?
CREATE TABLE producers (id INT,name VARCHAR(50),country VARCHAR(50),production_cost DECIMAL(5,2)); INSERT INTO producers (id,name,country,production_cost) VALUES (1,'GreenTees','India',15.50),(2,'EcoWear','Bangladesh',12.30),(3,'SustainaClothes','China',18.00); CREATE TABLE materials (id INT,name VARCHAR(50),type VARCH...
SELECT m.country, AVG(p.production_cost) as avg_cost FROM producers p JOIN materials m ON p.country = m.country WHERE m.type IN ('Organic Cotton', 'Bamboo Fabric', 'Recycled Polyester') GROUP BY m.country ORDER BY avg_cost DESC LIMIT 3;
Get the top 5 content creators with the most followers in the content_creators table who joined after 2020-01-01.
CREATE TABLE content_creators (creator_id INT,username VARCHAR(50),join_date DATE,followers INT);
SELECT username, followers FROM content_creators WHERE join_date > '2020-01-01' ORDER BY followers DESC LIMIT 5;
What is the total quantity of sustainable textiles used in manufacturing for each trend?
CREATE TABLE SustainableManufacturing (id INT,trend VARCHAR(20),fabric VARCHAR(20),quantity INT); INSERT INTO SustainableManufacturing (id,trend,fabric,quantity) VALUES (1,'neutrals','organic linen',600),(2,'brights','recycled silk',800);
SELECT trend, SUM(quantity) FROM SustainableManufacturing WHERE fabric LIKE '%sustainable%' GROUP BY trend;
Update the 'contract_amount' field in the 'defense_contracts' table for contracts with 'contracting_agency' 'DOD' and 'contract_status' 'active' by increasing the amount by 10%
CREATE TABLE defense_contracts (contract_id INT PRIMARY KEY,contracting_agency VARCHAR(255),contract_status VARCHAR(255),contract_amount DECIMAL(10,2));
UPDATE defense_contracts SET contract_amount = contract_amount * 1.1 WHERE contracting_agency = 'DOD' AND contract_status = 'active';
What is the average cost of projects in the 'Bridges' category?
CREATE TABLE InfrastructureProjects (id INT,category VARCHAR(20),cost FLOAT); INSERT INTO InfrastructureProjects (id,category,cost) VALUES (1,'Roads',500000),(2,'Bridges',750000),(3,'Buildings',900000),(4,'Roads',600000);
SELECT AVG(cost) FROM InfrastructureProjects WHERE category = 'Bridges';
What are the total donations by region in Q3 2022?
CREATE TABLE Donations (id INT,region VARCHAR(20),amount DECIMAL(10,2),donation_date DATE); INSERT INTO Donations (id,region,amount,donation_date) VALUES (1,'North',5000,'2022-07-01'),(2,'South',6000,'2022-07-02'),(3,'East',7000,'2022-07-03'),(4,'West',8000,'2022-07-04');
SELECT region, SUM(amount) as total_donations FROM Donations WHERE donation_date >= '2022-07-01' AND donation_date <= '2022-09-30' GROUP BY region;
Display the number of public schools in each city, sorted alphabetically by city name
CREATE TABLE schools (school_id INT,city_id INT,school_name TEXT);CREATE TABLE cities (city_id INT,city_name TEXT,population INT);
SELECT c.city_name, COUNT(s.school_id) FROM schools s INNER JOIN cities c ON s.city_id = c.city_id GROUP BY c.city_name ORDER BY c.city_name ASC;
What is the minimum property tax for green-certified buildings in Sydney?
CREATE TABLE buildings (id INT,city VARCHAR,size INT,green_certified BOOLEAN,property_tax DECIMAL);
SELECT MIN(property_tax) FROM buildings WHERE city = 'Sydney' AND green_certified = TRUE;
Which suppliers provide the most "Organic" products?
CREATE TABLE Suppliers(supplier VARCHAR(20),product VARCHAR(20),quantity INT); INSERT INTO Suppliers(supplier,product,quantity) VALUES('Supplier A','Organic Apples',100),('Supplier B','Apples',150),('Supplier A','Organic Bananas',75);
SELECT supplier, product, SUM(quantity) as total_quantity FROM Suppliers WHERE product LIKE 'Organic%' GROUP BY supplier, product;
What is the minimum salary for employees who have completed leadership training?
CREATE TABLE EmployeeTraining (EmployeeID INT,Training VARCHAR(30),Salary DECIMAL(10,2)); INSERT INTO EmployeeTraining (EmployeeID,Training,Salary) VALUES (1,'Leadership',80000.00),(2,'Sales Training',70000.00);
SELECT MIN(Salary) FROM EmployeeTraining WHERE Training = 'Leadership';
Display all donors and their contact information from 'donors' and 'contact_info' tables
CREATE TABLE donors (donor_id INT,donor_name TEXT); CREATE TABLE contact_info (contact_id INT,donor_id INT,email TEXT,phone TEXT);
SELECT donors.donor_name, contact_info.email, contact_info.phone FROM donors LEFT JOIN contact_info ON donors.donor_id = contact_info.donor_id;
What was the total revenue for men's and women's clothing in the United States in Q2 2021?
CREATE TABLE sales (item_code VARCHAR(20),item_name VARCHAR(50),category VARCHAR(20),country VARCHAR(50),quantity INT,price DECIMAL(10,2),sale_date DATE);
SELECT SUM(quantity * price) as total_revenue FROM sales WHERE category IN ('men_clothing', 'women_clothing') AND country = 'United States' AND sale_date BETWEEN '2021-04-01' AND '2021-06-30';
What is the total recycling rate for paper waste worldwide in 2020?
CREATE TABLE recycling_rates (year INT,region TEXT,plastic_rate FLOAT,paper_rate FLOAT); INSERT INTO recycling_rates (year,region,plastic_rate,paper_rate) VALUES (2018,'Asia',0.35,0.60),(2018,'Europe',0.55,0.75),(2019,'Asia',0.40,0.65),(2019,'Europe',0.60,0.80),(2020,NULL,NULL,NULL);
SELECT AVG(paper_rate) FROM recycling_rates WHERE year = 2020;