instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Minimum marketing budget for Latin music released since 2010? | CREATE TABLE songs (id INT,title VARCHAR(100),genre VARCHAR(50),release_year INT,marketing_budget DECIMAL(10,2)); INSERT INTO songs (id,title,genre,release_year,marketing_budget) VALUES (1,'Song1','Pop',2009,250000.00),(2,'Song2','Latin',2011,300000.00),(3,'Song3','Jazz',2015,150000.00); | SELECT MIN(marketing_budget) FROM songs WHERE genre = 'Latin' AND release_year >= 2010; |
What are the drug names and their respective total sales for oncology drugs with sales greater than psychiatric drugs' total sales? | CREATE TABLE sales (id INT,drug_id INT,quarter INT,year INT,revenue FLOAT); INSERT INTO sales (id,drug_id,quarter,year,revenue) VALUES (1,1,1,2022,1500000); CREATE TABLE drugs (id INT,name VARCHAR(50),company VARCHAR(50),indication VARCHAR(50)); INSERT INTO drugs (id,name,company,indication) VALUES (1,'DrugA','ABC Corp... | SELECT s.drug_id, d.name, SUM(s.revenue) as total_sales FROM sales s JOIN drugs d ON s.drug_id = d.id WHERE d.indication = 'Oncology' GROUP BY s.drug_id HAVING total_sales > (SELECT SUM(s2.revenue) FROM sales s2 JOIN drugs d2 ON s2.drug_id = d2.id WHERE d2.indication = 'Psychiatric') |
List all pollution control initiatives and their funding amounts. | CREATE TABLE pollution_control_initiatives (initiative_name TEXT,funding_amount FLOAT); INSERT INTO pollution_control_initiatives (initiative_name,funding_amount) VALUES ('Clean Oceans Act',15000000.0),('Ocean Restoration Project',20000000.0),('Plastic Reduction Program',10000000.0); | SELECT * FROM pollution_control_initiatives; |
What is the average fuel consumption for vessels in the Atlantic region? | CREATE TABLE Vessels (VesselID varchar(10),Region varchar(10),FuelConsumption int); INSERT INTO Vessels (VesselID,Region,FuelConsumption) VALUES ('VesselA','Asia-Pacific',1000),('VesselC','Atlantic',1500); | SELECT AVG(FuelConsumption) FROM Vessels WHERE Region = 'Atlantic'; |
What is the maximum cargo weight for each accident type? | CREATE TABLE cargo_accidents (id INT,trip_id INT,accident_type VARCHAR(50),cargo_weight INT); INSERT INTO cargo_accidents VALUES (1,1,'Collision',500),(2,1,'Grounding',600),(3,2,'Collision',700),(4,3,'Fire',800); | SELECT accident_type, MAX(cargo_weight) FROM cargo_accidents GROUP BY accident_type; |
Calculate the average savings of customers who have a socially responsible loan | CREATE TABLE savings (customer_id INT,savings DECIMAL(10,2)); CREATE TABLE loans (customer_id INT,is_socially_responsible BOOLEAN); | SELECT AVG(savings) FROM savings INNER JOIN loans ON savings.customer_id = loans.customer_id WHERE is_socially_responsible = TRUE; |
What is the average duration of cases for each court, partitioned by case type, in descending order of average duration? | CREATE TABLE courts (court_id INT,name VARCHAR(50)); INSERT INTO courts (court_id,name) VALUES (1001,'Court A'),(1002,'Court B'),(1003,'Court C'); CREATE TABLE cases (case_id INT,court_id INT,case_type VARCHAR(20),duration INT); INSERT INTO cases (case_id,court_id,case_type,duration) VALUES (1,1001,'Civil',30),(2,1001,... | SELECT court_id, case_type, AVG(duration) as avg_duration FROM cases GROUP BY court_id, case_type ORDER BY avg_duration DESC; |
List all countries and their respective military innovation expenditures for the year 2020 | CREATE TABLE military_expenditure (country VARCHAR(50),year INT,expenditure FLOAT); INSERT INTO military_expenditure (country,year,expenditure) VALUES ('USA',2020,775000000),('China',2020,250000000),('Russia',2020,65000000),('India',2020,60000000),('Germany',2020,48000000); | SELECT country, expenditure FROM military_expenditure WHERE year = 2020; |
insert a new campaign into the "campaigns" table | CREATE TABLE campaigns (campaign_id INT,campaign_name VARCHAR(50),budget INT); | INSERT INTO campaigns (campaign_id, campaign_name, budget) |
How many hours did each volunteer contribute in H1 2022? | CREATE TABLE Volunteers (volunteer_id INT,program_id INT,volunteer_date DATE,hours DECIMAL(10,2)); INSERT INTO Volunteers (volunteer_id,program_id,volunteer_date,hours) VALUES (1,1001,'2022-04-02',3.00),(2,1002,'2022-01-15',5.00),(3,1001,'2022-06-01',4.00); | SELECT volunteer_id, SUM(hours) as total_hours FROM Volunteers WHERE volunteer_date BETWEEN '2022-01-01' AND '2022-06-30' GROUP BY volunteer_id; |
Find the top 5 most-watched animated movies released in Japan between 2010 and 2020, ordered by global gross. | CREATE TABLE movie (id INT,title VARCHAR(100),release_year INT,country VARCHAR(50),genre VARCHAR(50),global_gross INT); INSERT INTO movie (id,title,release_year,country,genre,global_gross) VALUES (1,'Movie1',2015,'Japan','Animation',500000000); INSERT INTO movie (id,title,release_year,country,genre,global_gross) VALUES... | SELECT title, global_gross FROM movie WHERE country = 'Japan' AND genre = 'Animation' AND release_year BETWEEN 2010 AND 2020 ORDER BY global_gross DESC LIMIT 5; |
What is the total number of songs and their average length for each platform? | CREATE TABLE songs (song_id INT,title TEXT,length FLOAT,platform TEXT); | SELECT platform, COUNT(*), AVG(length) FROM songs GROUP BY platform; |
What is the total weight of all shipments from suppliers in the 'Europe' region? | CREATE TABLE Suppliers (id INT,name VARCHAR(50),region VARCHAR(50)); CREATE TABLE Shipments (id INT,Supplier_id INT,weight INT); INSERT INTO Suppliers (id,name,region) VALUES (1,'Oceanic Harvest','Asia'),(2,'European Harvest','Europe'),(3,'North American Harvest','North America'); INSERT INTO Shipments (id,Supplier_id,... | SELECT SUM(weight) FROM Shipments JOIN Suppliers ON Shipments.Supplier_id = Suppliers.id WHERE Suppliers.region = 'Europe'; |
What is the minimum salary of construction workers in each state? | CREATE TABLE construction_workers (worker_id INT,occupation VARCHAR(50),state VARCHAR(50),salary INT); INSERT INTO construction_workers (worker_id,occupation,state,salary) VALUES (1,'Carpenter','California',60000); INSERT INTO construction_workers (worker_id,occupation,state,salary) VALUES (2,'Electrician','California'... | SELECT state, MIN(salary) FROM construction_workers GROUP BY state; |
What is the highest and lowest temperature recorded in farms? | CREATE TABLE farm (id INT PRIMARY KEY,name VARCHAR(50),avg_temp DECIMAL(5,2)); INSERT INTO farm (id,name,avg_temp) VALUES (1,'Smith Farm',15.5),(2,'Jones Farm',16.3),(3,'Brown Farm',20.2); | SELECT MIN(f.avg_temp) AS lowest_temp, MAX(f.avg_temp) AS highest_temp FROM farm f; |
What are the names and budgets of all ethical AI projects in Africa? | CREATE TABLE ethical_ai_projects (id INT,location VARCHAR(255),budget DECIMAL(10,2)); INSERT INTO ethical_ai_projects (id,location,budget) VALUES (1,'Africa',250000.00); INSERT INTO ethical_ai_projects (id,location,budget) VALUES (2,'Asia',300000.00); | SELECT name, budget FROM ethical_ai_projects WHERE location = 'Africa'; |
What is the budget for each program? | CREATE TABLE Budget (id INT,program_id INT,amount DECIMAL(10,2)); | SELECT Program.name, SUM(Budget.amount) as total_budget FROM Budget JOIN Program ON Budget.program_id = Program.id GROUP BY Program.name; |
What is the minimum response time for emergency calls in the city of San Francisco? | CREATE TABLE EmergencyCalls (id INT,city VARCHAR(20),response_time FLOAT); | SELECT MIN(response_time) FROM EmergencyCalls WHERE city = 'San Francisco'; |
What is the percentage of hotels that have adopted AI in 'Europe'? | CREATE TABLE hotels(id INT,name TEXT,country TEXT,ai BOOLEAN); | SELECT 100.0 * COUNT(CASE WHEN ai = TRUE THEN 1 END) / COUNT(*) AS percentage FROM hotels WHERE country = 'Europe'; |
Display the total number of manufacturing jobs for each country, ordered from the country with the most jobs to the country with the least jobs. | CREATE TABLE job_count (id INT,country VARCHAR(50),job VARCHAR(50)); INSERT INTO job_count (id,country,job) VALUES (1,'USA','Engineer'),(2,'Mexico','Assembler'),(3,'China','Quality Control'),(4,'USA','Assembler'),(5,'Mexico','Engineer'); | SELECT country, COUNT(*) as total_jobs FROM job_count GROUP BY country ORDER BY total_jobs DESC; |
What is the average pollution level per mining operation for each country? | CREATE TABLE MiningOperation (OperationID int,OperationName varchar(50),Country varchar(50),PollutionLevel int); INSERT INTO MiningOperation VALUES (1,'ABC Operation','USA',50),(2,'DEF Operation','Canada',40),(3,'GHI Operation','Mexico',60),(4,'JKL Operation','Brazil',45); | SELECT Country, AVG(PollutionLevel) as AveragePollutionLevel FROM MiningOperation GROUP BY Country; |
What is the total revenue generated from ticket sales for the LA Lakers and the Chicago Bulls? | CREATE TABLE teams (team_id INT,team_name VARCHAR(50)); INSERT INTO teams (team_id,team_name) VALUES (1,'NY Knicks'),(2,'LA Lakers'),(3,'Chicago Bulls'); CREATE TABLE ticket_sales (id INT,team_id INT,revenue INT); | SELECT SUM(ticket_sales.revenue) FROM ticket_sales JOIN teams ON ticket_sales.team_id = teams.team_id WHERE teams.team_name IN ('LA Lakers', 'Chicago Bulls'); |
How many news articles were published in the "news_articles" table by authors from Canada? | CREATE TABLE news_articles (id INT,title VARCHAR(100),author_id INT,published_date DATE,country VARCHAR(50)); INSERT INTO news_articles (id,title,author_id,published_date,country) VALUES (1,'News Article 1',1,'2022-01-01','Canada'),(2,'News Article 2',2,'2022-01-02','USA'); | SELECT COUNT(*) FROM news_articles WHERE country = 'Canada'; |
What is the total value of economic diversification investments in 'Latin America'? | CREATE TABLE investments (id INT,name TEXT,region TEXT,value FLOAT); INSERT INTO investments (id,name,region,value) VALUES (1,'Investment 1','Latin America',500000),(2,'Investment 2','Latin America',750000); | SELECT SUM(investments.value) FROM investments WHERE investments.region = 'Latin America'; |
Which smart_city_features are present in both 'CityA' and 'CityB'? | CREATE TABLE smart_city_features (city VARCHAR(50),feature VARCHAR(50)); INSERT INTO smart_city_features (city,feature) VALUES ('CityA','Smart Lighting'),('CityB','Smart Waste Management'); | SELECT feature FROM smart_city_features WHERE city = 'CityA' INTERSECT SELECT feature FROM smart_city_features WHERE city = 'CityB'; |
Identify property co-ownerships in the city of Seattle, Washington with a total price above 1 million dollars. | CREATE TABLE properties (id INT,city VARCHAR(50),price DECIMAL(12,2),coowner_count INT); INSERT INTO properties (id,city,price,coowner_count) VALUES (1,'Seattle',1200000.00,2),(2,'Seattle',900000.00,1),(3,'Seattle',1500000.00,3); | SELECT * FROM properties WHERE city = 'Seattle' AND price > 1000000.00 AND coowner_count > 1; |
Which satellites were launched in the last 3 years? | CREATE TABLE Satellites (SatelliteID int,SatelliteName varchar(50),LaunchCountryID int,LaunchDate date); CREATE TABLE Countries (CountryID int,CountryName varchar(50)); INSERT INTO Satellites VALUES (1,'Sat1',1,'2020-01-01'),(2,'Sat2',1,'2021-05-15'),(3,'Sat3',2,'2019-03-12'),(4,'Sat4',3,'2022-06-18'),(5,'Sat5',4,'2020... | SELECT s.SatelliteName FROM Satellites s INNER JOIN Countries c ON s.LaunchCountryID = c.CountryID WHERE s.LaunchDate >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY s.SatelliteName; |
How many communities in the 'indigenous_communities' table are located in each region, and what is the total population? | CREATE TABLE indigenous_communities (community_id INT,community_name VARCHAR(255),population INT,region VARCHAR(255)); | SELECT r.region, COUNT(c.community_name) AS community_count, SUM(c.population) AS total_population FROM indigenous_communities c INNER JOIN (SELECT DISTINCT region FROM indigenous_communities) r ON c.region = r.region GROUP BY r.region; |
What is the average price of sustainable fabric types? | CREATE TABLE Fabrics (id INT,fabric_type VARCHAR(255),sustainable BOOLEAN,price DECIMAL(5,2)); INSERT INTO Fabrics (id,fabric_type,sustainable,price) VALUES (1,'Cotton',true,5.00),(2,'Polyester',false,3.00),(3,'Hemp',true,7.00),(4,'Rayon',false,4.00); | SELECT AVG(Fabrics.price) FROM Fabrics WHERE Fabrics.sustainable = true; |
How many metric tons of Dysprosium were extracted in Australia between 2015 and 2019? | CREATE TABLE Dysprosium_Production (id INT,year INT,country VARCHAR(255),quantity FLOAT); | SELECT SUM(quantity) FROM Dysprosium_Production WHERE year BETWEEN 2015 AND 2019 AND country = 'Australia'; |
Add new player 'Sarah' from 'CA' with email 'sarah@email.com' | player (player_id,name,email,age,gender,country,total_games_played,join_date) | INSERT INTO player (name, email, age, gender, country, total_games_played, join_date) VALUES ('Sarah', 'sarah@email.com', 25, 'Female', 'CA', 0, '2023-03-15') |
What is the total revenue for each manufacturer in the past month? | CREATE TABLE manufacturers (id INT PRIMARY KEY,name VARCHAR(255),location VARCHAR(255),sustainability_score FLOAT); INSERT INTO manufacturers (id,name,location,sustainability_score) VALUES (1,'XYZ Fashions','Paris,France',8.2); CREATE TABLE sales (id INT PRIMARY KEY,manufacturer_id INT,date DATE,units INT,revenue FLOAT... | SELECT m.name, SUM(s.revenue) AS total_revenue FROM manufacturers m JOIN sales s ON m.id = s.manufacturer_id WHERE s.date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 MONTH) AND CURDATE() GROUP BY m.id; |
Show companies with a diversity score above the industry average | CREATE TABLE companies (id INT,name VARCHAR(50),industry VARCHAR(50),diversity_score DECIMAL(3,2)); INSERT INTO companies VALUES (1,'Acme Corp','Technology',0.85); INSERT INTO companies VALUES (2,'Beta Inc','Retail',0.70); | SELECT companies.name, companies.diversity_score FROM companies INNER JOIN (SELECT industry, AVG(diversity_score) AS industry_avg FROM companies GROUP BY industry) AS industry_averages ON companies.industry = industry_averages.industry WHERE companies.diversity_score > industry_averages.industry_avg; |
What is the total number of employees in the manufacturing industry across all regions? | CREATE TABLE manufacturing_employees (id INT,region VARCHAR(255),industry VARCHAR(255),employees INT); | SELECT SUM(employees) FROM manufacturing_employees WHERE industry = 'Manufacturing'; |
What is the average salary of female employees in the Production dept? | CREATE TABLE Employees (id INT,name VARCHAR(50),department VARCHAR(50),salary DECIMAL(10,2)); | SELECT AVG(salary) FROM Employees WHERE gender = 'female' AND department = 'Production'; |
How many digital divide initiatives were completed by organizations in South America? | CREATE TABLE Initiatives (id INT,name VARCHAR(50),organization VARCHAR(50),region VARCHAR(50),completed BOOLEAN); INSERT INTO Initiatives (id,name,organization,region,completed) VALUES (1,'Digital Divide Research','Global Connect','South America',true),(2,'Access to Technology Education','Tech Learning','North America'... | SELECT COUNT(*) FROM Initiatives WHERE region = 'South America' AND completed = true; |
Determine the number of unique donors who gave more than $100 in Q4 2021. | CREATE TABLE donors (id INT PRIMARY KEY,donor_id INT); INSERT INTO donors (id,donor_id) VALUES (1,1); CREATE TABLE donations (id INT PRIMARY KEY,donor_id INT,donation_amount INT,donation_date DATE); INSERT INTO donations (id,donor_id,donation_amount,donation_date) VALUES (1,1,150,'2021-12-01'); | SELECT COUNT(DISTINCT donor_id) FROM donations WHERE donation_amount > 100 AND donation_date BETWEEN '2021-10-01' AND '2021-12-31'; |
What is the average solar power capacity (in kW) of residential buildings in India? | CREATE TABLE solar_buildings_2 (building_id INT,building_type TEXT,country TEXT,capacity_kw FLOAT); INSERT INTO solar_buildings_2 (building_id,building_type,country,capacity_kw) VALUES (1,'Residential','India',5),(2,'Residential','India',7); | SELECT country, AVG(capacity_kw) FROM solar_buildings_2 WHERE building_type = 'Residential'; |
Who are the top 3 donors in Canada by amount donated in 2021? | CREATE TABLE Donors (DonorID int,DonorName varchar(50),Country varchar(50),AmountDonated numeric(18,2),DonationDate date); INSERT INTO Donors (DonorID,DonorName,Country,AmountDonated,DonationDate) VALUES (1,'John Doe','Canada',8000,'2021-01-01'),(2,'Jane Smith','Canada',9000,'2021-02-01'),(3,'Mike Johnson','Canada',700... | SELECT DonorName, SUM(AmountDonated) as TotalDonated FROM Donors WHERE Country = 'Canada' AND YEAR(DonationDate) = 2021 GROUP BY DonorName ORDER BY TotalDonated DESC LIMIT 3; |
What is the average number of public participations for initiatives launched in Q1? | CREATE TABLE participations (initiative_id INT,launch_date DATE,num_participants INT); INSERT INTO participations (initiative_id,launch_date,num_participants) VALUES (1,'2021-01-01',500),(2,'2021-11-15',700),(3,'2021-04-01',300),(4,'2021-12-20',800),(5,'2021-07-01',600); | SELECT AVG(num_participants) FROM participations WHERE EXTRACT(QUARTER FROM launch_date) = 1; |
What are the top 5 most vulnerable systems in the organization based on their Common Vulnerability Scoring System (CVSS) scores? | CREATE TABLE systems (system_id INT,system_name VARCHAR(255),cvss_score DECIMAL(3,2)); CREATE TABLE vulnerabilities (vulnerability_id INT,system_id INT,vulnerability_description TEXT); | SELECT s.system_name, s.cvss_score FROM systems s JOIN (SELECT system_id, MAX(cvss_score) AS max_cvss FROM systems GROUP BY system_id) max_scores ON s.system_id = max_scores.system_id ORDER BY s.cvss_score DESC LIMIT 5; |
Delete all records from the aircraft_manufacturing table where the manufacturing_year is less than 2010 | CREATE TABLE aircraft_manufacturing (id INT PRIMARY KEY,model VARCHAR(100),manufacturing_year INT); | DELETE FROM aircraft_manufacturing WHERE manufacturing_year < 2010; |
Show all records from the 'research_projects' table where 'start_date' is in the year 2020 | CREATE TABLE research_projects (id INT,name VARCHAR(50),start_date DATE,end_date DATE,organization_id INT); INSERT INTO research_projects (id,name,start_date,end_date,organization_id) VALUES (1,'Ethical AI','2020-01-01','2021-12-31',1),(2,'Digital Divide','2019-01-01','2020-12-31',2),(3,'Tech for Social Good','2021-01-... | SELECT * FROM research_projects WHERE YEAR(start_date) = 2020; |
What is the maximum number of security incidents that occurred in a single day in the LATAM region in 2022? | CREATE TABLE daily_incidents (region TEXT,date DATE,incident_count INT); INSERT INTO daily_incidents (region,date,incident_count) VALUES ('LATAM','2022-01-01',3),('LATAM','2022-01-03',5),('LATAM','2022-01-05',2); | SELECT MAX(incident_count) FROM daily_incidents WHERE region = 'LATAM' AND date >= '2022-01-01'; |
List all music festivals and the number of artists performing, sorted by the number of artists in descending order. | CREATE TABLE festivals (festival_id INT,festival_name VARCHAR(100),festival_country VARCHAR(50)); CREATE TABLE festival_artists (festival_id INT,artist_id INT); INSERT INTO festivals (festival_id,festival_name,festival_country) VALUES (1,'Coachella','United States'),(2,'Glastonbury','United Kingdom'); INSERT INTO festi... | SELECT f.festival_name, COUNT(fa.artist_id) AS artists_count FROM festivals f LEFT JOIN festival_artists fa ON f.festival_id = fa.festival_id GROUP BY f.festival_id ORDER BY artists_count DESC; |
Add a new product with a transparent supply chain | CREATE TABLE products (product_id INT,product_name VARCHAR(50),supply_chain_transparency VARCHAR(50)); | INSERT INTO products (product_id, product_name, supply_chain_transparency) VALUES (5, 'Product F', 'Transparent'); |
Insert new eSports tournament data | CREATE TABLE esports_tournaments (id INT PRIMARY KEY,name VARCHAR(50),game_name VARCHAR(50),location VARCHAR(50),start_date DATE,end_date DATE); | INSERT INTO esports_tournaments (id, name, game_name, location, start_date, end_date) VALUES (1, 'Tournament A', 'Game X', 'USA', '2023-01-01', '2023-01-03'); |
How many companies were founded in each year? | CREATE TABLE company_profiles (company_id INT,founding_year INT); INSERT INTO company_profiles (company_id,founding_year) VALUES (1,2010),(2,2012),(3,2010),(4,2011),(5,2009),(6,2008),(7,2008),(8,2011),(9,2010),(10,2012); | SELECT founding_year, COUNT(*) FROM company_profiles GROUP BY founding_year; |
What is the name of the aircraft and their maximum speed, ordered by the maximum speed? | CREATE TABLE Aircraft (ID INT,Name VARCHAR(50),MaxSpeed FLOAT); | SELECT Name, MaxSpeed FROM Aircraft ORDER BY MaxSpeed DESC; |
Add a new record to the "hospitals" table for a hospital located in "AZ" with 1000 total beds | CREATE TABLE hospitals (id INT PRIMARY KEY,name TEXT,state TEXT,total_beds INT); | INSERT INTO hospitals (name, state, total_beds) VALUES ('Hospital AZ', 'AZ', 1000); |
Which mining operations in 'Asia' region have a workforce diversity score above 0.6? | CREATE TABLE mining_operations_asia (id INT,mine_name VARCHAR(50),department VARCHAR(50),employee VARCHAR(50),age INT,ethnicity VARCHAR(20)); CREATE VIEW workforce_diversity_asia AS SELECT department,((MAX(count) - MIN(count)) / MAX(count)) AS diversity_score FROM (SELECT department,ethnicity,COUNT(*) AS count FROM min... | SELECT mine_name FROM mining_operations_asia JOIN workforce_diversity_asia ON TRUE WHERE workforce_diversity_asia.diversity_score > 0.6 AND region = 'Asia'; |
What is the total number of police officers in each division? | CREATE TABLE divisions (divid INT,name TEXT);CREATE TABLE police_officers (pid INT,divid INT,active BOOLEAN); | SELECT divisions.name, COUNT(police_officers.pid) FROM divisions INNER JOIN police_officers ON divisions.divid = police_officers.divid WHERE police_officers.active = TRUE GROUP BY divisions.name; |
What is the maximum funding received by a startup founded by a Latinx individual in the technology sector? | CREATE TABLE startups(id INT,name TEXT,industry TEXT,founder_gender TEXT,funding FLOAT); INSERT INTO startups (id,name,industry,founder_gender,funding) VALUES (1,'TechLatino','Technology','Latinx',15000000); | SELECT MAX(funding) FROM startups WHERE industry = 'Technology' AND founder_gender = 'Latinx'; |
What is the average founding year for startups founded by individuals who identify as Indigenous in the e-commerce industry? | CREATE TABLE startups(id INT,name TEXT,founders TEXT,founding_year INT,industry TEXT); INSERT INTO startups VALUES (1,'StartupA','Aisha,Bob',2010,'E-commerce'); INSERT INTO startups VALUES (2,'StartupB','Eve',2015,'Healthcare'); INSERT INTO startups VALUES (3,'StartupC','Carlos',2018,'Tech'); CREATE TABLE investments(s... | SELECT AVG(founding_year) FROM startups WHERE industry = 'E-commerce' AND founders LIKE '%Aisha%'; |
Identify the number of 'Organic Farms' and 'Conventional Farms' in 'Amazon Rainforest'? | CREATE TABLE FarmTypes (FarmTypeID INT,FarmType TEXT); INSERT INTO FarmTypes (FarmTypeID,FarmType) VALUES (1,'Organic Farm'); INSERT INTO FarmTypes (FarmTypeID,FarmType) VALUES (2,'Conventional Farm'); CREATE TABLE Farms (FarmID INT,FarmTypeID INT,Location TEXT); INSERT INTO Farms (FarmID,FarmTypeID,Location) VALUES (1... | SELECT FarmTypes.FarmType, COUNT(*) as Count FROM Farms INNER JOIN FarmTypes ON Farms.FarmTypeID = FarmTypes.FarmTypeID WHERE Farms.Location = 'Amazon Rainforest' GROUP BY FarmTypes.FarmType; |
What is the total budget allocated to transportation and infrastructure in the state of Florida, and what is the percentage of the total budget that this represents? | CREATE TABLE budget_allocation (state VARCHAR(20),category VARCHAR(20),budget FLOAT); INSERT INTO budget_allocation (state,category,budget) VALUES ('Florida','Transportation',15000000),('Florida','Infrastructure',20000000),('Florida','Education',10000000); CREATE TABLE total_budget (state VARCHAR(20),total_budget FLOAT... | SELECT (budget / total_budget) * 100 as percentage FROM budget_allocation INNER JOIN total_budget ON budget_allocation.state = total_budget.state WHERE budget_allocation.state = 'Florida' AND budget_allocation.category IN ('Transportation', 'Infrastructure'); |
What is the minimum price of vegetarian dishes across all cuisine types? | CREATE TABLE VegetarianDishes (menu_item VARCHAR(50),cuisine VARCHAR(20),type VARCHAR(20),price DECIMAL(5,2)); INSERT INTO VegetarianDishes (menu_item,cuisine,type,price) VALUES ('Vegetable Lasagna','Italian','Vegetarian',11.99),('Vegetable Curry','Indian','Vegetarian',9.99),('Vegetable Sushi Rolls','Japanese','Vegetar... | SELECT MIN(price) FROM VegetarianDishes WHERE type = 'Vegetarian'; |
What is the success rate of the 'Art Therapy' group sessions? | CREATE TABLE sessions (session_id INT,name VARCHAR(255),success BOOLEAN); INSERT INTO sessions (session_id,name,success) VALUES (1,'Art Therapy',true); INSERT INTO sessions (session_id,name,success) VALUES (2,'Music Therapy',false); INSERT INTO sessions (session_id,name,success) VALUES (3,'Art Therapy',true); INSERT IN... | SELECT AVG(sessions.success) FROM sessions WHERE sessions.name = 'Art Therapy'; |
How many employees work in the manufacturing sector in Mexico and Vietnam? | CREATE TABLE employee_data (country VARCHAR(50),industry VARCHAR(50),num_employees INT); INSERT INTO employee_data (country,industry,num_employees) VALUES ('Mexico','Manufacturing',5000000),('Vietnam','Manufacturing',3000000); | SELECT country, SUM(num_employees) FROM employee_data WHERE country IN ('Mexico', 'Vietnam') GROUP BY country; |
What is the earliest artifact date for 'site_f'? | CREATE TABLE excavation_sites (site_id INT,site_name VARCHAR(255)); CREATE TABLE artifacts (artifact_id INT,site_id INT,artifact_type VARCHAR(255),date_found DATE); INSERT INTO excavation_sites (site_id,site_name) VALUES (1,'site_a'),(2,'site_b'),(3,'site_c'),(4,'site_d'),(5,'site_e'),(6,'site_f'); INSERT INTO artifact... | SELECT MIN(date_found) FROM artifacts WHERE site_id = (SELECT site_id FROM excavation_sites WHERE site_name = 'site_f'); |
List the companies with the lowest ESG ratings in the financial sector. | CREATE TABLE companies (id INT,name TEXT,sector TEXT,ESG_rating FLOAT); INSERT INTO companies (id,name,sector,ESG_rating) VALUES (1,'JPMorgan Chase','Financial',7.4),(2,'Visa','Financial',8.1),(3,'BlackRock','Financial',8.0),(4,'Bank of America','Financial',7.2),(5,'Wells Fargo','Financial',7.1); | SELECT * FROM companies WHERE sector = 'Financial' ORDER BY ESG_rating ASC; |
What is the total donation amount for non-profit organizations focused on 'Environment' in 'California'? | CREATE TABLE organization_info (name VARCHAR(50),focus VARCHAR(30),location VARCHAR(30)); INSERT INTO organization_info (name,focus,location) VALUES ('Green Earth','Environment','California'); | SELECT SUM(donation_amount) FROM donations JOIN organization_info ON donations.org_id = organization_info.id WHERE organization_info.focus = 'Environment' AND organization_info.location = 'California'; |
How many new chemical substances have been added to the database in the past 6 months? | CREATE TABLE ChemicalSubstances (SubstanceID INT,SubstanceName VARCHAR(50),AdditionDate DATE); INSERT INTO ChemicalSubstances (SubstanceID,SubstanceName,AdditionDate) VALUES (1,'Ethylene','2021-01-02'),(2,'Propylene','2021-03-14'),(3,'Benzenene','2020-11-09'); | SELECT COUNT(*) FROM ChemicalSubstances WHERE AdditionDate >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); |
What is the minimum number of machines in the manufacturing industry for each region? | CREATE TABLE manufacturing_machines (id INT,region VARCHAR(255),number_of_machines INT); INSERT INTO manufacturing_machines (id,region,number_of_machines) VALUES (1,'North',2000),(2,'South',3000),(3,'East',1500),(4,'West',2500); | SELECT region, MIN(number_of_machines) FROM manufacturing_machines GROUP BY region; |
How many community development projects were successfully completed in South America? | CREATE TABLE community_development_projects (id INT,name VARCHAR(100),region VARCHAR(50),status VARCHAR(20)); INSERT INTO community_development_projects (id,name,region,status) VALUES (1,'Project A','South America','Completed'),(2,'Project B','North America','In Progress'),(3,'Project C','South America','Completed'); | SELECT COUNT(*) FROM community_development_projects WHERE region = 'South America' AND status = 'Completed'; |
How many animals are in the 'conservation_program' table? | CREATE TABLE conservation_program (id INT PRIMARY KEY,animal_name VARCHAR,num_animals INT); | SELECT SUM(num_animals) FROM conservation_program; |
Determine the monthly oil production for all platforms in Q1 2020 | CREATE TABLE monthly_oil_production (platform_id INT,production_month DATE,oil_production FLOAT); INSERT INTO monthly_oil_production (platform_id,production_month,oil_production) VALUES (1,'2020-01-01',500),(1,'2020-02-01',600),(1,'2020-03-01',700),(2,'2020-01-01',800),(2,'2020-02-01',900),(2,'2020-03-01',1000),(3,'202... | SELECT platform_id, EXTRACT(MONTH FROM production_month) AS month, SUM(oil_production) FROM monthly_oil_production WHERE YEAR(production_month) = 2020 GROUP BY platform_id, month; |
What is the minimum distance traveled by an autonomous taxi in Mexico City? | CREATE TABLE autonomous_taxis (taxi_id INT,trip_id INT,trip_start_time TIMESTAMP,trip_end_time TIMESTAMP,start_latitude DECIMAL(9,6),start_longitude DECIMAL(9,6),end_latitude DECIMAL(9,6),end_longitude DECIMAL(9,6),distance DECIMAL(10,2)); | SELECT MIN(distance) FROM autonomous_taxis WHERE start_longitude BETWEEN -99.3 AND -98.9 AND start_latitude BETWEEN 19.1 AND 19.7; |
What is the total number of donors and total number of unique organizations donated to, in the 'Donors' and 'Organizations' tables? | CREATE TABLE Donors (id INT,name VARCHAR(50),city VARCHAR(50),state VARCHAR(50),country VARCHAR(50),type VARCHAR(10),donation_amount DECIMAL(10,2)); | SELECT COUNT(DISTINCT Donors.id) as total_donors, COUNT(DISTINCT Donations.organization_id) as unique_orgs_donated FROM Donors, Donations; |
Delete the 'appetizers' category | CREATE TABLE menu_categories (category_id INT,category TEXT); INSERT INTO menu_categories (category_id,category) VALUES (1,'appetizers'),(2,'entrees'),(3,'desserts'); | DELETE FROM menu_categories WHERE category = 'appetizers'; |
What is the total advertising revenue generated from campaigns targeting users interested in "renewable energy" in Q3 2021? | CREATE TABLE campaigns (id INT,name TEXT,target TEXT,start_date DATETIME,end_date DATETIME,revenue INT); INSERT INTO campaigns (id,name,target,start_date,end_date,revenue) VALUES (1,'Clean Energy','renewable energy','2021-07-01 00:00:00','2021-09-30 23:59:59',5000); | SELECT SUM(revenue) FROM campaigns WHERE target = 'renewable energy' AND start_date BETWEEN '2021-07-01 00:00:00' AND '2021-09-30 23:59:59'; |
Create a view named "top_students" that contains only students with a GPA greater than or equal to 3.5 from the "students" table. | CREATE TABLE students (student_id INT,name VARCHAR(255),major VARCHAR(255),gpa DECIMAL(3,2)); | CREATE VIEW top_students AS SELECT * FROM students WHERE gpa >= 3.5; |
Which species of fish has the lowest daily growth rate in the European region? | CREATE TABLE FishGrowth (SiteID INT,Species VARCHAR(255),DailyGrowthRate FLOAT,Region VARCHAR(255)); INSERT INTO FishGrowth (SiteID,Species,DailyGrowthRate,Region) VALUES (1,'Tilapia',0.02,'Americas'),(2,'Salmon',0.03,'Americas'),(3,'Tilapia',0.015,'Asia-Pacific'),(4,'Salmon',0.008,'Europe'); | SELECT Species, MIN(DailyGrowthRate) as MinDailyGrowthRate FROM FishGrowth WHERE Region = 'Europe' GROUP BY Species ORDER BY MinDailyGrowthRate; |
What is the average annual budget for schools in cities with populations between 500,000 and 1,000,000? | CREATE TABLE cities (city_name VARCHAR(255),population INT,state_abbreviation VARCHAR(255)); INSERT INTO cities (city_name,population,state_abbreviation) VALUES ('CityD',700000,'CA'),('CityE',1200000,'CA'),('CityF',600000,'CA'); CREATE TABLE schools (school_name VARCHAR(255),city_name VARCHAR(255),annual_budget INT); I... | SELECT AVG(annual_budget) FROM schools WHERE city_name IN (SELECT city_name FROM cities WHERE population BETWEEN 500000 AND 1000000); |
What is the total biomass of all marine mammals in the Antarctic? | CREATE TABLE marine_mammals (id INT,name VARCHAR(255),biomass FLOAT,location VARCHAR(255)); | SELECT SUM(biomass) FROM marine_mammals WHERE location = 'Antarctic'; |
Which attorneys have billed the least for cases in the 'immigration' category? | CREATE TABLE Attorneys (AttorneyID int,Name varchar(50),Specialty varchar(50)); INSERT INTO Attorneys (AttorneyID,Name,Specialty) VALUES (4,'Sophia Lee','Immigration'); CREATE TABLE Billing (CaseID int,AttorneyID int,HoursFraction decimal(3,2)); INSERT INTO Billing (CaseID,AttorneyID,HoursFraction) VALUES (601,4,1.5); ... | SELECT A.Name, MIN(B.HoursFraction) as LeastHoursBilled FROM Attorneys A INNER JOIN Billing B ON A.AttorneyID = B.AttorneyID INNER JOIN Cases CA ON B.CaseID = CA.CaseID WHERE A.Specialty = 'Immigration' GROUP BY A.Name; |
What is the total transaction volume for each regulatory framework in the last 30 days? | CREATE TABLE transactions (tx_id INT,rf_id INT,transaction_volume DECIMAL(10,2),transaction_date DATE); CREATE TABLE regulatory_frameworks (rf_id INT,name VARCHAR(255)); | SELECT rf_id, name, SUM(transaction_volume) OVER (PARTITION BY rf_id) as total_transaction_volume FROM transactions t JOIN regulatory_frameworks rf ON t.rf_id = rf.rf_id WHERE transaction_date >= DATEADD(day, -30, CURRENT_DATE); |
Which TV shows have the highest viewership from Canada? | CREATE TABLE tv_shows (show_id INT PRIMARY KEY,name VARCHAR(255),country VARCHAR(2),viewers INT); INSERT INTO tv_shows (show_id,name,country,viewers) VALUES (1,'Stranger Things','Canada',1200000),(2,'The Crown','Canada',950000),(3,'The Mandalorian','Canada',800000); | SELECT * FROM tv_shows WHERE country = 'Canada' ORDER BY viewers DESC; |
How many vehicles were added to the fleet each year? | CREATE TABLE Vehicles (VehicleID INT,VehicleType VARCHAR(50),YearAdded INT); INSERT INTO Vehicles (VehicleID,VehicleType,YearAdded) VALUES (1,'Bus',2021),(2,'Tram',2020),(3,'Train',2019),(4,'Bus',2022); | SELECT YearAdded, COUNT(*) as VehiclesAdded FROM Vehicles GROUP BY YearAdded; |
Find the total water consumption by mining operation and the percentage of total water consumption for each operation in the 'mining_operations' and 'water_consumption' tables, ordered by water consumption percentage. | CREATE TABLE mining_operations (operation_id INT,name VARCHAR(50)); INSERT INTO mining_operations (operation_id,name) VALUES (1,'Operation C'); INSERT INTO mining_operations (operation_id,name) VALUES (2,'Operation D'); CREATE TABLE water_consumption (operation_id INT,water_consumption INT); INSERT INTO water_consumpti... | SELECT mining_operations.name, ROUND(water_consumption.water_consumption * 100.0 / (SELECT SUM(water_consumption) FROM water_consumption), 2) AS water_consumption_percentage FROM mining_operations INNER JOIN water_consumption ON mining_operations.operation_id = water_consumption.operation_id ORDER BY water_consumption_... |
How many volunteers are needed for each program in the Caribbean region? | CREATE TABLE programs (id INT,name VARCHAR(50),location VARCHAR(50)); CREATE TABLE volunteers (id INT,name VARCHAR(50),program_id INT); INSERT INTO programs (id,name,location) VALUES (1,'Education','Caribbean'),(2,'Environment','Caribbean'),(3,'Arts','Caribbean'); INSERT INTO volunteers (id,name,program_id) VALUES (1,'... | SELECT p.name, COUNT(v.id) FROM programs p INNER JOIN volunteers v ON p.id = v.program_id WHERE p.location = 'Caribbean' GROUP BY p.name; |
What is the total quantity of minerals extracted per month? | CREATE TABLE extraction_monthly (mine_id INT,extraction_month TEXT,mineral TEXT,quantity INT); INSERT INTO extraction_monthly (mine_id,extraction_month,mineral,quantity) VALUES (1,'January','Gold',50),(1,'January','Silver',75),(1,'February','Gold',55),(1,'February','Silver',80),(2,'January','Gold',60),(2,'January','Sil... | SELECT extraction_month, SUM(quantity) FROM extraction_monthly GROUP BY extraction_month; |
How many safety tests were conducted on sports cars in the last 5 years? | CREATE TABLE SafetyTests (Vehicle VARCHAR(50),Year INT); INSERT INTO SafetyTests (Vehicle,Year) VALUES ('Corvette',2018),('Corvette',2019),('Corvette',2020),('Corvette',2021),('Corvette',2022),('Mustang',2018),('Mustang',2019),('Mustang',2020),('Mustang',2021),('Mustang',2022),('Camaro',2018),('Camaro',2019),('Camaro',... | SELECT COUNT(*) FROM SafetyTests WHERE Vehicle LIKE '%Corvette%' OR Vehicle LIKE '%Mustang%' OR Vehicle LIKE '%Camaro%' AND Year >= YEAR(CURRENT_DATE) - 5; |
List the number of volunteers who joined each year for each continent. | CREATE TABLE Volunteers (VolunteerID INT,VolunteerName TEXT,Country TEXT,Continent TEXT,JoinYear INT); INSERT INTO Volunteers (VolunteerID,VolunteerName,Country,Continent,JoinYear) VALUES (1,'Alex','Morocco','Africa',2019),(2,'Bella','Argentina','South America',2020),(3,'Charlie','Indonesia','Asia',2018); | SELECT Continent, JoinYear, COUNT(*) FROM Volunteers GROUP BY Continent, JoinYear; |
Insert new records for streams of a new album by 'Artist Name' in the genre of rock in the United States. The album has 10 tracks, and each track was streamed once with a revenue of $0.99. | CREATE TABLE tracks (id INT,title VARCHAR(255),artist VARCHAR(255),genre VARCHAR(255)); CREATE TABLE streams (id INT,track_id INT,user_id INT,region VARCHAR(255),genre VARCHAR(255),revenue DECIMAL(10,2),timestamp TIMESTAMP); | INSERT INTO tracks (id, title, artist, genre) SELECT NULL, CONCAT('Track ', ROW_NUMBER() OVER (ORDER BY (SELECT NULL))), 'Artist Name', 'rock' FROM UNNEST(GENERATE_ARRAY(1, 10)) AS x; INSERT INTO streams (id, track_id, user_id, region, genre, revenue, timestamp) SELECT NULL, id, 12345, 'United States', genre, 0.99, TIM... |
What is the average water temperature in the Pacific region for salmon farms? | CREATE TABLE pacific_farms (id INT,farm_name TEXT,region TEXT,water_temperature DECIMAL(5,2)); INSERT INTO pacific_farms (id,farm_name,region,water_temperature) VALUES (1,'FarmA','Pacific',12.5),(2,'FarmB','Pacific',13.2),(3,'FarmC','Atlantic',16.0); | SELECT AVG(water_temperature) FROM pacific_farms WHERE region = 'Pacific' AND water_temperature IS NOT NULL; |
What is the total number of medical supplies delivered to region_id 3 in the medical_supplies table, excluding the records with delivery dates before '2022-01-05'? | CREATE TABLE medical_supplies (id INT PRIMARY KEY,region_id INT,medical_supplies INT,delivery_date DATE); INSERT INTO medical_supplies (id,region_id,medical_supplies,delivery_date) VALUES (1,1,1000,'2022-01-04'); INSERT INTO medical_supplies (id,region_id,medical_supplies,delivery_date) VALUES (2,3,2000,'2022-01-05'); ... | SELECT SUM(medical_supplies) FROM medical_supplies WHERE region_id = 3 AND delivery_date >= '2022-01-05'; |
What is the minimum horsepower for electric vehicles in the 'vehicle_specs' table? | CREATE TABLE vehicle_specs (make VARCHAR(50),model VARCHAR(50),year INT,horsepower INT); | SELECT MIN(horsepower) FROM vehicle_specs WHERE make = 'Tesla' AND horsepower IS NOT NULL; |
What is the number of ethical labor violations in the last year in the Asian region? | CREATE TABLE Labor_Violations (violation_id INT,violation_date DATE,region TEXT,violation_type TEXT); | SELECT COUNT(*) FROM Labor_Violations WHERE violation_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND CURRENT_DATE AND region = 'Asian Region' AND violation_type = 'Ethical Labor Violation'; |
How many containers were handled per day in 'Tokyo' port? | CREATE TABLE ports (port_id INT,port_name VARCHAR(20)); INSERT INTO ports VALUES (1,'Seattle'),(2,'Tokyo'); CREATE TABLE cargo (cargo_id INT,port_id INT,container_weight FLOAT,handling_date DATE); INSERT INTO cargo VALUES (1,1,2000.5,'2022-01-01'),(2,1,3000.2,'2022-01-02'),(3,2,1500.3,'2022-01-03'),(4,2,4000.1,'2022-01... | SELECT handling_date, COUNT(*) FROM cargo WHERE port_id = (SELECT port_id FROM ports WHERE port_name = 'Tokyo') GROUP BY handling_date; |
What is the minimum financial wellbeing score for individuals in Indonesia? | CREATE TABLE financial_wellbeing (id INT,individual_id INT,score INT,country VARCHAR(255)); INSERT INTO financial_wellbeing (id,individual_id,score,country) VALUES (1,4001,60,'Indonesia'),(2,4002,75,'Indonesia'),(3,4003,80,'Indonesia'); | SELECT MIN(score) FROM financial_wellbeing WHERE country = 'Indonesia'; |
Who are the top 5 suppliers with the most sustainable material orders? | CREATE TABLE suppliers (id INT,name VARCHAR(255),sustainable_material_orders INT); INSERT INTO suppliers (id,name,sustainable_material_orders) VALUES (1,'GreenSupplies',200),(2,'EcoSource',150),(3,'SustainableGoods',300),(4,'FairTradeWarehouse',100),(5,'ResponsibleResources',250); | SELECT name, sustainable_material_orders FROM suppliers ORDER BY sustainable_material_orders DESC LIMIT 5; |
What is the average speed of VesselF in the last month? | CREATE TABLE vessels(id INT,name TEXT,speed FLOAT,timestamp TIMESTAMP); INSERT INTO vessels VALUES (1,'VesselA',20.5,'2022-04-01 10:00:00'),(6,'VesselF',18.3,'2022-04-02 15:30:00'); | SELECT AVG(speed) FROM vessels WHERE name = 'VesselF' AND timestamp BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE; |
Show the carbon pricing for each country in the EU | CREATE TABLE eu_countries (country VARCHAR(255),carbon_price FLOAT); INSERT INTO eu_countries (country,carbon_price) VALUES ('Germany',25.3),('France',30.1),('Italy',18.9),('Spain',22.7); | SELECT country, carbon_price FROM eu_countries; |
Identify the number of investments made in the renewable energy sector since 2015. | CREATE TABLE investments (id INT,sector VARCHAR(20),date DATE); INSERT INTO investments (id,sector,date) VALUES (1,'Renewable Energy','2018-01-01'),(2,'Finance','2016-01-01'),(3,'Renewable Energy','2017-01-01'); | SELECT COUNT(*) FROM investments WHERE sector = 'Renewable Energy' AND date >= '2015-01-01'; |
Delete all records for garments that are not dresses? | CREATE TABLE garments (garment_type VARCHAR(50),size VARCHAR(10),color VARCHAR(20)); INSERT INTO garments (garment_type,size,color) VALUES ('Dress','S','Red'),('Shirt','M','Blue'),('Pants','L','Black'); | DELETE FROM garments WHERE garment_type != 'Dress'; |
List all marine species that are threatened or endangered and have been recorded at a depth greater than 2000 meters. | CREATE TABLE marine_species (species_id INT,species_name VARCHAR(100),conservation_status VARCHAR(50),max_depth FLOAT,order_name VARCHAR(50)); | SELECT species_name FROM marine_species WHERE conservation_status IN ('Threatened', 'Endangered') AND max_depth > 2000; |
Create a table named 'rural_infrastructure' | CREATE TABLE rural_infrastructure (id INT PRIMARY KEY,name VARCHAR(100),location VARCHAR(50),type VARCHAR(50),start_date DATE,end_date DATE); | CREATE TABLE rural_infrastructure (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), type VARCHAR(50), start_date DATE, end_date DATE); |
What is the average quantity of sustainable fabric sourced from India in the past year? | CREATE TABLE sourcing (id INT,fabric_type TEXT,quantity INT,country TEXT,sourcing_date DATE); INSERT INTO sourcing (id,fabric_type,quantity,country,sourcing_date) VALUES (1,'organic cotton',500,'India','2021-06-01'),(2,'recycled polyester',300,'China','2021-07-15'),(3,'hemp',700,'India','2021-08-09'); | SELECT AVG(quantity) FROM sourcing WHERE fabric_type = 'sustainable fabric' AND country = 'India' AND sourcing_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); |
What is the average claim amount in each country? | CREATE TABLE Claims_Global (id INT,country VARCHAR(20),amount FLOAT); INSERT INTO Claims_Global (id,country,amount) VALUES (1,'USA',5000),(2,'Canada',4000),(3,'Mexico',6000),(4,'Brazil',7000); | SELECT country, AVG(amount) as avg_claim_amount FROM Claims_Global GROUP BY country; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.