instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the total carbon sequestered by each tree species in 2020? | CREATE TABLE trees (id INT,species VARCHAR(255),carbon_sequestered DECIMAL(10,2),year INT); | SELECT species, SUM(carbon_sequestered) as total_carbon_sequestered FROM trees WHERE year = 2020 GROUP BY species; |
What is the average renewable energy capacity (in MW) for projects that were completed in the first half of 2019, grouped by project type? | CREATE TABLE renewable_energy_projects_capacity (id INT,project_type VARCHAR(255),project_date DATE,capacity INT); | SELECT project_type, AVG(capacity / 1000000) FROM renewable_energy_projects_capacity WHERE project_date BETWEEN '2019-01-01' AND '2019-06-30' GROUP BY project_type; |
How many baseball players have hit more than 300 home runs and have a batting average above .300? | CREATE TABLE Players (PlayerID INT,PlayerName VARCHAR(50),HomeRuns INT,BattingAverage DECIMAL(3,2)); INSERT INTO Players (PlayerID,PlayerName,HomeRuns,BattingAverage) VALUES (1,'Bonds',762,.302),(2,'Aaron',755,.305); | SELECT COUNT(*) FROM Players WHERE HomeRuns > 300 AND BattingAverage > .300 |
What was the average response time for public service requests in each district of Chicago in Q2 2022? | CREATE TABLE ResponseTimes (District TEXT,Quarter INT,ResponseTime FLOAT); INSERT INTO ResponseTimes (District,Quarter,ResponseTime) VALUES ('Downtown',2,12.5),('North Side',2,13.7),('South Side',2,14.2),('West Side',2,15.1); | SELECT AVG(ResponseTime) as AvgResponseTime, District FROM ResponseTimes WHERE Quarter = 2 GROUP BY District; |
What is the average annual rainfall change in Kenya and Nigeria since 2000, ranked by the greatest change? | CREATE TABLE rainfall_data (country VARCHAR(20),year INT,avg_rainfall FLOAT); INSERT INTO rainfall_data (country,year,avg_rainfall) VALUES ('Kenya',2000,800),('Kenya',2001,810),('Nigeria',2000,1200),('Nigeria',2001,1215); | SELECT country, AVG(avg_rainfall) as avg_rainfall_change, ROW_NUMBER() OVER (ORDER BY AVG(avg_rainfall) DESC) as rank FROM rainfall_data WHERE country IN ('Kenya', 'Nigeria') AND year >= 2000 GROUP BY country; |
What is the average number of algorithmic fairness assessments conducted per month in India in 2022? | CREATE TABLE fairness_assessments (assessment_id INT,assessment_date DATE,country TEXT); INSERT INTO fairness_assessments (assessment_id,assessment_date,country) VALUES (1,'2022-01-02','India'),(2,'2022-02-15','India'),(3,'2022-03-27','India'); | SELECT AVG(num_assessments) as avg_assessments_per_month FROM (SELECT COUNT(*) as num_assessments, EXTRACT(MONTH FROM assessment_date) as month FROM fairness_assessments WHERE country = 'India' AND assessment_date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY month) as subquery; |
What are the top 3 cruelty-free cosmetic products with the highest price? | CREATE TABLE cosmetics (product_id INT,product_name TEXT,cruelty_free BOOLEAN,price FLOAT); INSERT INTO cosmetics VALUES (1,'Lipstick A',true,12.99),(2,'Foundation B',false,18.50),(3,'Mascara C',true,9.99),(4,'Eyeshadow D',true,14.99),(5,'Blush E',false,11.99); | SELECT product_name, cruelty_free, price FROM cosmetics WHERE cruelty_free = true ORDER BY price DESC LIMIT 3; |
What is the minimum Praseodymium production in 2018? | CREATE TABLE praseodymium_production (country VARCHAR(50),year INT,quantity INT); INSERT INTO praseodymium_production (country,year,quantity) VALUES ('China',2018,75000),('United States',2018,10000),('Malaysia',2018,8000),('India',2018,5000); | SELECT MIN(quantity) FROM praseodymium_production WHERE year = 2018; |
What is the total mass of space debris in LEO (Low Earth Orbit)? | CREATE TABLE space_debris (id INT,name VARCHAR(50),type VARCHAR(50),mass FLOAT,orbit VARCHAR(50)); INSERT INTO space_debris (id,name,type,mass,orbit) VALUES (1,'ISS','Space Station',419000,'LEO'); INSERT INTO space_debris (id,name,type,mass,orbit) VALUES (2,'Envisat','Satellite',8212,'LEO'); | SELECT SUM(mass) FROM space_debris WHERE orbit = 'LEO'; |
What is the name and inspection date for the inspections with the lowest scores? | CREATE TABLE Inspections (id INT,restaurant_id INT,inspection_date DATE,score INT); INSERT INTO Inspections (id,restaurant_id,inspection_date,score) VALUES (1,1,'2021-01-01',95); INSERT INTO Inspections (id,restaurant_id,inspection_date,score) VALUES (2,2,'2021-01-02',85); INSERT INTO Inspections (id,restaurant_id,inspection_date,score) VALUES (3,3,'2021-01-03',65); | SELECT name, inspection_date, score FROM Inspections i JOIN Restaurants r ON i.restaurant_id = r.id WHERE score = (SELECT MIN(score) FROM Inspections); |
What is the total quantity of organic ingredients used in the last month? | CREATE TABLE inventory (item_id INT,organic BOOLEAN,quantity INT,order_date DATE); INSERT INTO inventory (item_id,organic,quantity,order_date) VALUES (1,true,50,'2021-01-01'),(2,false,100,'2021-01-02'); | SELECT SUM(quantity) FROM inventory WHERE organic = true AND order_date BETWEEN '2021-01-01' AND '2021-01-31'; |
How many customers are there in the 'Middle East' region? | CREATE TABLE customers (id INT,name VARCHAR(50),region VARCHAR(20)); INSERT INTO customers (id,name,region) VALUES (1,'John Doe','Southwest'),(2,'Jane Smith','Northeast'),(3,'Michael Johnson','North America'),(4,'Sarah Lee','North America'),(5,'Emma Watson','Europe'),(6,'Oliver Twist','Europe'),(7,'Ali Ahmed','Middle East'),(8,'Aisha Al-Fahad','Middle East'); | SELECT COUNT(*) FROM customers WHERE region = 'Middle East'; |
What is the earliest year a cybersecurity incident was reported? | CREATE TABLE CybersecurityIncidents(id INT PRIMARY KEY,year INT,incidents INT);INSERT INTO CybersecurityIncidents(id,year,incidents) VALUES (1,2005,50),(2,2010,100),(3,2015,150); | SELECT MIN(year) FROM CybersecurityIncidents; |
List the software products with no high severity vulnerabilities. | CREATE TABLE software (id INT,name VARCHAR(255)); INSERT INTO software (id,name) VALUES (1,'Product A'),(2,'Product B'),(3,'Product C'); CREATE TABLE vulnerabilities (id INT,software_id INT,severity VARCHAR(255)); INSERT INTO vulnerabilities (id,software_id,severity) VALUES (1,1,'High'),(2,1,'Medium'),(3,2,'High'),(4,2,'Low'),(5,3,'Medium'); | SELECT software.name FROM software LEFT JOIN vulnerabilities ON software.id = vulnerabilities.software_id WHERE vulnerabilities.severity IS NULL OR vulnerabilities.severity != 'High'; |
Create a table for citizen demographics | CREATE SCHEMA public; | CREATE TABLE public.citizen_demographics (citizen_id SERIAL PRIMARY KEY, age INT, gender VARCHAR(10), region VARCHAR(50)); |
Update the port name for port ID 12 in the "ports" table | CREATE TABLE ports (id INT PRIMARY KEY,name VARCHAR(255),location VARCHAR(255)); | WITH updated_port AS (UPDATE ports SET name = 'New Port Name' WHERE id = 12 RETURNING id, name, location) SELECT * FROM updated_port; |
What is the average funding per round for series B rounds? | CREATE TABLE investment_rounds (startup_id INT PRIMARY KEY,round_type VARCHAR(255),funding_amount FLOAT); | SELECT AVG(funding_amount) FROM investment_rounds WHERE round_type = 'series B'; |
Insert a new record for a habitat preservation project into the 'habitat' table | CREATE TABLE habitat (id INT PRIMARY KEY,name VARCHAR(50),location VARCHAR(50),size FLOAT,status VARCHAR(50)); | INSERT INTO habitat (id, name, location, size, status) VALUES (1, 'Amazon Rainforest Conservation', 'Amazon Rainforest', 6700000.0, 'In Progress'); |
What is the daily sales revenue of recycled products in Italy? | CREATE TABLE sales (sale_id int,product_id int,sale_date date,revenue decimal(5,2)); CREATE TABLE products (product_id int,product_name varchar(255),is_recycled boolean,country varchar(50)); INSERT INTO sales (sale_id,product_id,sale_date,revenue) VALUES (1,1,'2022-01-01',50.00); INSERT INTO products (product_id,product_name,is_recycled,country) VALUES (1,'Recycled Tote Bag',true,'Italy'); | SELECT sale_date, SUM(revenue) AS daily_revenue FROM sales JOIN products ON sales.product_id = products.product_id WHERE is_recycled = true AND country = 'Italy' GROUP BY sale_date; |
How many unemployed people are there in each region of Japan? | CREATE TABLE unemployment (id INT,region VARCHAR(50),unemployed INT); INSERT INTO unemployment (id,region,unemployed) VALUES (1,'Region 1',3000); INSERT INTO unemployment (id,region,unemployed) VALUES (2,'Region 2',4000); | SELECT region, unemployed FROM unemployment GROUP BY region; |
What is the total quantity of each product shipped in the last month? | CREATE TABLE Shipments (ShipmentID int,WarehouseID int,ProductName varchar(255),Quantity int,ShippedDate date); INSERT INTO Shipments (ShipmentID,WarehouseID,ProductName,Quantity,ShippedDate) VALUES (11,1,'Peaches',130,'2022-05-25'),(12,2,'Plums',140,'2022-05-26'); | SELECT ProductName, SUM(Quantity) AS TotalQuantity FROM Shipments WHERE ShippedDate BETWEEN DATEADD(month, -1, GETDATE()) AND GETDATE() GROUP BY ProductName; |
What is the total revenue for concert ticket sales in 'concert_ticket_sales' table for artists who have performed in Texas? | CREATE TABLE concert_ticket_sales (ticket_id INT,artist_id INT,venue_id INT,price DECIMAL(10,2),date DATE,city VARCHAR(50),state VARCHAR(50)); | SELECT SUM(price) FROM concert_ticket_sales WHERE state = 'Texas'; |
What is the average water turbidity level for each species, grouped by species, from the 'fish_stock' and 'ocean_health' tables, excluding those with no records in either table? | CREATE TABLE fish_stock (species VARCHAR(255),turbidity FLOAT); CREATE TABLE ocean_health (species VARCHAR(255),turbidity FLOAT); INSERT INTO fish_stock (species,turbidity) VALUES ('Tilapia',25.5),('Salmon',20.1); INSERT INTO ocean_health (species,turbidity) VALUES ('Tilapia',24.0),('Salmon',19.0); | SELECT f.species, AVG(f.turbidity + o.turbidity)/2 FROM fish_stock f INNER JOIN ocean_health o ON f.species = o.species WHERE f.species IS NOT NULL AND o.species IS NOT NULL GROUP BY f.species; |
Update the salary of all workers in the 'textile' department to be $58,000. | CREATE TABLE factories (factory_id INT,department VARCHAR(20)); INSERT INTO factories VALUES (1,'textile'),(2,'metal'),(3,'textile'),(4,'renewable energy'); CREATE TABLE workers (worker_id INT,factory_id INT,salary DECIMAL(5,2)); INSERT INTO workers VALUES (1,1,50000.00),(2,1,55000.00),(3,2,60000.00),(4,3,52000.00),(5,3,57000.00); | UPDATE workers SET salary = 58000.00 WHERE worker_id IN (SELECT worker_id FROM workers INNER JOIN factories ON workers.factory_id = factories.factory_id WHERE factories.department = 'textile'); |
What were the sales figures for 'CompanyY' in Q3 2019? | CREATE TABLE company_sales(company_name TEXT,sale_amount INT,sale_quarter INT,sale_year INT); INSERT INTO company_sales(company_name,sale_amount,sale_quarter,sale_year) VALUES('CompanyY',4000,3,2019); | SELECT SUM(sale_amount) FROM company_sales WHERE company_name = 'CompanyY' AND sale_quarter = 3 AND sale_year = 2019; |
What was the average funding received by Indigenous artists in 2021? | CREATE TABLE ArtistFunding (id INT,artist_name VARCHAR(30),artist_community VARCHAR(30),funding_amount INT,funding_year INT); INSERT INTO ArtistFunding (id,artist_name,artist_community,funding_amount,funding_year) VALUES (1,'Amy Whispering Wind','Indigenous',4000,2021),(2,'Brian Eagle Feather','Indigenous',5000,2021),(3,'Chelsea Northern Lights','Indigenous',3000,2021); | SELECT AVG(funding_amount) as avg_funding FROM ArtistFunding WHERE artist_community = 'Indigenous' AND funding_year = 2021; |
What is the total waste produced per month for each factory in the 'ethical_factories' table? | CREATE TABLE ethical_factories (factory_id INT,name TEXT,location TEXT,avg_waste_monthly FLOAT); | SELECT factory_id, SUM(avg_waste_monthly) as total_waste_monthly FROM ethical_factories GROUP BY factory_id; |
What is the average diversity training attendance by region? | CREATE TABLE trainings (id INT,employee_id INT,training_type VARCHAR(20),training_date DATE,region VARCHAR(20)); INSERT INTO trainings (id,employee_id,training_type,training_date,region) VALUES (1,1,'Diversity','2022-01-10','North'),(2,2,'Diversity','2022-01-10','South'),(3,3,'Diversity','2022-02-15','East'),(4,4,'Diversity','2022-02-15','West'); | SELECT region, AVG(attendance) as avg_attendance FROM (SELECT region, training_type, COUNT(DISTINCT employee_id) as attendance FROM trainings WHERE training_type = 'Diversity' GROUP BY region, training_type) as diversity_trainings GROUP BY region; |
What is the average transparency score for products made in the Americas? | CREATE TABLE products (product_id INT,transparency_score DECIMAL(3,2),product_origin VARCHAR(50)); INSERT INTO products (product_id,transparency_score,product_origin) VALUES (1,8.5,'Asia'),(2,9.2,'Europe'),(3,7.8,'Americas'),(4,6.9,'Asia'),(5,9.1,'Europe'); | SELECT AVG(transparency_score) AS avg_score FROM products WHERE product_origin = 'Americas'; |
What is the minimum donation amount made by donors from each country in Q3 of 2021? | CREATE TABLE Donors (id INT,name TEXT,country TEXT,donation FLOAT,quarter TEXT,year INT); INSERT INTO Donors (id,name,country,donation,quarter,year) VALUES (1,'Charlie','USA',120.0,'Q3',2021),(2,'David','Mexico',90.0,'Q3',2021),(3,'Eve','Canada',110.0,'Q3',2021),(4,'Frank','USA',130.0,'Q3',2021); | SELECT country, MIN(donation) FROM Donors WHERE quarter = 'Q3' AND year = 2021 GROUP BY country; |
What is the average horsepower of sports cars released after 2015? | CREATE TABLE SportsCars (Id INT,Name VARCHAR(50),Year INT,Horsepower INT); INSERT INTO SportsCars (Id,Name,Year,Horsepower) VALUES (1,'Corvette',2016,460),(2,'911 Turbo',2017,540),(3,'M4 GTS',2016,493); | SELECT AVG(Horsepower) FROM SportsCars WHERE Year >= 2015; |
What are the names and descriptions of eco-friendly accommodations in Australia? | CREATE TABLE countries (id INT PRIMARY KEY,name VARCHAR(255));CREATE TABLE accommodations (id INT PRIMARY KEY,name VARCHAR(255),country_id INT,FOREIGN KEY (country_id) REFERENCES countries(id),eco_friendly BOOLEAN);CREATE TABLE descriptions (id INT PRIMARY KEY,accommodation_id INT,FOREIGN KEY (accommodation_id) REFERENCES accommodations(id),text TEXT);CREATE VIEW eco_friendly_accommodations_in_australia AS SELECT a.name,d.text FROM accommodations a JOIN countries c ON a.country_id = c.id JOIN descriptions d ON a.id = d.accommodation_id WHERE c.name = 'Australia' AND a.eco_friendly = true; | SELECT name, text FROM eco_friendly_accommodations_in_australia; |
What is the average number of likes received by articles published in 2020? | CREATE TABLE articles (article_id INT,title TEXT,publish_date DATE,likes INT); | SELECT AVG(likes) as avg_likes FROM articles WHERE publish_date >= '2020-01-01' AND publish_date < '2021-01-01'; |
Provide the usage_category and usage_amount for the water_usage table where the date is between '2022-07-01' and '2022-07-15' | CREATE TABLE water_usage (date DATE,usage_category VARCHAR(20),region VARCHAR(20),usage_amount INT); INSERT INTO water_usage (date,usage_category,region,usage_amount) VALUES ('2022-07-01','Residential','Northeast',15000),('2022-07-02','Industrial','Midwest',200000),('2022-07-03','Agricultural','West',800000); | SELECT usage_category, usage_amount FROM water_usage WHERE date BETWEEN '2022-07-01' AND '2022-07-15'; |
Find the number of female founders in technology companies | CREATE TABLE founders (id INT,gender VARCHAR(10),company_domain VARCHAR(20)); INSERT INTO founders (id,gender,company_domain) VALUES (1,'Male','Finance'); INSERT INTO founders (id,gender,company_domain) VALUES (2,'Female','Technology'); | SELECT COUNT(*) FROM founders WHERE gender = 'Female' AND company_domain = 'Technology'; |
What is the highest priced product made in each country? | CREATE TABLE products (product_id INT,product_name TEXT,price DECIMAL(5,2),country TEXT); INSERT INTO products (product_id,product_name,price,country) VALUES (1,'T-Shirt',20.99,'Italy'); INSERT INTO products (product_id,product_name,price,country) VALUES (2,'Jeans',50.49,'France'); INSERT INTO products (product_id,product_name,price,country) VALUES (3,'Shoes',75.99,'Italy'); INSERT INTO products (product_id,product_name,price,country) VALUES (4,'Hat',15.99,'Germany'); INSERT INTO products (product_id,product_name,price,country) VALUES (5,'Jacket',100.00,'Italy'); | SELECT country, MAX(price) FROM products GROUP BY country; |
Identify the total number of players, the number of female players, and the number of VR games offered in the game design library. | CREATE TABLE GameDesignLibrary (GameID INT,GameName VARCHAR(20),VRGame BOOLEAN); INSERT INTO GameDesignLibrary VALUES (1,'CS:GO',FALSE); INSERT INTO GameDesignLibrary VALUES (2,'VRChat',TRUE); CREATE TABLE Players (PlayerID INT,Age INT,Gender VARCHAR(10)); INSERT INTO Players VALUES (1,25,'Male'); INSERT INTO Players VALUES (2,22,'Female'); | SELECT COUNT(Players.PlayerID) AS TotalPlayers, SUM(CASE WHEN Players.Gender = 'Female' THEN 1 ELSE 0 END) AS FemalePlayers, SUM(GameDesignLibrary.VRGame) AS VRGames FROM Players CROSS JOIN GameDesignLibrary; |
Count the number of makeup products that contain parabens and were sold in Canada. | CREATE TABLE products (product_id INT,product_name VARCHAR(255),has_parabens BOOLEAN,country VARCHAR(255)); INSERT INTO products (product_id,product_name,has_parabens,country) VALUES (1,'Liquid Foundation',true,'Canada'); INSERT INTO products (product_id,product_name,has_parabens,country) VALUES (2,'Mascara',false,'Canada'); | SELECT COUNT(*) FROM products WHERE has_parabens = true AND country = 'Canada'; |
What is the total number of songs for each genre and the total sales for those songs? | CREATE TABLE Genres (GenreID INT,Genre VARCHAR(50)); CREATE TABLE Songs (SongID INT,GenreID INT,SongName VARCHAR(50),Sales INT); | SELECT G.Genre, COUNT(DISTINCT S.SongID) as SongCount, SUM(S.Sales) as TotalSales FROM Songs S JOIN Genres G ON S.GenreID = G.GenreID GROUP BY G.Genre; |
What is the distribution of heritage sites by type? | CREATE TABLE SiteTypes (SiteTypeID INT,SiteType VARCHAR(50)); CREATE TABLE HeritageSites (SiteID INT,SiteTypeID INT,CountryID INT,SiteName VARCHAR(50),SiteYear INT); INSERT INTO SiteTypes VALUES (1,'Historic Building'),(2,'National Park'),(3,'Archaeological Site'); INSERT INTO HeritageSites VALUES (1,1,1,'Statue of Liberty',1886),(2,2,1,'Yellowstone NP',1872),(3,3,2,'Chichen Itza',1988),(4,1,3,'Banff NP',1885); | SELECT SiteTypes.SiteType, COUNT(HeritageSites.SiteID) AS SiteCount FROM SiteTypes INNER JOIN HeritageSites ON SiteTypes.SiteTypeID = HeritageSites.SiteTypeID GROUP BY SiteTypes.SiteType; |
Which carbon_offset_programs were implemented in the last 3 years, ordered by the program id? | CREATE TABLE carbon_offset_programs (id INT,name VARCHAR(100),start_date DATE); | SELECT * FROM carbon_offset_programs WHERE start_date >= DATEADD(YEAR, -3, GETDATE()) ORDER BY id; |
What is the total quantity of materials used in production for each brand? | CREATE TABLE brands (id INT,name VARCHAR(50)); CREATE TABLE materials_used (id INT,brand_id INT,material VARCHAR(50),quantity INT); INSERT INTO brands (id,name) VALUES (1,'Brand A'),(2,'Brand B'),(3,'Brand C'); INSERT INTO materials_used (id,brand_id,material,quantity) VALUES (1,1,'Organic Cotton',100),(2,1,'Recycled Polyester',150),(3,2,'Organic Cotton',200),(4,3,'Recycled Polyester',125); | SELECT b.name, SUM(mu.quantity) as total_quantity FROM brands b INNER JOIN materials_used mu ON b.id = mu.brand_id GROUP BY b.name; |
What is the total quantity of shipments in each country, with on-time and delayed shipments broken down? | CREATE TABLE Warehouses (WarehouseID INT,WarehouseName VARCHAR(50),Country VARCHAR(50)); CREATE TABLE Shipments (ShipmentID INT,WarehouseID INT,Quantity INT,DeliveryTime INT,ExpectedDeliveryTime INT); | SELECT W.Country, SUM(Quantity) AS TotalQuantity, SUM(CASE WHEN DeliveryTime <= ExpectedDeliveryTime THEN Quantity ELSE 0 END) AS OnTimeQuantity, SUM(CASE WHEN DeliveryTime > ExpectedDeliveryTime THEN Quantity ELSE 0 END) AS DelayedQuantity FROM Warehouses W JOIN Shipments S ON W.WarehouseID = S.WarehouseID GROUP BY W.Country; |
Create a table that shows the average percentage of natural ingredients in each product | CREATE TABLE product_ingredients (product_id INT,ingredient VARCHAR(255),percentage FLOAT,PRIMARY KEY (product_id,ingredient)); | CREATE TABLE avg_natural_ingredients AS SELECT product_id, AVG(percentage) as avg_natural_ingredients FROM product_ingredients WHERE ingredient LIKE 'natural%' GROUP BY product_id; |
What is the total revenue for each sustainable category, including the total quantity sold, in California during the month of April 2021?' | CREATE TABLE Restaurants (RestaurantID int,Name varchar(50),Location varchar(50)); CREATE TABLE Menu (MenuID int,ItemName varchar(50),Category varchar(50)); CREATE TABLE MenuSales (MenuID int,RestaurantID int,QuantitySold int,Revenue decimal(5,2),SaleDate date); | SELECT C.Category, SUM(M.Revenue) as Revenue, SUM(M.QuantitySold) as QuantitySold FROM Menu M JOIN MenuSales MS ON M.MenuID = MS.MenuID JOIN Restaurants R ON MS.RestaurantID = R.RestaurantID JOIN (SELECT * FROM Restaurants WHERE Location LIKE '%California%') C ON R.RestaurantID = C.RestaurantID WHERE MS.SaleDate >= '2021-04-01' AND MS.SaleDate <= '2021-04-30' GROUP BY C.Category; |
What is the minimum response time for emergency calls in each district in the last month? | CREATE TABLE districts (id INT,name TEXT);CREATE TABLE emergencies (id INT,district_id INT,response_time INT,date DATE); | SELECT d.name, MIN(e.response_time) FROM districts d JOIN emergencies e ON d.id = e.district_id WHERE e.date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY d.id; |
List the vessels with the most safety incidents in the Mediterranean Sea in 2020. | CREATE TABLE vessels(id INT,name VARCHAR(100),region VARCHAR(50));CREATE TABLE incidents(id INT,vessel_id INT,incident_date DATE); | SELECT v.name FROM vessels v JOIN (SELECT vessel_id, COUNT(*) AS incident_count FROM incidents WHERE incident_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY vessel_id) i ON v.id = i.vessel_id WHERE v.region = 'Mediterranean Sea' ORDER BY incident_count DESC; |
List the names and total donations for donors who have donated more than $5000 | CREATE TABLE donors (id INT,name VARCHAR(50),total_donations DECIMAL(10,2)); INSERT INTO donors (id,name,total_donations) VALUES (1,'John Doe',7000.00); INSERT INTO donors (id,name,total_donations) VALUES (2,'Jane Smith',12000.00); INSERT INTO donors (id,name,total_donations) VALUES (3,'Bob Johnson',6000.00); | SELECT name, total_donations FROM donors WHERE total_donations > 5000; |
What is the maximum number of hours of community service assigned to offenders who have been sentenced to community service in the state of Texas? | CREATE TABLE community_service_sentences (offender_id INT,state VARCHAR(255),hours_served INT); INSERT INTO community_service_sentences (offender_id,state,hours_served) VALUES (1,'Texas',50); INSERT INTO community_service_sentences (offender_id,state,hours_served) VALUES (2,'Florida',75); | SELECT state, MAX(hours_served) as max_hours_served FROM community_service_sentences WHERE state = 'Texas'; |
What is the average depth of all marine protected areas in the Pacific Ocean region? | CREATE TABLE marine_protected_areas (id INT,name TEXT,region TEXT,avg_depth FLOAT); INSERT INTO marine_protected_areas (id,name,region,avg_depth) VALUES (1,'Galapagos Marine Reserve','Pacific',200.0),(2,'Great Barrier Reef','Pacific',100.0); | SELECT AVG(avg_depth) FROM marine_protected_areas WHERE region = 'Pacific'; |
Identify the members who participated in both Running and Yoga activities in the month of July 2022. | CREATE SCHEMA fitness; CREATE TABLE participation (member_id INT,activity VARCHAR(20),participation_date DATE); INSERT INTO participation (member_id,activity,participation_date) VALUES (1,'Running','2022-07-01'),(1,'Yoga','2022-07-02'),(2,'Swimming','2022-07-03'),(3,'Yoga','2022-07-04'),(1,'Running','2022-07-05'),(3,'Yoga','2022-07-06'); | SELECT member_id FROM participation WHERE activity = 'Running' AND participation_date >= '2022-07-01' AND participation_date < '2022-08-01' INTERSECT SELECT member_id FROM participation WHERE activity = 'Yoga' AND participation_date >= '2022-07-01' AND participation_date < '2022-08-01'; |
Delete a community health statistic record for a specific community type | CREATE TABLE community_health_statistics (id INT,community_type VARCHAR(20),statistic_value INT); | DELETE FROM community_health_statistics WHERE community_type = 'Suburban'; |
What is the average length of stay in weeks for visitors from Asia who visited eco-friendly hotels in 2022? | CREATE TABLE Hotels (HotelID INT,HotelType VARCHAR(20),Location VARCHAR(20)); INSERT INTO Hotels (HotelID,HotelType,Location) VALUES (1,'Eco-Friendly','Asia'); CREATE TABLE Visitors (VisitorID INT,Nationality VARCHAR(20),HotelID INT,StayLength INT,VisitYear INT); INSERT INTO Visitors (VisitorID,Nationality,HotelID,StayLength,VisitYear) VALUES (1,'Chinese',1,14,2022),(2,'Japanese',1,21,2022); | SELECT AVG(StayLength/7.0) FROM Visitors WHERE Nationality IN ('Chinese', 'Japanese') AND HotelID = 1 AND VisitYear = 2022; |
Show the number of public libraries in each county, ordered by the number of libraries in descending order | CREATE TABLE libraries (library_id INT,county_id INT,library_name TEXT);CREATE TABLE counties (county_id INT,county_name TEXT); | SELECT c.county_name, COUNT(l.library_id) FROM libraries l INNER JOIN counties c ON l.county_id = c.county_id GROUP BY c.county_name ORDER BY COUNT(l.library_id) DESC; |
What is the maximum price of artworks created by Mexican artists? | CREATE TABLE Artists (artist_id INT,artist_name VARCHAR(50),birth_date DATE,country VARCHAR(50)); INSERT INTO Artists (artist_id,artist_name,birth_date,country) VALUES (1,'Clara Peeters','1594-01-15','Netherlands'); ; CREATE TABLE Artworks (artwork_id INT,title VARCHAR(50),year_made INT,artist_id INT,price FLOAT); INSERT INTO Artworks (artwork_id,title,year_made,artist_id,price) VALUES (1,'Still Life with Flowers',1612,1,1000.0); ; | SELECT MAX(Artworks.price) FROM Artworks INNER JOIN Artists ON Artworks.artist_id = Artists.artist_id WHERE Artists.country = 'Mexico'; |
List all 'impact_categories' associated with 'WaterAccess' in the 'Locations' table. | CREATE TABLE Locations (id INT,country VARCHAR(255),region VARCHAR(255),impact_category VARCHAR(255)); | SELECT DISTINCT impact_category FROM Locations WHERE country = 'WaterAccess'; |
Show the number of home games each baseball team has played | CREATE TABLE baseball_games (id INT,team_id INT,game_date DATE,is_home BOOLEAN); INSERT INTO baseball_games (id,team_id,game_date,is_home) VALUES (1,1,'2021-04-01',true),(2,2,'2021-04-05',false),(3,1,'2021-05-03',true); | SELECT team_id, COUNT(*) as home_games_played FROM baseball_games WHERE is_home = true GROUP BY team_id; |
List all the tree species in the Trees table that have more than 3 trees. | CREATE TABLE Trees (id INT,species VARCHAR(255),age INT); INSERT INTO Trees (id,species,age) VALUES (1,'Oak',50),(2,'Pine',30),(3,'Maple',40),(4,'Oak',45),(5,'Pine',35),(6,'Birch',25); | SELECT species FROM Trees GROUP BY species HAVING COUNT(*) > 3; |
Count the number of players from each country | CREATE TABLE Players (id INT,name VARCHAR(50),country VARCHAR(50)); INSERT INTO Players (id,name,country) VALUES (1,'John Doe','USA'),(2,'Jane Smith','Canada'),(3,'Pedro Alvarez','Mexico'); | SELECT country, COUNT(*) FROM Players GROUP BY country; |
What is the number of male and female readers in a specific age range? | CREATE TABLE readers (id INT,name VARCHAR(50),age INT,gender VARCHAR(10),country VARCHAR(50)); | SELECT gender, COUNT(*) as count FROM readers WHERE age BETWEEN 18 AND 30 GROUP BY gender; |
List all affordable housing units in the state of New York that have a size less than 1000 square feet. | CREATE TABLE AffordableHousing (id INT,state VARCHAR(20),size FLOAT); | SELECT * FROM AffordableHousing WHERE state = 'New York' AND size < 1000; |
What is the total budget for education projects in the 'education_projects' table? | CREATE TABLE education_projects (project VARCHAR(50),budget INT); INSERT INTO education_projects (project,budget) VALUES ('School Construction',3000000); INSERT INTO education_projects (project,budget) VALUES ('Curriculum Development',1500000); INSERT INTO education_projects (project,budget) VALUES ('Teacher Training',2000000); | SELECT SUM(budget) FROM education_projects; |
Which AI safety research papers were published before 2020, ordered by the number of citations? | CREATE TABLE research_papers (title VARCHAR(255),year INT,citations INT,domain VARCHAR(255)); INSERT INTO research_papers (title,year,citations,domain) VALUES ('Paper1',2018,50,'AI Safety'); INSERT INTO research_papers (title,year,citations,domain) VALUES ('Paper2',2019,75,'AI Safety'); | SELECT title, year, citations FROM research_papers WHERE year < 2020 AND domain = 'AI Safety' ORDER BY citations DESC; |
List all plants that have machines in the 'tooling' category. | CREATE TABLE machines (machine_id INT,plant VARCHAR(10),category VARCHAR(10)); INSERT INTO machines (machine_id,plant,category) VALUES (1,'plant1','molding'),(2,'plant2','tooling'),(3,'plant1','tooling'),(4,'plant3','molding'); | SELECT plant FROM machines WHERE category = 'tooling'; |
What is the maximum budget for a legal technology project? | CREATE TABLE legal_technology_projects (id INT,project_name VARCHAR(50),budget INT); | SELECT MAX(budget) FROM legal_technology_projects; |
List the machine types and their maintenance schedules for machines in the recycling division. | CREATE TABLE machines (machine_id INT,division TEXT,machine_type TEXT,next_maintenance_date DATE); INSERT INTO machines VALUES (1,'Recycling','Shredder','2023-02-15'),(2,'Manufacturing','Molder','2023-03-20'),(3,'Recycling','Grinder','2023-04-05'); | SELECT machine_type, next_maintenance_date FROM machines WHERE division = 'Recycling'; |
What is the maximum trip distance for scooter-sharing in Madrid? | CREATE TABLE scooter_sharing (id INT,trip_id INT,start_time TIMESTAMP,end_time TIMESTAMP,start_station TEXT,end_station TEXT,trip_distance FLOAT); | SELECT MAX(trip_distance) FROM scooter_sharing WHERE start_station = 'Madrid'; |
List all cybersecurity vulnerabilities in the 'cybersecurity_vulnerabilities' table along with their corresponding severity level and department responsible, sorted by the severity level in ascending order. | CREATE TABLE cybersecurity_vulnerabilities (id INT,severity VARCHAR(255),department VARCHAR(255)); | SELECT severity, department FROM cybersecurity_vulnerabilities ORDER BY severity ASC; |
What is the average age of healthcare workers in Los Angeles County? | CREATE TABLE healthcare_workers (id INT,name TEXT,age INT,city TEXT); INSERT INTO healthcare_workers (id,name,age,city) VALUES (1,'John Doe',35,'Los Angeles'); INSERT INTO healthcare_workers (id,name,age,city) VALUES (2,'Jane Smith',40,'Los Angeles'); | SELECT AVG(age) FROM healthcare_workers WHERE city = 'Los Angeles'; |
What is the average depth of marine life research stations in each country? | CREATE TABLE marine_life_research_stations (id INT,station_name TEXT,country TEXT,depth FLOAT); | SELECT country, AVG(depth) FROM marine_life_research_stations GROUP BY country; |
What are the explainable AI techniques used in AI applications for healthcare? | CREATE TABLE if not exists eai_techniques (technique_id INT PRIMARY KEY,name TEXT); INSERT INTO eai_techniques (technique_id,name) VALUES (1,'Feature Attribution'),(2,'Model Simplification'),(3,'Rule Extraction'); CREATE TABLE if not exists ai_applications (app_id INT PRIMARY KEY,name TEXT,technique_id INT,industry TEXT); INSERT INTO ai_applications (app_id,name,technique_id,industry) VALUES (1,'DeepHeart',1,'Healthcare'),(2,'DeepDream',NULL,'Art'),(3,'Shelley',3,'Literature'); | SELECT DISTINCT eai_techniques.name FROM eai_techniques JOIN ai_applications ON eai_techniques.technique_id = ai_applications.technique_id WHERE ai_applications.industry = 'Healthcare'; |
List the number of bridges in each state, ordered by the number of bridges in descending order. | CREATE TABLE states (id INT,name VARCHAR(20),num_bridges INT); INSERT INTO states (id,name,num_bridges) VALUES (1,'California',25000),(2,'Texas',50000),(3,'New York',30000); | SELECT name, num_bridges FROM states ORDER BY num_bridges DESC; |
What is the average property tax for affordable housing units in each state? | CREATE TABLE property_tax (id INT,state VARCHAR(20),property_tax INT,housing_type VARCHAR(20)); INSERT INTO property_tax (id,state,property_tax,housing_type) VALUES (1,'California',1500,'affordable'),(2,'California',2000,'affordable'),(3,'California',3000,'market_rate'),(4,'Texas',1000,'affordable'),(5,'Texas',1500,'market_rate'); | SELECT state, AVG(property_tax) FROM property_tax WHERE housing_type = 'affordable' GROUP BY state; |
What is the number of military technologies used in each intelligence operation? | CREATE TABLE Intelligence_Operations (Name VARCHAR(255),Technology VARCHAR(255)); INSERT INTO Intelligence_Operations (Name,Technology) VALUES ('Operation Desert Spy','M1 Abrams'),('Operation Desert Shield','AH-64 Apache'),('Operation Desert Storm','M2 Bradley'); | SELECT Intelligence_Operations.Name, COUNT(Technology) FROM Intelligence_Operations GROUP BY Intelligence_Operations.Name; |
List the number of members in the 'Manufacturing_Union' who earn a salary above the average salary. | CREATE TABLE Manufacturing_Union (union_member_id INT,member_id INT,salary FLOAT); INSERT INTO Manufacturing_Union (union_member_id,member_id,salary) VALUES (1,101,60000.00),(1,102,65000.00),(1,103,58000.00),(2,201,52000.00),(2,202,63000.00); | SELECT COUNT(union_member_id) FROM Manufacturing_Union WHERE salary > (SELECT AVG(salary) FROM Manufacturing_Union); |
How many companies were founded in the last 5 years, by region? | CREATE TABLE companies (id INT,name TEXT,year INT,region TEXT); INSERT INTO companies (id,name,year,region) VALUES (1,'Zeta Pte',2017,'APAC'),(2,'Eta Inc',2018,'NA'),(3,'Theta LLC',2016,'EMEA'),(4,'Iota Ltd',2019,'APAC'); | SELECT region, COUNT(*) FROM companies WHERE year BETWEEN YEAR(CURRENT_DATE) - 5 AND YEAR(CURRENT_DATE) GROUP BY region; |
Find the number of mental health parity violations by state in the last 6 months. | CREATE TABLE if not exists mental_health_parity (violation_id INT,violation_date DATE,state VARCHAR(255)); | SELECT COUNT(*), state FROM mental_health_parity WHERE violation_date >= DATEADD(month, -6, GETDATE()) GROUP BY state; |
What is the minimum salary among employees hired in the last six months, broken down by department? | CREATE TABLE Employees (EmployeeID INT,Name VARCHAR(50),Department VARCHAR(50),HireDate DATE,Salary FLOAT); INSERT INTO Employees (EmployeeID,Name,Department,HireDate,Salary) VALUES (1,'Sophia Lee','IT','2023-01-15',85000.00),(2,'Ethan Chen','IT','2023-02-20',90000.00),(3,'Mia Kim','HR','2023-03-05',70000.00); | SELECT Department, MIN(Salary) FROM Employees WHERE HireDate >= DATEADD(MONTH, -6, GETDATE()) GROUP BY Department; |
What is the total quantity of Dy and Tm produced by each country in Q1 2022? | CREATE TABLE production (element VARCHAR(2),country VARCHAR(15),quantity INT,quarter INT,year INT); INSERT INTO production VALUES ('Dy','China',500,1,2022),('Tm','Australia',200,1,2022),('Dy','Australia',300,1,2022); | SELECT country, SUM(quantity) as total_quantity FROM production WHERE element IN ('Dy', 'Tm') AND quarter = 1 AND year = 2022 GROUP BY country; |
List all the energy efficiency projects in the Asia-Pacific region | CREATE TABLE energy_efficiency_projects (project_name VARCHAR(50),location VARCHAR(50)); INSERT INTO energy_efficiency_projects (project_name,location) VALUES ('Project A','Asia-Pacific'),('Project B','Europe'),('Project C','Asia-Pacific'),('Project D','Americas'); | SELECT project_name FROM energy_efficiency_projects WHERE location = 'Asia-Pacific'; |
What is the data usage for broadband customers in a specific country? | CREATE TABLE broadband_customers (customer_id INT,data_usage FLOAT,country VARCHAR(50)); INSERT INTO broadband_customers (customer_id,data_usage,country) VALUES (1,3.5,'United States'),(2,4.2,'Canada'),(3,5.1,'Mexico'); CREATE VIEW data_usage_view AS SELECT country,SUM(data_usage) as total_data_usage FROM broadband_customers GROUP BY country; | SELECT country, total_data_usage, total_data_usage/SUM(total_data_usage) OVER (PARTITION BY country) as data_usage_percentage FROM data_usage_view; |
What is the maximum ocean acidification level for each ocean basin? | CREATE TABLE ocean_basins (id INT,name TEXT); CREATE TABLE ocean_acidification (id INT,ocean_basin_id INT,acidification_level FLOAT); INSERT INTO ocean_basins VALUES (1,'Atlantic'),(2,'Pacific'),(3,'Indian'); INSERT INTO ocean_acidification VALUES (1,1,-7850),(2,1,-7880),(3,2,-7930),(4,3,-7820); | SELECT ob.name, MAX(oa.acidification_level) as max_acidification FROM ocean_basins ob INNER JOIN ocean_acidification oa ON ob.id = oa.ocean_basin_id GROUP BY ob.name; |
What is the number of farmers trained in sustainable farming practices in Guatemala in 2019? | CREATE TABLE trainings (training_id INT,year INT,country VARCHAR(255),num_farmers INT); INSERT INTO trainings VALUES (1,2018,'Guatemala',500),(2,2019,'Guatemala',600),(3,2020,'Guatemala',700),(4,2021,'Guatemala',800); | SELECT num_farmers FROM trainings WHERE country = 'Guatemala' AND year = 2019; |
What is the average duration of virtual tours in Colombia? | CREATE TABLE virtual_tours_co (tour_id INT,tour_name VARCHAR(255),country VARCHAR(255),duration INT); INSERT INTO virtual_tours_co (tour_id,tour_name,country,duration) VALUES (1,'Virtual Tour Bogota','Colombia',60); INSERT INTO virtual_tours_co (tour_id,tour_name,country,duration) VALUES (2,'Virtual Tour Medellin','Colombia',75); INSERT INTO virtual_tours_co (tour_id,tour_name,country,duration) VALUES (3,'Virtual Tour Cartagena','Colombia',90); | SELECT country, AVG(duration) FROM virtual_tours_co WHERE country = 'Colombia'; |
What is the average monetary aid received per family in Central America, grouped by disaster type, ordered by the highest average? | CREATE TABLE disaster_response (family_id INT,region VARCHAR(20),disaster_type VARCHAR(20),amount_aid FLOAT); INSERT INTO disaster_response (family_id,region,disaster_type,amount_aid) VALUES (1,'Central America','Flood',5000),(2,'Central America','Earthquake',7000),(3,'Central America','Flood',6000); | SELECT disaster_type, AVG(amount_aid) as avg_aid FROM disaster_response WHERE region = 'Central America' GROUP BY disaster_type ORDER BY avg_aid DESC; |
Display the names of biosensors, their types, and the date of development from the 'biosensor_development' table for biosensors developed on or after 'January 1, 2023'. | CREATE TABLE biosensor_development (id INT,biosensor_name VARCHAR(50),sensor_type VARCHAR(50),data TEXT,date DATE); INSERT INTO biosensor_development (id,biosensor_name,sensor_type,data,date) VALUES (1,'BioSensor 1','optical','Sensor data 1','2023-01-01'); INSERT INTO biosensor_development (id,biosensor_name,sensor_type,data,date) VALUES (2,'BioSensor 2','electrochemical','Sensor data 2','2022-02-01'); | SELECT biosensor_name, sensor_type, date FROM biosensor_development WHERE date >= '2023-01-01'; |
What is the proportion of sales from sustainable fabrics? | CREATE TABLE sales (id INT,fabric TEXT,revenue DECIMAL); INSERT INTO sales (id,fabric,revenue) VALUES (1,'Organic Cotton',1500),(2,'Recycled Polyester',2000),(3,'Conventional Cotton',1000),(4,'Nylon',1200); | SELECT SUM(CASE WHEN fabric IN ('Organic Cotton', 'Recycled Polyester') THEN revenue ELSE 0 END) / SUM(revenue) FROM sales; |
What is the total mass of chemical 'A' produced per month? | CREATE TABLE ChemicalProduction (date DATE,chemical VARCHAR(10),mass FLOAT); INSERT INTO ChemicalProduction (date,chemical,mass) VALUES ('2021-01-01','A',100),('2021-01-01','B',150),('2021-01-02','A',120),('2021-01-02','B',170); | SELECT DATE_FORMAT(date, '%Y-%m') as Month, SUM(mass) as TotalMass FROM ChemicalProduction WHERE chemical = 'A' GROUP BY Month; |
What is the average fare for buses in New York? | CREATE TABLE buses (route_id INT,city VARCHAR(50),fare DECIMAL(5,2)); INSERT INTO buses (route_id,city,fare) VALUES (1,'New York',2.50),(2,'New York',2.75),(3,'Los Angeles',1.75); | SELECT AVG(fare) FROM buses WHERE city = 'New York'; |
Which cities have the most restaurants with a Michelin star, and how many restaurants are there in each city? | CREATE TABLE RestaurantGuide (RestaurantID int,City varchar(50),Stars int); | SELECT City, COUNT(*) FROM RestaurantGuide WHERE Stars = 1 GROUP BY City ORDER BY COUNT(*) DESC; |
Insert a new record into the 'reservoirs' table for reservoir 'R-02' in field 'F-01' with gas content 90 and oil grade 'heavy' | CREATE TABLE reservoirs (reservoir_id INT,reservoir_name VARCHAR(255),field_name VARCHAR(255),oil_grade VARCHAR(255),gas_content FLOAT); | INSERT INTO reservoirs (reservoir_id, reservoir_name, field_name, oil_grade, gas_content) VALUES (NULL, 'R-02', 'F-01', 'heavy', 90); |
List all the distinct 'species' names in the 'harvested_trees' table. | CREATE TABLE harvested_trees (id INT,species VARCHAR(50),volume FLOAT); | SELECT DISTINCT species FROM harvested_trees; |
What is the earliest departure date for vessel_x? | CREATE TABLE voyages (voyage_id INT,vessel_id VARCHAR(10),departure_date DATE); INSERT INTO voyages (voyage_id,vessel_id,departure_date) VALUES (1,'vessel_x','2022-01-02'),(2,'vessel_y','2022-02-03'),(3,'vessel_z','2022-03-04'); | SELECT MIN(departure_date) FROM voyages WHERE vessel_id = 'vessel_x'; |
What is the average attendance at cultural events in Europe by month? | CREATE SCHEMA attendance; CREATE TABLE event_attendance (attendance_id INT,event_id INT,country VARCHAR(50),event_month VARCHAR(10),attendees INT); INSERT INTO attendance.event_attendance (attendance_id,event_id,country,event_month,attendees) VALUES (1,1,'France','January',200),(2,2,'Germany','February',300),(3,3,'Italy','March',150),(4,4,'Spain','January',250),(5,5,'UK','February',400); | SELECT event_month, AVG(attendees) as average_attendance FROM attendance.event_attendance GROUP BY event_month; |
What are the names of organizations working on ethical AI in Europe? | CREATE TABLE org_ethics (org_id INT,org_name TEXT,region TEXT); INSERT INTO org_ethics (org_id,org_name,region) VALUES (1,'OrgD','Europe'),(2,'OrgE','Asia-Pacific'),(3,'OrgF','Europe'); | SELECT org_name FROM org_ethics WHERE region = 'Europe' AND initiative = 'ethical AI'; |
Which fund has invested the least in the renewable energy sector? | CREATE TABLE investments (id INT,fund_name VARCHAR(255),sector VARCHAR(255),investment_amount FLOAT); | SELECT fund_name, MIN(investment_amount) as least_investment FROM investments WHERE sector = 'renewable energy' GROUP BY fund_name ORDER BY least_investment LIMIT 1; |
Insert a new record into 'regulatory_compliance' table for 'Green Earth Dispensary' with a fine of $2000 and violation date of '2022-01-01'. | CREATE TABLE regulatory_compliance (id INT,dispensary VARCHAR(255),fine FLOAT,violation DATE); | INSERT INTO regulatory_compliance (dispensary, fine, violation) VALUES ('Green Earth Dispensary', 2000, '2022-01-01'); |
Count the number of dams built before 1950 | CREATE TABLE dams (id INT,name VARCHAR(50),category VARCHAR(50),year_built INT); INSERT INTO dams (id,name,category,year_built) VALUES (1,'Hoover Dam','hydroelectric',1936); INSERT INTO dams (id,name,category,year_built) VALUES (2,'Grand Coulee Dam','hydroelectric',1942); INSERT INTO dams (id,name,category,year_built) VALUES (3,'Agua Caliente Dam','concrete',1951); | SELECT COUNT(*) FROM dams WHERE year_built < 1950; |
What is the number of volunteers from Asia who have joined in the last year? | CREATE TABLE Volunteers (VolunteerID INT,VolunteerName TEXT,Country TEXT,JoinDate DATE); INSERT INTO Volunteers (VolunteerID,VolunteerName,Country,JoinDate) VALUES (1,'Ali','Pakistan','2021-01-01'),(2,'Sophia','China','2020-06-15'); | SELECT COUNT(*) FROM Volunteers WHERE Country IN ('Pakistan', 'India', 'China', 'Japan', 'Vietnam') AND JoinDate >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); |
What is the number of regulatory violations for each blockchain network? | CREATE TABLE if not exists regulatory_violations (violation_id INT,network VARCHAR(255),violation_details VARCHAR(255)); INSERT INTO regulatory_violations (violation_id,network,violation_details) VALUES (1,'Ethereum','Smart contract vulnerabilities'),(2,'Binance Smart Chain','Lack of KYC'),(3,'Tron','Centralization concerns'),(4,'Cardano','Regulatory uncertainty'),(5,'Polkadot','Data privacy issues'),(6,'Solana','Lack of transparency'); | SELECT network, COUNT(*) as violation_count FROM regulatory_violations GROUP BY network; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.