instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
List the number of startups founded by individuals from underrepresented countries in the blockchain sector that have had at least one investment round.
CREATE TABLE startup (id INT,name VARCHAR(100),industry VARCHAR(50),founder_country VARCHAR(50),investment_round INT); INSERT INTO startup VALUES (1,'StartupA','Blockchain','India',1); INSERT INTO startup VALUES (2,'StartupB','Tech','USA',2); INSERT INTO startup VALUES (3,'StartupC','Blockchain','Brazil',NULL);
SELECT COUNT(*) FROM startup WHERE founder_country IN ('India', 'Brazil') AND industry = 'Blockchain' AND investment_round IS NOT NULL;
What is the average number of players per multiplayer game in Europe?
CREATE TABLE Games (GameID INT,GameType VARCHAR(255),Multiplayer INT); INSERT INTO Games (GameID,GameType,Multiplayer) VALUES (1,'Racing',0); INSERT INTO Games (GameID,GameType,Multiplayer) VALUES (2,'Shooter',1); CREATE TABLE Players (PlayerID INT,GameID INT); INSERT INTO Players (PlayerID,GameID) VALUES (1,1); INSERT INTO Players (PlayerID,GameID) VALUES (1,2); INSERT INTO Players (PlayerID,GameID) VALUES (2,2); INSERT INTO Players (PlayerID,GameID) VALUES (3,2); INSERT INTO Players (PlayerID,GameID) VALUES (4,2); INSERT INTO Players (PlayerID,GameID) VALUES (5,2); INSERT INTO Players (PlayerID,GameID) VALUES (6,2); INSERT INTO Players (PlayerID,GameID) VALUES (7,2); INSERT INTO Players (PlayerID,GameID) VALUES (8,2); INSERT INTO Players (PlayerID,GameID) VALUES (9,2); INSERT INTO Players (PlayerID,GameID) VALUES (10,2);
SELECT AVG(CountPlayers) FROM (SELECT GameID, COUNT(PlayerID) AS CountPlayers FROM Players INNER JOIN Games ON Players.GameID = Games.GameID WHERE Games.Multiplayer = 1 GROUP BY GameID) AS Subquery WHERE EXISTS (SELECT GameID FROM Games WHERE ReleaseCountry LIKE '%Europe%' AND Games.GameID = Subquery.GameID);
Delete all records from the 'water_usage' table where the 'usage' is greater than 100
CREATE TABLE water_usage (id INT PRIMARY KEY,region VARCHAR(20),usage INT);
DELETE FROM water_usage WHERE usage > 100;
What is the maximum budget for a single operation in 'asian_region_table'?
CREATE TABLE asian_region_table (id INT,operation_name VARCHAR(100),country VARCHAR(50),budget INT); INSERT INTO asian_region_table (id,operation_name,country,budget) VALUES (1,'Operation Pacific Eagle','Thailand',150000000);
SELECT MAX(budget) FROM asian_region_table;
Delete records of clients who have not made any transactions in the last 6 months from the client_transactions table.
CREATE TABLE client_transactions (client_id INT,transaction_date DATE);
DELETE FROM client_transactions WHERE client_id IN (SELECT client_id FROM client_transactions WHERE transaction_date < DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH) GROUP BY client_id HAVING COUNT(*) = 0);
Which wells in the Sea of Okhotsk have a production greater than 4000?
CREATE TABLE wells (well_id INT,name VARCHAR(50),location VARCHAR(50),production FLOAT); INSERT INTO wells (well_id,name,location,production) VALUES (1,'J1','Sea of Okhotsk',5500),(2,'J2','Sea of Okhotsk',4500),(3,'J3','Sea of Okhotsk',6500);
SELECT name, production FROM wells WHERE location = 'Sea of Okhotsk' AND production > 4000;
What is the total quantity of plastic waste generated in the city of Accra, Ghana, for the year 2020?
CREATE TABLE waste_types (type VARCHAR(20),quantity INT); INSERT INTO waste_types (type,quantity) VALUES ('plastic',15000),('paper',12000),('glass',8000);
SELECT SUM(quantity) FROM waste_types WHERE type = 'plastic' AND YEAR(date) = 2020;
Delete all records from the products table
CREATE TABLE products (id INT PRIMARY KEY,name VARCHAR(100),category VARCHAR(50),price DECIMAL(5,2));
DELETE FROM products;
What is the total number of satellites deployed by SpaceX and Blue Origin?
CREATE TABLE space_company (name TEXT,satellites_deployed INTEGER); INSERT INTO space_company (name,satellites_deployed) VALUES ('SpaceX',2000),('Blue Origin',100);
SELECT SUM(satellites_deployed) FROM space_company WHERE name IN ('SpaceX', 'Blue Origin');
What is the average awareness score for consumers in a specific region?
CREATE TABLE consumer_awareness (region_id INT PRIMARY KEY,awareness_score INT,year INT);
SELECT AVG(awareness_score) FROM consumer_awareness WHERE region_id = 123 AND year = 2021;
Add the 'Waymo' autonomous driving project with the '2021' year and 'USA' country to the 'auto_shows' table
CREATE TABLE auto_shows (id INT PRIMARY KEY,project_name VARCHAR(255),year INT,country VARCHAR(255));
INSERT INTO auto_shows (project_name, year, country) VALUES ('Waymo', 2021, 'USA');
What is the total production volume for wells in the Marcellus Shale formation in the last quarter?
CREATE TABLE wells (well_id INT,well_name VARCHAR(255),well_type VARCHAR(255),location VARCHAR(255)); INSERT INTO wells VALUES (1,'Well A','Onshore','Marcellus Shale'); INSERT INTO wells VALUES (2,'Well B','Onshore','Utica Shale');
SELECT SUM(production_volume) FROM well_production WHERE location LIKE 'Marcellus%' AND date >= CURRENT_DATE - INTERVAL '3 months';
What is the name and publication year of all papers published in the journal 'Journal of Computer Science'?
CREATE TABLE journals (journal_id INT,journal_name TEXT); INSERT INTO journals (journal_id,journal_name) VALUES (1,'Journal of Mathematics'),(2,'Journal of Computer Science'),(3,'Journal of Physics'); CREATE TABLE publications (paper_id INT,faculty_id INT,title TEXT,journal_id INT,publication_year INT); INSERT INTO publications (paper_id,faculty_id,title,journal_id,publication_year) VALUES (1,3,'Machine Learning Research',2,2017),(2,4,'Advanced Algebra',1,2016),(3,3,'Deep Learning Research',2,2018),(4,4,'Probability Theory',1,2019);
SELECT publications.title, publications.publication_year FROM publications INNER JOIN journals ON publications.journal_id = journals.journal_id WHERE journals.journal_name = 'Journal of Computer Science';
List all healthcare policy feedback entries for rural areas from the 'policy_feedback' table, ordered by submission date.
CREATE TABLE policy_feedback (id INT,area VARCHAR(255),category VARCHAR(255),feedback TEXT,submission_date DATE); INSERT INTO policy_feedback (id,area,category,feedback,submission_date) VALUES (1,'Rural','healthcare','Great initiative!','2022-05-01'),(2,'Urban','education','Could be better','2022-06-15');
SELECT * FROM policy_feedback WHERE area = 'rural' AND category = 'healthcare' ORDER BY submission_date;
How many peacekeeping operations has Country X participated in since 2010?
CREATE TABLE peacekeeping_operations (operation_id INT,country VARCHAR(255),start_date DATE); INSERT INTO peacekeeping_operations (operation_id,country,start_date) VALUES (1,'Country X','2010-01-01'),(2,'Country X','2012-01-01'),(3,'Country Y','2015-01-01'); CREATE TABLE countries (country VARCHAR(255));
SELECT COUNT(*) FROM peacekeeping_operations INNER JOIN countries ON peacekeeping_operations.country = countries.country WHERE country = 'Country X' AND start_date >= '2010-01-01';
What is the average number of safety issues in workplaces per industry?
CREATE TABLE workplaces (id INT,industry VARCHAR(10),safety_issues INT); INSERT INTO workplaces (id,industry,safety_issues) VALUES (1,'Manufacturing',10),(2,'Construction',5),(3,'Manufacturing',15),(4,'Retail',8);
SELECT industry, AVG(safety_issues) OVER (PARTITION BY industry) AS avg_safety_issues FROM workplaces;
What is the average price of Fair Trade certified cotton products?
CREATE TABLE cotton_products (product_id INT,name VARCHAR(255),price DECIMAL(5,2),certification VARCHAR(50)); INSERT INTO cotton_products (product_id,name,price,certification) VALUES (1,'Fair Trade T-Shirt',25.99,'Fair Trade'),(2,'Regular T-Shirt',15.99,'None');
SELECT AVG(price) FROM cotton_products WHERE certification = 'Fair Trade';
List all port authorities and their corresponding regulatory compliance officers' names, even if a port authority has no assigned officer.
CREATE TABLE port_authorities (authority_id INT,authority_name VARCHAR(50)); CREATE TABLE compliance_officers (officer_id INT,officer_name VARCHAR(50)); CREATE TABLE authority_officer_assignments (assignment_id INT,authority_id INT,officer_id INT);
SELECT pa.authority_name, coalesce(fo.officer_name, 'Unassigned') as officer_name FROM port_authorities pa LEFT JOIN authority_officer_assignments aoa ON pa.authority_id = aoa.authority_id LEFT JOIN compliance_officers fo ON aoa.officer_id = fo.officer_id;
What are the total donation amounts for organizations with a higher rating than 'Good'?
CREATE TABLE organizations (id INT,name TEXT,rating TEXT); INSERT INTO organizations (id,name,rating) VALUES (1,'ExampleOrg','Excellent');
SELECT SUM(donation_amount) FROM donations JOIN organizations ON donations.org_id = organizations.id WHERE organizations.rating > 'Good';
Who are the top 3 building owners with the highest energy consumption?
CREATE TABLE GreenBuildings (id INT,name TEXT,owner TEXT,energy_consumption FLOAT); INSERT INTO GreenBuildings (id,name,owner,energy_consumption) VALUES (1,'EcoTower','ACME Inc',1500.0),(2,'GreenSpire','GreenCorp',1200.0),(3,'GreenVista','ACME Inc',1300.0);
SELECT owner, SUM(energy_consumption) AS TotalEnergy FROM GreenBuildings GROUP BY owner ORDER BY TotalEnergy DESC LIMIT 3;
List the names of all heritage sites with their respective countries.
CREATE TABLE Heritage_Sites (id INT,site_name VARCHAR(100),country VARCHAR(50),year_established INT,UNIQUE (id));
SELECT site_name, country FROM Heritage_Sites;
Update the 'bankruptcy_law' table and set the 'chapter' column to '13' for all cases filed in 2018
CREATE TABLE bankruptcy_law (case_id INT,filing_date DATE,chapter VARCHAR(10));
WITH updated_cases AS (UPDATE bankruptcy_law SET chapter = '13' WHERE EXTRACT(YEAR FROM filing_date) = 2018 RETURNING *) SELECT * FROM updated_cases;
What is the average product price for each category with more than 10 items?
CREATE TABLE products (product_id INT,category VARCHAR(255),price DECIMAL(10,2)); INSERT INTO products (product_id,category,price) VALUES (1,'Electronics',200.00),(2,'Fashion',50.00),(3,'Electronics',300.00),(4,'Fashion',75.00);
SELECT category, AVG(price) as avg_price FROM products GROUP BY category HAVING COUNT(*) > 10;
How many startups were founded in Oceania each year?
CREATE TABLE company (id INT,name TEXT,founding_year INT,founding_location TEXT); INSERT INTO company (id,name,founding_year,founding_location) VALUES (1,'AussieStart',2019,'Sydney'); INSERT INTO company (id,name,founding_year,founding_location) VALUES (2,'KiwiInnovate',2021,'Wellington'); INSERT INTO company (id,name,founding_year,founding_location) VALUES (3,'PacificPioneer',2020,'Suva');
SELECT founding_location, COUNT(*) FROM company GROUP BY founding_year, founding_location HAVING founding_location LIKE 'Oceania%';
What is the total number of security incidents reported in the retail sector in the year 2019?
CREATE TABLE security_incidents (id INT,sector VARCHAR(255),year INT,incidents INT); INSERT INTO security_incidents (id,sector,year,incidents) VALUES (1,'retail',2019,2),(2,'finance',2018,3);
SELECT SUM(incidents) FROM security_incidents WHERE sector = 'retail' AND year = 2019;
Identify power plants in the European Union that use nuclear fuel.
CREATE TABLE power_plant (id INT,name VARCHAR(50),fuel VARCHAR(20)); INSERT INTO power_plant (id,name,fuel) VALUES (1,'Power Plant 1','Coal'),(2,'Power Plant 2','Natural Gas'),(3,'Power Plant 3','Coal,Natural Gas'),(4,'Power Plant 4','Nuclear');
SELECT name FROM power_plant WHERE fuel = 'Nuclear' AND country IN (SELECT country FROM power_plant WHERE country LIKE 'Europe%');
How many tickets have been sold for the upcoming jazz festival?
CREATE TABLE Concerts (ConcertID INT,ConcertName VARCHAR(100),ConcertType VARCHAR(50),VenueID INT,TotalSeats INT); CREATE TABLE Venues (VenueID INT,VenueName VARCHAR(100),Capacity INT); CREATE TABLE Tickets (TicketID INT,ConcertID INT,TicketSold BOOLEAN); INSERT INTO Concerts VALUES (1,'Jazz Festival','Music Festival',1,5000); INSERT INTO Venues VALUES (1,'Garden Center',10000); INSERT INTO Tickets VALUES (1,1,TRUE);
SELECT COUNT(*) FROM Tickets WHERE Tickets.ConcertID = (SELECT ConcertID FROM Concerts WHERE ConcertName = 'Jazz Festival') AND Tickets.TicketSold = TRUE;
What is the distribution of player ages playing 'RPG' games on PC?
CREATE TABLE players (id INT,age INT,genre VARCHAR(20),platform VARCHAR(10)); INSERT INTO players (id,age,genre,platform) VALUES (1,25,'RPG','PC'),(2,30,'FPS','PC'),(3,20,'RPG','PC');
SELECT genre, platform, AVG(age) AS avg_age FROM players WHERE genre = 'RPG' AND platform = 'PC' GROUP BY genre, platform;
Find the difference in technology accessibility scores between the first and third quarters for each country in the APAC region.
CREATE TABLE accessibility (country VARCHAR(50),region VARCHAR(50),quarter INT,score INT); INSERT INTO accessibility (country,region,quarter,score) VALUES ('Singapore','APAC',1,80),('Singapore','APAC',2,85),('Singapore','APAC',3,75),('Indonesia','APAC',1,70),('Indonesia','APAC',2,75),('Indonesia','APAC',3,80);
SELECT country, LAG(score, 2) OVER (PARTITION BY country ORDER BY quarter) - score as diff FROM accessibility WHERE region = 'APAC';
What is the total square footage of all properties in sustainable urban areas?
CREATE TABLE urban_areas (id INT,area VARCHAR(20),sustainable BOOLEAN); INSERT INTO urban_areas (id,area,sustainable) VALUES (1,'City A',true),(2,'City B',false),(3,'City C',true); CREATE TABLE properties (id INT,area VARCHAR(20),size INT); INSERT INTO properties (id,area,size) VALUES (1,'City A',1500),(2,'City B',2000),(3,'City A',1000);
SELECT SUM(size) FROM properties JOIN urban_areas ON properties.area = urban_areas.area WHERE urban_areas.sustainable = true;
What is the average response time for Freedom of Information Act (FOIA) requests in the United States?
CREATE TABLE foia_requests (id INT,response_time INT,country TEXT); INSERT INTO foia_requests (id,response_time,country) VALUES (1,30,'USA'),(2,45,'USA'),(3,20,'Canada');
SELECT AVG(response_time) FROM foia_requests WHERE country = 'USA';
What is the total number of parks by city in the state of California?
CREATE TABLE parks (id INT,city VARCHAR(50),state VARCHAR(50)); INSERT INTO parks (id,city,state) VALUES (1,'City A','California'),(2,'City B','California'),(3,'City A','California');
SELECT state, city, COUNT(*) as total_parks FROM parks WHERE state = 'California' GROUP BY state, city;
Which cities have slow emergency response times and high community policing?
CREATE TABLE EmergencyResponse (id INT PRIMARY KEY,city VARCHAR(255),avg_response_time TIME); CREATE VIEW SlowResponseCities AS SELECT city,avg_response_time FROM EmergencyResponse WHERE avg_response_time > '01:00:00'; CREATE TABLE CommunityPolicing (id INT PRIMARY KEY,city VARCHAR(255),community_policing FLOAT);
SELECT src.city, src.avg_response_time, cp.community_policing FROM SlowResponseCities src JOIN CommunityPolicing cp ON src.city = cp.city WHERE cp.community_policing > 70;
How many electric vehicles were sold in the US and China in 2020?
CREATE TABLE electric_vehicle_sales (country VARCHAR(50),year INT,sales INT);
SELECT country, SUM(sales) FROM electric_vehicle_sales WHERE country IN ('US', 'China') AND year = 2020 GROUP BY country;
What is the total salary expense for the marketing 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','Marketing',70000),(2,'Jane Smith','Marketing',75000);
SELECT SUM(salary) FROM Employees WHERE department = 'Marketing';
List all marine species found in the Arctic region and their conservation status.
CREATE TABLE Arctic_Species (species_name TEXT,location TEXT,conservation_status TEXT); INSERT INTO Arctic_Species (species_name,location,conservation_status) VALUES ('Polar Bear','Arctic','Vulnerable'),('Narwhal','Arctic','Near Threatened');
SELECT species_name, conservation_status FROM Arctic_Species;
Determine the number of mobile subscribers in each country, excluding countries with no mobile subscribers.
CREATE TABLE subscribers (id INT,subscriber_type VARCHAR(10),country VARCHAR(20)); INSERT INTO subscribers (id,subscriber_type,country) VALUES (1,'Mobile','Canada'),(2,'Broadband','Canada'),(3,'Mobile','Mexico'),(4,'Mobile','Brazil'),(5,'Broadband','Brazil');
SELECT country, COUNT(*) as num_subscribers FROM subscribers WHERE subscriber_type = 'Mobile' GROUP BY country HAVING COUNT(*) > 0;
What is the total budget allocated for education and healthcare services in the state of California for the year 2022?
CREATE TABLE BudgetAllocation (State VARCHAR(20),Year INT,Service VARCHAR(20),Allocation DECIMAL(10,2)); INSERT INTO BudgetAllocation (State,Year,Service,Allocation) VALUES ('California',2022,'Education',50000.00),('California',2022,'Healthcare',75000.00);
SELECT SUM(Allocation) FROM BudgetAllocation WHERE State = 'California' AND Year = 2022 AND (Service = 'Education' OR Service = 'Healthcare');
What is the average engagement time with virtual tours in the Nordics region (Norway, Sweden, Denmark, Finland, Iceland) in Q4 2022?
CREATE TABLE virtual_tour_stats (tour_id INT,region TEXT,engagement_time FLOAT,date DATE); INSERT INTO virtual_tour_stats (tour_id,region,engagement_time,date) VALUES (1,'Norway',30,'2022-10-01'),(2,'Sweden',25,'2022-10-01'),(3,'Denmark',35,'2022-10-01');
SELECT AVG(engagement_time) FROM virtual_tour_stats WHERE region IN ('Norway', 'Sweden', 'Denmark', 'Finland', 'Iceland') AND date = '2022-10-01';
What is the maximum delivery time for shipments to Japan?
CREATE TABLE Shipments (shipment_id INT,destination VARCHAR(50),delivery_time INT); INSERT INTO Shipments (shipment_id,destination,delivery_time) VALUES (1,'Japan',3); INSERT INTO Shipments (shipment_id,destination,delivery_time) VALUES (2,'Japan',5);
SELECT MAX(delivery_time) FROM Shipments WHERE destination = 'Japan';
What percentage of products have recyclable packaging?
CREATE TABLE packaging (package_id INT,product_id INT,material VARCHAR(20),recyclable BOOLEAN); INSERT INTO packaging (package_id,product_id,material,recyclable) VALUES (1,1,'plastic',false),(2,2,'glass',true),(3,3,'paper',true);
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM packaging)) AS percentage FROM packaging WHERE recyclable = true;
Update the news table to set the description to 'New study on media representation' for news items published on '2022-04-01' with the topic 'representation'.
CREATE TABLE news (id INT,title VARCHAR(255),description TEXT,topic VARCHAR(255),date DATE);
UPDATE news SET description = 'New study on media representation' WHERE topic = 'representation' AND date = '2022-04-01';
Display the view EmployeeAgesEthnicities
CREATE VIEW EmployeeAgesEthnicities AS SELECT Age,Ethnicity FROM EmployeeDemographics;
SELECT * FROM EmployeeAgesEthnicities;
Which countries have more than 20 designers in the 'designers' table?
CREATE TABLE designers (designer_id INT PRIMARY KEY,name VARCHAR(255),origin_country VARCHAR(100));
SELECT origin_country, COUNT(*) as designer_count FROM designers GROUP BY origin_country HAVING designer_count > 20;
Update the name of the character with id 3 to 'New Character Name' in the 'characters' table
CREATE TABLE characters (id INT,name TEXT,show_id INT);
UPDATE characters SET name = 'New Character Name' WHERE id = 3;
What is the total number of female employees in each department?
CREATE TABLE EmployeeData (EmployeeID INT,Department TEXT,Gender TEXT); INSERT INTO EmployeeData (EmployeeID,Department,Gender) VALUES (1,'HR','Female');
SELECT Department, COUNT(*) FROM EmployeeData WHERE Gender = 'Female' GROUP BY Department;
Update the arctic_weather table to correct the temperature for January 1, 2022.
CREATE TABLE arctic_weather (id INT,date DATE,temperature FLOAT); INSERT INTO arctic_weather (id,date,temperature) VALUES (1,'2022-01-01',10),(2,'2022-01-02',12);
UPDATE arctic_weather SET temperature = 12.5 WHERE date = '2022-01-01';
Insert records into 'marine_protected_areas'
CREATE TABLE marine_protected_areas (id INT PRIMARY KEY,name VARCHAR(255),location VARCHAR(255),size FLOAT,year_established INT);
INSERT INTO marine_protected_areas (id, name, location, size, year_established) VALUES (1, 'Great Barrier Reef', 'Australia', 344400, 1975), (2, 'Galapagos Marine Reserve', 'Ecuador', 133000, 1998);
What is the average number of hours volunteered per volunteer in the year 2023, and the total number of volunteers who volunteered in that time period, broken down by the volunteer's country of residence?
CREATE TABLE Volunteers (VolunteerID INT,Name TEXT,VolunteerHours DECIMAL(10,2),VolunteerDate DATE,Country TEXT); INSERT INTO Volunteers VALUES (1,'Nia White',5.00,'2023-07-01','Canada'),(2,'Jamal Brown',3.00,'2023-12-31','USA'),(3,'Fatima Davis',4.00,'2023-08-01','Mexico'),(4,'Kareem Johnson',6.00,'2023-11-01','USA');
SELECT Country, AVG(VolunteerHours) as AvgVolunteerHours, COUNT(*) as NumVolunteers FROM Volunteers WHERE YEAR(VolunteerDate) = 2023 GROUP BY Country;
What is the maximum production rate for wells in the Haynesville Shale?
CREATE TABLE well_rates (well_name VARCHAR(50),location VARCHAR(50),rate FLOAT); INSERT INTO well_rates (well_name,location,rate) VALUES ('Well A','Haynesville Shale',2000),('Well B','Haynesville Shale',1500);
SELECT MAX(rate) FROM well_rates WHERE location = 'Haynesville Shale';
What is the success rate of community development initiatives for women in indigenous communities?
CREATE TABLE CommunityDevelopment (id INT,project_id INT,initiative VARCHAR(255),participants INT,success_rate FLOAT,community_type VARCHAR(255)); CREATE TABLE AgriculturalProjects (id INT,project_name VARCHAR(255),location VARCHAR(255),start_date DATE,end_date DATE,budget FLOAT); INSERT INTO AgriculturalProjects (id,project_name,location,start_date,end_date,budget) VALUES (1,'Drip Irrigation','Indigenous Community A','2018-01-01','2019-01-01',5000.00); INSERT INTO CommunityDevelopment (id,project_id,initiative,participants,success_rate,community_type) VALUES (1,1,'Women Empowerment',150,0.85,'Indigenous');
SELECT AgriculturalProjects.location, CommunityDevelopment.initiative, AVG(CommunityDevelopment.success_rate) as average_success_rate FROM AgriculturalProjects INNER JOIN CommunityDevelopment ON AgriculturalProjects.id = CommunityDevelopment.project_id WHERE AgriculturalProjects.location = 'Indigenous Community A' AND CommunityDevelopment.initiative = 'Women Empowerment' GROUP BY AgriculturalProjects.location, CommunityDevelopment.initiative;
List all cybersecurity incidents with their impact level and the response taken.
CREATE TABLE CybersecurityIncidents (Incident VARCHAR(50),ImpactLevel VARCHAR(10),Response VARCHAR(100)); INSERT INTO CybersecurityIncidents (Incident,ImpactLevel,Response) VALUES ('Data Breach','High','Containment,Investigation,Notification'),('Phishing Attack','Low','User Training,Filter Updates'),('Ransomware Attack','Medium','Backup Restoration,Patching,Law Enforcement Involvement'),('Insider Threat','High','Audit,Disciplinary Action,Counterintelligence'),('Botnet Attack','Medium','Firewall Updates,Blacklisting');
SELECT Incident, ImpactLevel, Response FROM CybersecurityIncidents;
What is the total number of workplace safety inspections conducted by unions in the United States and Canada, and how many resulted in citations?
CREATE TABLE unions (id INT,name VARCHAR(255),country VARCHAR(255));INSERT INTO unions (id,name,country) VALUES (1,'AFL-CIO','USA'),(2,'CTC','Canada');CREATE TABLE inspections (id INT,union_id INT,inspections INT,citations INT);INSERT INTO inspections (id,union_id,inspections,citations) VALUES (1,1,500,120),(2,1,300,70),(3,2,400,100),(4,2,250,50);
SELECT SUM(inspections) as total_inspections, SUM(citations) as total_citations FROM inspections JOIN unions ON inspections.union_id = unions.id WHERE unions.country IN ('USA', 'Canada');
Insert new records in the 'esports_matches' table for a match between teams 'Team1' and 'Team2' in the 'Asia' region
CREATE TABLE esports_matches (match_id INT,team1 VARCHAR(100),team2 VARCHAR(100),winner VARCHAR(100),region VARCHAR(50),date DATE);
INSERT INTO esports_matches (match_id, team1, team2, winner, region, date) VALUES (1, 'Team1', 'Team2', NULL, 'Asia', CURDATE());
Which vehicles have been taken for maintenance more than twice in the last month?
CREATE TABLE vehicle (vehicle_id INT,model TEXT); CREATE TABLE maintenance (maintenance_id INT,vehicle_id INT,maintenance_date DATE); INSERT INTO vehicle (vehicle_id,model) VALUES (1,'V1'),(2,'V2'),(3,'V3'),(4,'V4'); INSERT INTO maintenance (maintenance_id,vehicle_id,maintenance_date) VALUES (1,1,'2022-01-01'),(2,2,'2022-01-15'),(3,1,'2022-01-20'),(4,3,'2022-01-25'),(5,4,'2022-01-30'),(6,1,'2022-02-05');
SELECT vehicle_id, COUNT(*) FROM maintenance WHERE maintenance_date >= DATEADD(month, -1, GETDATE()) GROUP BY vehicle_id HAVING COUNT(*) > 2;
What is the most recent art piece in the 'Pop Art' style?
CREATE TABLE ArtPieces (id INT,title VARCHAR(50),galleryId INT,year INT,value INT,style VARCHAR(20)); INSERT INTO ArtPieces (id,title,galleryId,year,value,style) VALUES (1,'Piece 1',1,2000,10000,'Impressionism'),(2,'Piece 2',1,2010,15000,'Surrealism'),(3,'Piece 3',2,2020,20000,'Cubism'),(4,'Piece 4',3,1990,5000,'Surrealism'),(5,'Piece 5',NULL,1984,25000,'Impressionism'),(6,'Piece 6',NULL,2014,30000,'Abstract'),(7,'Piece 7',NULL,1964,15000,'Pop Art');
SELECT title, year FROM ArtPieces WHERE style = 'Pop Art' ORDER BY year DESC LIMIT 1;
What is the maximum production for wells in the Niobrara Formation?
CREATE TABLE Niobrara_Formation (well_id INT,production_bopd FLOAT); INSERT INTO Niobrara_Formation (well_id,production_bopd) VALUES (1,450),(2,500),(3,550),(4,400);
SELECT MAX(production_bopd) FROM Niobrara_Formation WHERE well_id IS NOT NULL;
List the top 5 countries with the highest number of virtual tour engagements on OTA platforms in Q3 2022.
CREATE TABLE ota_platforms (platform_id INT,platform_name TEXT); INSERT INTO ota_platforms (platform_id,platform_name) VALUES (1,'Platform A'),(2,'Platform B'); CREATE TABLE virtual_tours (tour_id INT,platform_id INT,country TEXT,views INT); INSERT INTO virtual_tours (tour_id,platform_id,country,views) VALUES (1,1,'USA',1000),(2,1,'Canada',800),(3,2,'Mexico',1500),(4,2,'Brazil',1200),(5,1,'UK',900);
SELECT country, SUM(views) as total_views FROM virtual_tours INNER JOIN ota_platforms ON virtual_tours.platform_id = ota_platforms.platform_id WHERE virtual_tours.platform_id IN (1, 2) AND virtual_tours.views >= 0 GROUP BY country ORDER BY total_views DESC LIMIT 5;
Show the daily active user count for Vietnam in March 2022.
CREATE TABLE if not exists activity (user_id INT,country VARCHAR(50),activity_date DATE,year INT,month INT,day INT); INSERT INTO activity (user_id,country,activity_date) VALUES (1,'Vietnam','2022-03-01'),(2,'Vietnam','2022-03-02');
SELECT COUNT(DISTINCT user_id) FROM activity WHERE country = 'Vietnam' AND month = 3 AND year = 2022;
What is the total number of machines in the 'machine_3' and 'machine_4' categories?
CREATE TABLE manufacturing_machines (id INT,name VARCHAR(50),category VARCHAR(20)); INSERT INTO manufacturing_machines (id,name,category) VALUES (1,'Machine 3','machine_3'),(2,'Machine 4','machine_4'),(3,'Machine 5','machine_5');
SELECT COUNT(*) FROM manufacturing_machines WHERE category IN ('machine_3', 'machine_4');
Delete all incidents recorded before 2018-01-01 from the 'incidents' table
CREATE TABLE incidents (id INT,incident_type VARCHAR(255),location VARCHAR(255),occurred_on DATE);
DELETE FROM incidents WHERE occurred_on < '2018-01-01';
What is the total number of factories using sustainable materials in Germany?
CREATE TABLE factories (id INT,name VARCHAR(50),location VARCHAR(50),sustainable_materials BOOLEAN); INSERT INTO factories (id,name,location,sustainable_materials) VALUES (1,'EcoFactory','Germany',TRUE),(2,'SmartTech','France',FALSE);
SELECT COUNT(*) FROM factories WHERE location = 'Germany' AND sustainable_materials = TRUE;
What is the total revenue generated by sustainable tourism activities in India?
CREATE TABLE sustainable_tourism (activity_id INT,activity_name TEXT,country TEXT,revenue FLOAT); INSERT INTO sustainable_tourism (activity_id,activity_name,country,revenue) VALUES (1,'Eco Trekking','India',50000),(2,'Bird Watching','India',35000),(3,'Heritage Biking','India',40000);
SELECT SUM(revenue) FROM sustainable_tourism WHERE country = 'India';
What is the average depth of the ocean floor in the Pacific region?
CREATE TABLE OceanFloorMapping (id INT,region VARCHAR(20),depth FLOAT); INSERT INTO OceanFloorMapping (id,region,depth) VALUES (1,'Pacific',4500.5),(2,'Atlantic',3200.2),(3,'Indian',5000.0);
SELECT AVG(depth) FROM OceanFloorMapping WHERE region = 'Pacific';
How many unique volunteers have participated in each program since its inception?
CREATE TABLE volunteers (id INT,volunteer_name VARCHAR(50),program VARCHAR(50),volunteer_date DATE); INSERT INTO volunteers (id,volunteer_name,program,volunteer_date) VALUES (1,'Alice','Mentorship','2021-02-01'),(2,'Bob','Tutoring','2021-04-10'),(3,'Alice','Mentorship','2022-01-05');
SELECT program, COUNT(DISTINCT volunteer_name) as unique_volunteers FROM volunteers GROUP BY program;
How can I update the financial capability score for the client with ID 10 in Kenya?
CREATE TABLE financial_capability (client_id INT,country VARCHAR(50),score INT); INSERT INTO financial_capability (client_id,country,score) VALUES (10,'Kenya',7);
WITH client_score AS (UPDATE financial_capability SET score = 8 WHERE client_id = 10 AND country = 'Kenya') SELECT score FROM client_score;
What is the average monthly budget allocation for each department for the current financial year?
CREATE TABLE Budget (id INT,department TEXT,allocation_date DATE,amount FLOAT); INSERT INTO Budget (id,department,allocation_date,amount) VALUES (1,'Operations','2022-04-01',50000);
SELECT department, AVG(amount) as avg_allocation FROM Budget WHERE allocation_date >= DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0) GROUP BY department;
How many public transportation projects in the "projects" table have a budget greater than $10 million and are located in the 'Urban' area?
CREATE TABLE projects (project_id INT,project_name VARCHAR(50),budget DECIMAL(10,2),area VARCHAR(50)); INSERT INTO projects (project_id,project_name,budget,area) VALUES (1,'ProjectE',12000000.00,'Urban'),(2,'ProjectF',8000000.00,'Suburban'),(3,'ProjectG',15000000.00,'Urban');
SELECT COUNT(*) FROM projects WHERE budget > 10000000 AND area = 'Urban';
Identify the services with budget increases between 2019 and 2020.
CREATE TABLE Budget (Year INT,Service VARCHAR(20),Amount INT); INSERT INTO Budget (Year,Service,Amount) VALUES ('2019','Health',12000000),('2019','Education',18000000),('2020','Health',15000000),('2020','Education',20000000),('2019','PublicTransportation',9000000),('2020','PublicTransportation',9500000);
SELECT Service FROM (SELECT Service, Amount, YEAR(CONCAT('20', SUBSTRING(Year, 3, 2))) AS Year FROM Budget) X WHERE Year = 2020 AND Amount > (SELECT Amount FROM X WHERE Year = 2019 AND Service = X.Service);
Add a new row to the loans table with the following data: (101, 5000, 'approved', '2021-12-15 10:30:00')
CREATE TABLE loans (loan_number INT,amount DECIMAL(10,2),status VARCHAR(10),created_at TIMESTAMP);
INSERT INTO loans (loan_number, amount, status, created_at) VALUES (101, 5000, 'approved', '2021-12-15 10:30:00');
What is the average number of traditional arts preserved per country in North America?
CREATE TABLE arts_preservation (id INT,art_name VARCHAR(255),country VARCHAR(255),year INT); INSERT INTO arts_preservation (id,art_name,country,year) VALUES (1,'Hopi Kachina Dolls','USA',2005),(2,'Totem Poles','Canada',2010);
SELECT AVG(COUNT(*)) FROM arts_preservation GROUP BY country;
What is the total labor hours for all traditional building projects in the state of Washington, Oregon, and California?
CREATE TABLE project (id INT,state VARCHAR(20),type VARCHAR(20),hours INT); INSERT INTO project (id,state,type,hours) VALUES (1,'Washington','Sustainable',500),(2,'Oregon','Sustainable',600),(3,'Seattle','Traditional',300),(4,'California','Traditional',700);
SELECT SUM(hours) FROM project WHERE state IN ('Washington', 'Oregon', 'California') AND type = 'Traditional';
What is the average number of visitors to eco-friendly accommodations in Canada per year?
CREATE TABLE accommodations (id INT,name TEXT,country TEXT,type TEXT,visitors INT); INSERT INTO accommodations (id,name,country,type,visitors) VALUES (1,'Eco Lodge','Canada','Eco-friendly',1500),(2,'Green Hotel','Canada','Eco-friendly',2000);
SELECT AVG(visitors) FROM accommodations WHERE country = 'Canada' AND type = 'Eco-friendly';
Find the average depth of all trenches in the Indian Ocean.
CREATE TABLE trenches (trench_name TEXT,location TEXT,min_depth REAL,max_depth REAL);
SELECT AVG(AVG(min_depth) + AVG(max_depth))/2 FROM trenches WHERE location LIKE '%Indian%';
Delete a cultural heritage site in India
CREATE TABLE heritage_sites (site_id INT,site_name TEXT,country TEXT); INSERT INTO heritage_sites (site_id,site_name,country) VALUES (1,'Ancient City','India');
DELETE FROM heritage_sites WHERE site_name = 'Ancient City' AND country = 'India';
What is the maximum distance traveled by a rover on Mars?
CREATE TABLE Rovers (RoverID INT,Name VARCHAR(100),MaxDistanceTraveled FLOAT); CREATE TABLE MarsMissions (MissionID INT,RoverID INT,DistanceTraveled FLOAT,Date DATETIME);
SELECT MAX(r.MaxDistanceTraveled) FROM Rovers r INNER JOIN MarsMissions m ON r.RoverID = m.RoverID WHERE m.DistanceTraveled > 0;
Number of underwater expeditions per year
CREATE TABLE expeditions (id INT,location VARCHAR(255),year INT,objective VARCHAR(255)); INSERT INTO expeditions (id,location,year,objective) VALUES (1,'Mariana Trench',2020,'Deep-sea exploration');
SELECT year, COUNT(*) FROM expeditions GROUP BY year;
What is the market share of public transportation in Tokyo and London in 2021?
CREATE TABLE Transportation_Market_Share (city VARCHAR(20),year INT,market_share DECIMAL(5,2)); INSERT INTO Transportation_Market_Share (city,year,market_share) VALUES ('Tokyo',2021,0.52),('Tokyo',2022,0.55),('London',2021,0.43),('London',2022,0.45);
SELECT AVG(market_share) FROM Transportation_Market_Share WHERE city IN ('Tokyo', 'London') AND year = 2021;
List the names of companies that have had at least one round of funding over $100 million and have a female CEO.
CREATE TABLE companies (id INT,name TEXT,industry TEXT,founding_date DATE,CEO_gender TEXT);CREATE TABLE funds (id INT,company_id INT,amount INT,funding_round TEXT);
SELECT companies.name FROM companies INNER JOIN funds ON companies.id = funds.company_id WHERE funds.amount > 100000000 AND companies.CEO_gender = 'woman';
What is the total number of public libraries in California and Texas, and how many books are available in those libraries?
CREATE TABLE states (state_name VARCHAR(255)); INSERT INTO states (state_name) VALUES ('California'),('Texas'); CREATE TABLE libraries (library_name VARCHAR(255),state_name VARCHAR(255),num_books INTEGER); INSERT INTO libraries (library_name,state_name,num_books) VALUES ('LA Public Library','California',3000000),('San Francisco Public Library','California',2500000),('Houston Public Library','Texas',4000000),('Dallas Public Library','Texas',3000000);
SELECT SUM(libraries.num_books) AS total_books, states.state_name FROM libraries JOIN states ON libraries.state_name = states.state_name WHERE states.state_name IN ('California', 'Texas') GROUP BY states.state_name;
How many games were won by team 'Red' in the eSports tournament?
CREATE TABLE games (id INT,team1 TEXT,team2 TEXT,winner TEXT); INSERT INTO games (id,team1,team2,winner) VALUES (1,'Red','Blue','Red'),(2,'Green','Red','Green'),(3,'Red','Yellow','Red');
SELECT COUNT(*) FROM games WHERE winner = 'Red';
Calculate the average daily oil production in the North Sea for the last 6 months
CREATE TABLE production (id INT,region VARCHAR(255),date DATE,oil_production INT); INSERT INTO production (id,region,date,oil_production) VALUES (1,'North Sea','2021-07-01',1200); INSERT INTO production (id,region,date,oil_production) VALUES (2,'North Sea','2021-07-02',1300);
SELECT region, AVG(oil_production) as avg_daily_production FROM production WHERE region = 'North Sea' AND date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY region;
What is the total number of research publications by female authors in the Artificial Intelligence field?
CREATE TABLE Publications (PublicationID INT,AuthorGender VARCHAR(10),Field VARCHAR(50),Count INT); INSERT INTO Publications (PublicationID,AuthorGender,Field,Count) VALUES (1,'Female','Artificial Intelligence',2),(2,'Male','Machine Learning',3),(3,'Female','Data Science',4),(4,'Male','Computer Vision',1);
SELECT SUM(Count) FROM Publications WHERE AuthorGender = 'Female' AND Field = 'Artificial Intelligence';
What is the total number of investments made by women-led organizations?
CREATE TABLE Investors (InvestorID INT,Name VARCHAR(50),Gender VARCHAR(10)); INSERT INTO Investors (InvestorID,Name,Gender) VALUES (1,'Alice','Female'),(2,'Bob','Male'); CREATE TABLE Investments (InvestmentID INT,InvestorID INT,Amount FLOAT); INSERT INTO Investments (InvestmentID,InvestorID,Amount) VALUES (1,1,10000),(2,1,15000),(3,2,20000);
SELECT SUM(Amount) FROM Investments INNER JOIN Investors ON Investments.InvestorID = Investors.InvestorID WHERE Investors.Gender = 'Female';
What is the average media literacy score for each age group?
CREATE TABLE media_literacy_scores (id INT,age_group VARCHAR(255),score INT);
SELECT age_group, AVG(score) FROM media_literacy_scores GROUP BY age_group;
What is the number of hospitals in rural India?
CREATE TABLE hospitals (id INT,name VARCHAR(50),location VARCHAR(50)); INSERT INTO hospitals (id,name,location) VALUES (1,'Rural Hospital India','Rural India'); INSERT INTO hospitals (id,name,location) VALUES (2,'New York Presbyterian','Urban New York');
SELECT COUNT(*) FROM hospitals WHERE location = 'Rural India';
What is the total number of emergency calls received in the city of New York in the month of August?
CREATE TABLE EmergencyCalls (id INT,city VARCHAR(20),month INT,call_count INT);
SELECT SUM(call_count) FROM EmergencyCalls WHERE city = 'New York' AND month = 8;
What is the total number of eco-certified accommodations in Australia, Brazil, and Colombia in 2020?
CREATE TABLE australia_accommodations (country VARCHAR(50),year INT,eco_certified INT);CREATE TABLE brazil_accommodations (country VARCHAR(50),year INT,eco_certified INT);CREATE TABLE colombia_accommodations (country VARCHAR(50),year INT,eco_certified INT);
SELECT SUM(eco_certified) FROM (SELECT country, SUM(eco_certified) AS eco_certified FROM australia_accommodations WHERE year = 2020 GROUP BY country UNION ALL SELECT country, SUM(eco_certified) AS eco_certified FROM brazil_accommodations WHERE year = 2020 GROUP BY country UNION ALL SELECT country, SUM(eco_certified) AS eco_certified FROM colombia_accommodations WHERE year = 2020 GROUP BY country) AS total;
What is the total spending on military technologies for each country and their respective technology categories in the last decade?
CREATE TABLE country (id INT,name VARCHAR(255)); INSERT INTO country (id,name) VALUES (1,'USA'),(2,'China'),(3,'Russia'); CREATE TABLE military_tech (id INT,name VARCHAR(255),category VARCHAR(255),country_id INT,cost FLOAT); INSERT INTO military_tech (id,name,category,country_id,cost) VALUES (1,'J-20','Aircraft',2,120000000),(2,'Sukhoi Su-57','Aircraft',3,80000000);
SELECT c.name, mt.category, SUM(mt.cost) as total_spending FROM military_tech mt JOIN country c ON mt.country_id = c.id WHERE mt.timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 YEAR) GROUP BY c.name, mt.category;
What is the minimum number of overnight stays in hotels in Brazil in the last quarter?
CREATE TABLE hotels (hotel_id INT,hotel_name TEXT,overnight_stays INT,date DATE); INSERT INTO hotels (hotel_id,hotel_name,overnight_stays,date) VALUES (1,'Hotel Copacabana',500,'2021-10-01'),(2,'Hotel Ipanema',600,'2021-11-01');
SELECT MIN(overnight_stays) FROM hotels WHERE country = 'Brazil' AND date >= DATEADD(quarter, -1, GETDATE());
Insert a new record into the "budget_allocations" table for the "Education" department with a budget of $500,000
CREATE TABLE budget_allocations (allocation_id INT,department VARCHAR(50),budget DECIMAL(10,2));
INSERT INTO budget_allocations (department, budget) VALUES ('Education', 500000.00);
Delete all records in the 'pipelines' table where the 'operator' is 'Alpha Ltd' and the 'pipeline_type' is 'offshore'
CREATE TABLE pipelines (id INT PRIMARY KEY,name TEXT,operator TEXT,location TEXT,pipeline_type TEXT);
DELETE FROM pipelines WHERE operator = 'Alpha Ltd' AND pipeline_type = 'offshore';
What is the total revenue generated by eco-friendly hotels in France and Spain?
CREATE TABLE hotels (hotel_id INT,hotel_name VARCHAR(50),country VARCHAR(50),revenue FLOAT); INSERT INTO hotels (hotel_id,hotel_name,country,revenue) VALUES (1,'Green Eco-Hotel','France',50000),(2,'Blue Ocean Eco-Hotel','Spain',70000),(3,'Green Eco-Resort','France',60000),(4,'Solar Eco-Lodge','Spain',80000);
SELECT SUM(revenue) FROM hotels WHERE country IN ('France', 'Spain') AND hotel_name LIKE '%eco%';
What is the minimum number of publications for faculty members in the College of Business with tenure?
CREATE TABLE faculty_business (id INT,name VARCHAR(50),department VARCHAR(50),tenure_status VARCHAR(50),num_publications INT); INSERT INTO faculty_business (id,name,department,tenure_status,num_publications) VALUES (1,'Nancy','College of Business','Tenured',4),(2,'Oliver','College of Business','Tenured',6),(3,'Olivia','College of Business','Not Tenured',2);
SELECT MIN(num_publications) FROM faculty_business WHERE department = 'College of Business' AND tenure_status = 'Tenured';
Show the distribution of account balances for customers in the Southeast region.
CREATE TABLE accounts (account_id INT,customer_id INT,balance DECIMAL(10,2)); INSERT INTO accounts (account_id,customer_id,balance) VALUES (1,1,1200.00),(2,1,2500.00),(3,2,400.00);
SELECT customers.region, accounts.balance FROM accounts JOIN customers ON accounts.customer_id = customers.customer_id;
Add new ethical labor practice record 'Sustainable Production' to 'labor_practice' table
CREATE TABLE labor_practice (practice_id VARCHAR(10),name VARCHAR(50),description TEXT,primary key (practice_id));
INSERT INTO labor_practice (practice_id, name, description) VALUES ('SP', 'Sustainable Production', 'Manufacturing processes are environmentally friendly');
What are the unique IP addresses that have been associated with both suspicious and successful login attempts?
CREATE TABLE login_attempts (id INT,ip_address VARCHAR(15),login_status VARCHAR(10)); INSERT INTO login_attempts (id,ip_address,login_status) VALUES (1,'192.168.1.100','successful'),(2,'192.168.1.101','suspicious'),(3,'192.168.1.102','successful');
SELECT ip_address FROM login_attempts WHERE login_status = 'suspicious' INTERSECT SELECT ip_address FROM login_attempts WHERE login_status = 'successful';
What is the average number of members in unions that focus on 'Metals'?
CREATE TABLE unions (id INT,name TEXT,domain TEXT,members INT); INSERT INTO unions (id,name,domain,members) VALUES (1,'United Steelworkers','Metals,Mining,Energy,Construction',850000); INSERT INTO unions (id,name,domain,members) VALUES (2,'International Association of Sheet Metal,Air,Rail and Transportation Workers','Transportation,Metals',200000);
SELECT AVG(members) FROM unions WHERE domain LIKE '%Metals%';
What is the total investment in smart city projects in the country of Japan?
CREATE TABLE smart_city_investment (project_name TEXT,country TEXT,investment INTEGER); INSERT INTO smart_city_investment (project_name,country,investment) VALUES ('Smart City Infrastructure Project','Japan',2000000);
SELECT SUM(investment) FROM smart_city_investment WHERE country = 'Japan';
What is the total quantity of menu items sold in each country?
CREATE TABLE menus (menu_id INT,item VARCHAR(255),category VARCHAR(255),price DECIMAL(10,2)); INSERT INTO menus VALUES (1,'Chicken Wings','Appetizers',12.99); INSERT INTO menus VALUES (2,'Beef Burger','Entrees',15.99); INSERT INTO menus VALUES (3,'Chocolate Cake','Desserts',8.99); CREATE TABLE sales (sale_id INT,menu_id INT,quantity INT,country VARCHAR(255));
SELECT s.country, SUM(s.quantity) as total_quantity FROM sales s GROUP BY s.country;