instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the total duration of workouts in the month of August 2020? | CREATE TABLE Workouts (WorkoutID INT,MemberID INT,WorkoutDate DATE,Duration INT); | SELECT SUM(Duration) FROM Workouts WHERE MONTH(WorkoutDate) = 8 AND YEAR(WorkoutDate) = 2020; |
How many carbon offset initiatives were implemented in 'Country D' between 2015 and 2020? | CREATE TABLE CarbonOffsets (OffsetID INT,OffsetName VARCHAR(255),Country VARCHAR(255),ImplementationYear INT); INSERT INTO CarbonOffsets (OffsetID,OffsetName,Country,ImplementationYear) VALUES (1,'Carbon Forestation','Country D',2018); | SELECT COUNT(*) FROM CarbonOffsets WHERE Country = 'Country D' AND ImplementationYear BETWEEN 2015 AND 2020; |
What was the total revenue for vegan skincare products in the US in Q3 2021? | CREATE TABLE skincare_sales (sale_date DATE,product_vegan BOOLEAN,revenue DECIMAL(10,2)); INSERT INTO skincare_sales (sale_date,product_vegan,revenue) VALUES ('2021-07-01',TRUE,60.00),('2021-07-02',FALSE,50.00); | SELECT SUM(revenue) FROM skincare_sales WHERE product_vegan = TRUE AND sale_date BETWEEN '2021-07-01' AND '2021-09-30'; |
Insert data into the 'electric_vehicle_stats' table | CREATE TABLE electric_vehicle_stats (id INT PRIMARY KEY,country VARCHAR(255),adoption_percentage DECIMAL(5,2)); | INSERT INTO electric_vehicle_stats (id, country, adoption_percentage) VALUES (1, 'Norway', 64.5); |
Which employees in the 'Plumbing' department worked on projects that used geothermal energy? | CREATE TABLE Employees (EmployeeID INT,FirstName VARCHAR(50),LastName VARCHAR(50),Position VARCHAR(50),Department VARCHAR(50)); INSERT INTO Employees (EmployeeID,FirstName,LastName,Position,Department) VALUES (5,'Mike','Johnson','Plumber','Plumbing'); CREATE TABLE ProjectEmployees (ProjectID INT,EmployeeID INT,Practice... | SELECT Employees.FirstName, Employees.LastName FROM Employees INNER JOIN ProjectEmployees ON Employees.EmployeeID = ProjectEmployees.EmployeeID INNER JOIN SustainablePractices ON ProjectEmployees.PracticeID = SustainablePractices.PracticeID WHERE Employees.Department = 'Plumbing' AND SustainablePractices.PracticeName =... |
What is the average carbon emissions (in metric tons) for the aviation industry in the United Kingdom and France? | CREATE TABLE carbon_emissions (industry VARCHAR(20),country VARCHAR(20),emissions FLOAT); INSERT INTO carbon_emissions (industry,country,emissions) VALUES ('Aviation','United Kingdom',100.0),('Aviation','United Kingdom',110.0),('Aviation','France',120.0),('Aviation','France',130.0); | SELECT AVG(emissions) FROM carbon_emissions WHERE industry = 'Aviation' AND country IN ('United Kingdom', 'France'); |
Create a view 'top_athletes' based on 'athletes' table with age greater than 20 | CREATE TABLE athletes (name VARCHAR(100),sport VARCHAR(50),country VARCHAR(50),age INT); | CREATE VIEW top_athletes AS SELECT * FROM athletes WHERE age > 20; |
What is the difference in the number of hospitals and clinics in the rural health database? | CREATE TABLE hospitals (id INT,name TEXT,location TEXT); INSERT INTO hospitals VALUES (1,'Rural Hospital A','Rural Town A'); INSERT INTO hospitals VALUES (2,'Rural Hospital B','Rural Town B'); CREATE TABLE clinics (id INT,name TEXT,location TEXT); INSERT INTO clinics VALUES (1,'Rural Clinic A','Rural Town A'); INSERT I... | SELECT COUNT(*) FROM hospitals EXCEPT SELECT COUNT(*) FROM clinics; |
List all wastewater treatment plants in New York and their treatment capacities. | CREATE TABLE wastewater_plants (id INT,name VARCHAR(50),state VARCHAR(20),capacity FLOAT); INSERT INTO wastewater_plants (id,name,state,capacity) VALUES (1,'New York Wastewater Plant','New York',50.0),(2,'Texas Wastewater Plant','Texas',75.0),(3,'California Wastewater Plant','California',60.0); | SELECT name, capacity FROM wastewater_plants WHERE state = 'New York'; |
How many security incidents were reported in the APAC region in the last 30 days? | CREATE TABLE incidents (id INT,region VARCHAR(255),date DATE); INSERT INTO incidents (id,region,date) VALUES (1,'APAC','2022-01-01'),(2,'EMEA','2022-01-05'),(3,'APAC','2022-01-20'); | SELECT COUNT(*) FROM incidents WHERE region = 'APAC' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY); |
Update the budget allocation for the 'Transportation' department in the 'BudgetAllocation' table | CREATE TABLE BudgetAllocation (department VARCHAR(20),budget INT); | UPDATE BudgetAllocation SET budget = 500000 WHERE department = 'Transportation'; |
Identify power plants utilizing carbon capture and storage technologies in Canada and the US, and their installed capacity. | CREATE TABLE power_plants (id INT,name VARCHAR(255),country VARCHAR(255),technology VARCHAR(255),capacity INT); | SELECT p.name, p.country, p.technology, p.capacity FROM power_plants p WHERE p.country IN ('Canada', 'United States') AND p.technology LIKE '%carbon capture%'; |
Identify the number of food safety violations for each restaurant in the 'safety_inspections' table, with a sustainability rating of 'high' or 'medium' in the 'restaurant_sustainability' table? | CREATE TABLE safety_inspections (restaurant_id INT,violation_count INT);CREATE TABLE restaurant_sustainability (restaurant_id INT,sustainability_rating VARCHAR(20)); | SELECT s.restaurant_id, SUM(s.violation_count) as total_violations FROM safety_inspections s INNER JOIN restaurant_sustainability rs ON s.restaurant_id = rs.restaurant_id WHERE rs.sustainability_rating IN ('high', 'medium') GROUP BY s.restaurant_id; |
List the language preservation initiatives for Indigenous communities in North America, ordered by the initiative start date in ascending order. | CREATE TABLE Initiatives (InitiativeID INT,InitiativeName TEXT,InitiativeType TEXT,StartDate DATE,EndDate DATE); INSERT INTO Initiatives (InitiativeID,InitiativeName,InitiativeType,StartDate,EndDate) VALUES (1001,'Project Wipazoka','Language Preservation','2018-01-01','2022-12-31'),(1002,'Program Tloque Nahuaque','Lang... | SELECT InitiativeName, StartDate FROM Initiatives WHERE InitiativeType = 'Language Preservation' AND Location IN ('North America', 'USA', 'Canada') ORDER BY StartDate ASC; |
Delete records with a city of 'Los Angeles' from the warehouse table | CREATE TABLE warehouse (warehouse_id INT,warehouse_name VARCHAR(50),city VARCHAR(50),country VARCHAR(50)); | DELETE FROM warehouse WHERE city = 'Los Angeles'; |
How many wheelchair-accessible vehicles are in the fleet? | CREATE TABLE vehicles (vehicle_id INT,vehicle_type TEXT,is_wheelchair_accessible BOOLEAN); | SELECT COUNT(*) FROM vehicles WHERE is_wheelchair_accessible = TRUE; |
What is the total number of events? | CREATE TABLE events (event_id INT); INSERT INTO events (event_id) VALUES (101),(102),(103),(104),(105),(106),(107),(108),(109),(110); | SELECT COUNT(*) as total_events FROM events; |
How many properties are there in each city with inclusive housing policies? | CREATE TABLE properties (property_id INT,city VARCHAR(20),inclusive_policy BOOLEAN); INSERT INTO properties (property_id,city,inclusive_policy) VALUES (1,'New York',true),(2,'Chicago',false),(3,'New York',true); | SELECT city, COUNT(*) as count_of_properties FROM properties WHERE inclusive_policy = true GROUP BY city; |
Identify the top 3 families who received the highest amount of humanitarian aid in Africa, ordered by the highest amount? | CREATE TABLE aid_distribution (family_id INT,region VARCHAR(20),amount_aid FLOAT); INSERT INTO aid_distribution (family_id,region,amount_aid) VALUES (1,'Africa',10000),(2,'Africa',15000),(3,'Africa',12000),(4,'Africa',8000),(5,'Africa',9000); | SELECT family_id, amount_aid, ROW_NUMBER() OVER (ORDER BY amount_aid DESC) as rank FROM aid_distribution WHERE region = 'Africa' AND rank <= 3; |
What is the sequence of case events for each prosecutor, ordered by their timestamp? | CREATE TABLE prosecutor_events (id INT,prosecutor_id INT,event_type VARCHAR(255),timestamp TIMESTAMP); INSERT INTO prosecutor_events (id,prosecutor_id,event_type,timestamp) VALUES (1,1,'Case Assignment','2022-01-01 10:00:00'); INSERT INTO prosecutor_events (id,prosecutor_id,event_type,timestamp) VALUES (2,1,'Charge Fil... | SELECT prosecutor_id, event_type, timestamp, ROW_NUMBER() OVER(PARTITION BY prosecutor_id ORDER BY timestamp) as sequence FROM prosecutor_events; |
What is the distribution of international call volume by region and day of the week? | CREATE TABLE international_call_volume (call_date DATE,region VARCHAR(20),call_volume INT); INSERT INTO international_call_volume (call_date,region,call_volume) VALUES ('2022-01-01','Asia',500),('2022-01-02','Europe',600),('2022-01-03','Africa',700); | SELECT DATE_FORMAT(call_date, '%W') AS day_of_week, region, SUM(call_volume) AS total_call_volume FROM international_call_volume GROUP BY day_of_week, region; |
Calculate the total quantity of orders for each supplier on each date, excluding orders from suppliers with ethical certification. | CREATE TABLE orders (id INT PRIMARY KEY,supplier_id INT,material_id INT,quantity INT,order_date DATE); INSERT INTO orders (id,supplier_id,material_id,quantity,order_date) VALUES (1,1,1,500,'2021-01-01'),(2,2,2,300,'2021-01-01'),(3,3,3,400,'2021-01-02'),(4,1,4,600,'2021-01-02'); CREATE TABLE ethical_certifications (id I... | SELECT o.supplier_id, SUM(o.quantity) as total_quantity, o.order_date FROM orders o LEFT JOIN ethical_certifications ec ON o.supplier_id = ec.supplier_id WHERE ec.supplier_id IS NULL GROUP BY o.supplier_id, o.order_date; |
How many market access strategies were implemented for 'DrugI' in 2022? | CREATE TABLE drug_i_strategies (year INTEGER,strategy_count INTEGER); INSERT INTO drug_i_strategies (year,strategy_count) VALUES (2022,2); | SELECT strategy_count FROM drug_i_strategies WHERE year = 2022; |
What is the maximum number of attendees for performing arts events? | CREATE TABLE events (id INT,name VARCHAR(255),date DATE,category VARCHAR(255),price DECIMAL(5,2),attendance INT); INSERT INTO events (id,name,date,category,price,attendance) VALUES (1,'Concert','2022-06-01','music',50.00,1200),(2,'Play','2022-06-02','theater',80.00,800),(3,'Festival','2022-06-03','music',75.00,1500),(4... | SELECT MAX(attendance) FROM events WHERE category = 'performing arts'; |
What is the earliest date a patient in Chicago started therapy, along with their corresponding patient ID? | CREATE TABLE therapy_sessions (id INT,patient_id INT,session_date DATE); INSERT INTO therapy_sessions (id,patient_id,session_date) VALUES (1,1,'2021-01-01'),(2,2,'2021-02-01'),(3,3,'2021-03-01'),(4,1,'2021-04-01'); | SELECT patient_id, MIN(session_date) AS first_session_date FROM therapy_sessions WHERE city = 'Chicago' GROUP BY patient_id; |
Which producers in Nevada have the lowest average price per gram of flower since August 2021? | CREATE TABLE ProducersNevada (ProducerID INT,Name VARCHAR(100),State VARCHAR(100)); CREATE TABLE FlowerPrices (PriceID INT,ProducerID INT,PricePerGram DECIMAL(5,2),PriceDate DATE); | SELECT P.Name, AVG(FP.PricePerGram) as AvgPricePerGram FROM ProducersNevada P JOIN FlowerPrices FP ON P.ProducerID = FP.ProducerID WHERE P.State = 'Nevada' AND FP.PriceDate >= '2021-08-01' GROUP BY P.Name ORDER BY AvgPricePerGram ASC; |
What is the average distance of Mars from the Sun, based on the space_planets table? | CREATE TABLE space_planets (name TEXT,distance_from_sun FLOAT); INSERT INTO space_planets (name,distance_from_sun) VALUES ('Mercury',0.39),('Venus',0.72),('Earth',1.00),('Mars',1.52); | SELECT AVG(distance_from_sun) FROM space_planets WHERE name = 'Mars'; |
Add a new safety inspection for vessel V005 on 2022-03-15 | safety_inspections(inspection_id,vessel_id,inspection_date) | INSERT INTO safety_inspections (inspection_id, vessel_id, inspection_date) VALUES (1005, 'V005', '2022-03-15'); |
List the top 3 countries with the highest number of music festivals in the last 5 years. | CREATE TABLE Festivals (festival_id INT,country VARCHAR(50),festival_date DATE); INSERT INTO Festivals (festival_id,country,festival_date) VALUES (1,'USA','2017-07-01'),(2,'Canada','2018-08-01'),(3,'USA','2019-09-01'),(4,'Mexico','2020-10-01'),(5,'Brazil','2021-11-01'); | SELECT country, COUNT(festival_id) as festival_count FROM Festivals WHERE festival_date >= DATE_SUB(CURDATE(), INTERVAL 5 YEAR) GROUP BY country ORDER BY festival_count DESC LIMIT 3; |
Update the revenue for the K-Pop genre in South Korea for the year 2021 to 10000.0 | CREATE TABLE music_genres (genre VARCHAR(255),country VARCHAR(255),revenue FLOAT); INSERT INTO music_genres (genre,country,revenue) VALUES ('K-Pop','South Korea',8000.0),('Trot','South Korea',6000.0),('Folk','South Korea',4000.0); | UPDATE music_genres SET revenue = 10000.0 WHERE genre = 'K-Pop' AND country = 'South Korea' AND YEAR(event_date) = 2021; |
Identify the number of military equipment types for which each maintenance department is responsible, displaying the results in descending order by the number of equipment types. | CREATE TABLE military_equipment_v2 (equipment_id INT,type VARCHAR(255),department VARCHAR(255));INSERT INTO military_equipment_v2 (equipment_id,type,department) VALUES (1,'Aircraft','Aerospace Engineering'),(2,'Vehicle','Ground Vehicle Maintenance'),(3,'Ship','Naval Architecture'),(4,'Vehicle','Ground Vehicle Maintenan... | SELECT department, COUNT(DISTINCT type) as equipment_types FROM military_equipment_v2 GROUP BY department ORDER BY equipment_types DESC; |
What is the total number of news articles published in the "news_articles" table before 2022? | CREATE TABLE news_articles (id INT,title VARCHAR(100),author_id INT,published_date DATE); INSERT INTO news_articles (id,title,author_id,published_date) VALUES (1,'News Article 1',1,'2021-01-01'),(2,'News Article 2',2,'2022-01-02'); | SELECT COUNT(*) FROM news_articles WHERE published_date < '2022-01-01'; |
Find the number of distinct players who have played games on each platform, excluding mobile gamers. | CREATE TABLE PlayerPlatform (PlayerID INT,Platform VARCHAR(10)); INSERT INTO PlayerPlatform (PlayerID,Platform) VALUES (1,'PC'),(2,'Console'),(3,'Mobile'),(4,'PC'); | SELECT Platform, COUNT(DISTINCT PlayerID) as NumPlayers FROM PlayerPlatform WHERE Platform != 'Mobile' GROUP BY Platform; |
Find total cost of accommodations per disability type for students in Texas. | CREATE TABLE Accommodations (id INT,student_id INT,disability_type VARCHAR(50),cost FLOAT); | SELECT d.disability_type, SUM(a.cost) as total_cost FROM Accommodations a JOIN Students s ON a.student_id = s.id JOIN Disabilities d ON a.disability_type = d.type WHERE s.state = 'TX' GROUP BY d.disability_type; |
What is the total revenue of accessible technology products in Africa? | CREATE TABLE Revenue (id INT,product VARCHAR(50),revenue DECIMAL(5,2),country VARCHAR(50)); INSERT INTO Revenue (id,product,revenue,country) VALUES (1,'Accessible Phone',12000.00,'Kenya'),(2,'Adaptive Laptop',18000.00,'Nigeria'),(3,'Assistive Software',8000.00,'South Africa'); | SELECT SUM(revenue) FROM Revenue WHERE country IN ('Kenya', 'Nigeria', 'South Africa') AND product LIKE '%accessible%'; |
What is the minimum labor cost for construction workers in Texas in 2021? | CREATE TABLE Labor_Costs_TX (WorkerID INT,State VARCHAR(50),Year INT,HourlyRate FLOAT); | SELECT MIN(HourlyRate) FROM Labor_Costs_TX WHERE State = 'Texas' AND Year = 2021; |
What is the total number of military technology patents filed in Asia in the last decade? | CREATE TABLE military_tech_patents (patent_id INT,location VARCHAR(255),timestamp TIMESTAMP); INSERT INTO military_tech_patents (patent_id,location,timestamp) VALUES (1,'China','2012-02-12 15:20:00'),(2,'India','2013-03-03 09:30:00'),(3,'South Korea','2014-01-10 11:45:00'); | SELECT COUNT(*) FROM military_tech_patents WHERE location LIKE 'Asia%' AND timestamp > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 YEAR); |
What is the average number of daily trips for shared bicycles in Mexico City? | CREATE TABLE public.daily_trips_bicycle (id SERIAL PRIMARY KEY,bike_type TEXT,city TEXT,daily_trips INTEGER); INSERT INTO public.daily_trips_bicycle (bike_type,city,daily_trips) VALUES ('shared_bicycle','Mexico City',12000),('shared_bicycle','Mexico City',14000),('shared_bicycle','Mexico City',16000); | SELECT AVG(daily_trips) FROM public.daily_trips_bicycle WHERE bike_type = 'shared_bicycle' AND city = 'Mexico City'; |
What is the number of companies founded in each country by age group of founders (under 30, 30-39, 40-49, 50+)? | CREATE TABLE founders (founder_id INT,company_id INT,age INT); CREATE TABLE companies (company_id INT,founding_year INT,country VARCHAR(255)); CREATE TABLE age_groups (age INT,age_group VARCHAR(255)); INSERT INTO founders (founder_id,company_id,age) VALUES (1,1,28),(2,2,35),(3,3,43),(4,4,51); INSERT INTO companies (com... | SELECT companies.country, age_groups.age_group, COUNT(f.founder_id) as num_companies_founded FROM founders f JOIN companies c ON f.company_id = c.company_id JOIN age_groups ag ON f.age BETWEEN ag.age AND ag.age + 9 GROUP BY companies.country, age_groups.age_group; |
How many hydroelectric power stations are there in Country Z? | CREATE TABLE hydro_stations (name TEXT,location TEXT,capacity_MW INTEGER); INSERT INTO hydro_stations (name,location,capacity_MW) VALUES ('Station A','Country Z',300),('Station B','Country Y',400),('Station C','Country Z',250); | SELECT COUNT(*) FROM hydro_stations WHERE location = 'Country Z'; |
Which marine protected areas have an average depth greater than 1000 meters? | CREATE TABLE protected_areas_depth (protected_area TEXT,avg_depth_m FLOAT); INSERT INTO protected_areas_depth (protected_area,avg_depth_m) VALUES ('Sargasso Sea',1500.0),('Great Barrier Reef',500.0),('Galapagos Islands',2000.0); | SELECT protected_area FROM protected_areas_depth WHERE avg_depth_m > 1000; |
What is the average age of players who play VR games, partitioned by platform? | CREATE TABLE Players (PlayerID INT,Age INT,Gender VARCHAR(10),Platform VARCHAR(10)); INSERT INTO Players (PlayerID,Age,Gender,Platform) VALUES (1,30,'Male','Oculus'); INSERT INTO Players (PlayerID,Age,Gender,Platform) VALUES (2,25,'Female','HTC Vive'); | SELECT Platform, AVG(Age) AS AvgAge FROM Players WINDOW W as (PARTITION BY Platform) |
Who are the employees working in the 'GreenTech' industry? | CREATE TABLE Company (id INT,name TEXT,industry TEXT,location TEXT); INSERT INTO Company (id,name,industry,location) VALUES (1,'EcoInnovations','GreenTech','Nigeria'),(2,'BioSolutions','Biotech','Brazil'),(3,'TechBoost','Tech','India'); CREATE TABLE Employee (id INT,company_id INT,name TEXT,role TEXT,gender TEXT,ethnic... | SELECT Employee.name FROM Employee INNER JOIN Company ON Company.id = Employee.company_id WHERE Company.industry = 'GreenTech'; |
Which painting has undergone the most recent restoration? | CREATE TABLE art_preservation (id INT,artwork_title VARCHAR(50),restoration_date DATE,restoration_cost DECIMAL(5,2)); INSERT INTO art_preservation (id,artwork_title,restoration_date,restoration_cost) VALUES (1,'The Starry Night','2022-02-28',5000.00); INSERT INTO art_preservation (id,artwork_title,restoration_date,rest... | SELECT artwork_title, restoration_date, ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY restoration_date DESC) as ranking FROM art_preservation; |
What is the total number of cargo handling delays and the average delay duration for each port in the Pacific Ocean in 2022? | CREATE TABLE CargoHandling (cargo_handling_id INT,port_id INT,delay_duration INT,handling_date DATE); | SELECT p.port_name, COUNT(ch.cargo_handling_id) as total_delays, AVG(ch.delay_duration) as avg_delay_duration FROM CargoHandling ch JOIN Ports p ON ch.port_id = p.port_id WHERE p.region = 'Pacific Ocean' AND ch.handling_date >= '2022-01-01' GROUP BY p.port_id; |
What is the maximum depth (in meters) for all marine species in the 'oceanic_species' table? | CREATE TABLE oceanic_species (species_id INT,species_name VARCHAR(50),max_depth INT); | SELECT MAX(max_depth) FROM oceanic_species; |
What is the average speed of vessels arriving from the Philippines? | CREATE TABLE vessels(id INT,name VARCHAR(50),country VARCHAR(50),average_speed DECIMAL(5,2)); INSERT INTO vessels(id,name,country,average_speed) VALUES (1,'Vessel A','Philippines',14.5),(2,'Vessel B','Philippines',16.3); | SELECT AVG(average_speed) FROM vessels WHERE country = 'Philippines'; |
What is the total waste generation and recycling rate for each country in the year 2022? | CREATE TABLE WasteGenerationByCountry (country VARCHAR(255),year INT,waste_quantity INT); INSERT INTO WasteGenerationByCountry (country,year,waste_quantity) VALUES ('CountryA',2022,1500000),('CountryB',2022,1200000),('CountryC',2022,1800000); CREATE TABLE RecyclingRatesByCountry (country VARCHAR(255),year INT,recycling... | SELECT wg.country, wg.year, wg.waste_quantity, rr.recycling_rate FROM WasteGenerationByCountry wg INNER JOIN RecyclingRatesByCountry rr ON wg.country = rr.country WHERE wg.year = 2022; |
What's the viewership trend for TV shows in the UK? | CREATE TABLE tv_show (id INT PRIMARY KEY,title VARCHAR(255),year INT,country VARCHAR(255)); CREATE TABLE viewership (id INT PRIMARY KEY,tv_show_id INT,viewership_count INT,view_date DATE); INSERT INTO tv_show (id,title,year,country) VALUES (1,'TVShowA',2010,'UK'),(2,'TVShowB',2015,'UK'); INSERT INTO viewership (id,tv_s... | SELECT t.title, v.view_date, AVG(v.viewership_count) AS avg_viewership FROM tv_show t JOIN viewership v ON t.id = v.tv_show_id WHERE t.country = 'UK' GROUP BY t.id, v.view_date ORDER BY v.view_date; |
Insert a new network usage record into the network_usage table | CREATE TABLE network_usage (usage_id INT,subscriber_id INT,usage_date DATE,usage_type VARCHAR(50),usage_duration INT); | INSERT INTO network_usage (usage_id, subscriber_id, usage_date, usage_type, usage_duration) VALUES (3001, 1001, '2022-01-01', 'Mobile', 150); |
What is the total volume of timber produced by country in 2020? | CREATE TABLE country (id INT,name VARCHAR(255)); INSERT INTO country (id,name) VALUES (1,'USA'),(2,'Canada'),(3,'Brazil'); CREATE TABLE timber_production (country_id INT,year INT,volume INT); INSERT INTO timber_production (country_id,year,volume) VALUES (1,2020,12000),(1,2019,11000),(2,2020,15000),(2,2019,14000),(3,202... | SELECT c.name, SUM(tp.volume) as total_volume FROM timber_production tp JOIN country c ON tp.country_id = c.id WHERE tp.year = 2020 GROUP BY c.name; |
Who are the top 3 suppliers with the highest average ethical product ratings? | CREATE TABLE suppliers (supplier_id INT,supplier_name TEXT,ethical_rating FLOAT); INSERT INTO suppliers (supplier_id,supplier_name,ethical_rating) VALUES (1,'Green Supplies',4.8),(2,'Eco Friendly Inc',4.6),(3,'Fair Trade Co',4.5); | SELECT supplier_name, AVG(ethical_rating) AS avg_rating FROM suppliers GROUP BY supplier_name ORDER BY avg_rating DESC LIMIT 3; |
How many pallets were shipped from the EMEA region to the Americas via the ocean freight route in Q2 2022? | CREATE TABLE Shipments (id INT,customer VARCHAR(255),region_origin VARCHAR(255),region_destination VARCHAR(255),route_type VARCHAR(255),quantity INT,quarter INT,year INT); | SELECT SUM(quantity) FROM Shipments WHERE (region_origin = 'EMEA' AND region_destination = 'Americas') AND route_type = 'ocean freight' AND quarter = 2 AND year = 2022; |
What is the earliest launch date for a spacecraft with a speed over 15000 mph? | CREATE TABLE SpacecraftSpeed (id INT,launch_date DATE,speed FLOAT); | SELECT MIN(launch_date) FROM SpacecraftSpeed WHERE speed > 15000; |
What is the average number of hospitals per region, ordered from highest to lowest? | CREATE TABLE hospitals (id INT,region VARCHAR(255),name VARCHAR(255)); INSERT INTO hospitals (id,region,name) VALUES (1,'Northeast','Hospital A'),(2,'West','Hospital B'),(3,'South','Hospital C'); | SELECT AVG(hospital_count) as avg_hospitals_per_region FROM (SELECT region, COUNT(*) as hospital_count FROM hospitals GROUP BY region) subquery; |
What is the maximum number of military personnel in each branch of the military? | CREATE TABLE MilitaryPersonnel (branch TEXT,num_personnel INTEGER); INSERT INTO MilitaryPersonnel (branch,num_personnel) VALUES ('Army',500000),('Navy',350000),('AirForce',300000),('Marines',200000); | SELECT branch, MAX(num_personnel) FROM MilitaryPersonnel GROUP BY branch; |
How many containers were shipped from the Port of Rotterdam to North America in the last 6 months? | CREATE TABLE ports (id INT,name TEXT,location TEXT); INSERT INTO ports (id,name,location) VALUES (1,'Port of Rotterdam','Rotterdam,Netherlands'); CREATE TABLE shipments (id INT,container_count INT,departure_port_id INT,arrival_region TEXT,shipment_date DATE); INSERT INTO shipments (id,container_count,departure_port_id,... | SELECT SUM(container_count) FROM shipments WHERE departure_port_id = (SELECT id FROM ports WHERE name = 'Port of Rotterdam') AND arrival_region = 'North America' AND shipment_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); |
Calculate the total claim amount and average claim amount for each policy type | CREATE TABLE claims (claim_id INT,policy_type VARCHAR(20),claim_amount INT); INSERT INTO claims (claim_id,policy_type,claim_amount) VALUES (1,'Auto',500),(2,'Home',1200),(3,'Auto',2500),(4,'Life',3000); | SELECT policy_type, SUM(claim_amount) AS total_claim_amount, AVG(claim_amount) AS avg_claim_amount FROM claims GROUP BY policy_type; |
List the unique well identifiers from the 'gas_production' table for the year 2019 and 2020 | CREATE TABLE gas_production (well_id INT,year INT,gas_volume FLOAT); | SELECT DISTINCT well_id FROM gas_production WHERE year IN (2019, 2020); |
What is the oldest artwork in the 'Renaissance' gallery? | CREATE TABLE Artworks (artwork_id INT,artwork_name VARCHAR(50),year_created INT,gallery_name VARCHAR(50)); INSERT INTO Artworks (artwork_id,artwork_name,year_created,gallery_name) VALUES (1,'Mona Lisa',1503,'Renaissance'),(2,'The Last Supper',1495,'Renaissance'); | SELECT artwork_name FROM Artworks WHERE gallery_name = 'Renaissance' AND year_created = (SELECT MIN(year_created) FROM Artworks WHERE gallery_name = 'Renaissance'); |
What is the total number of digital assets in the 'Utility' category? | CREATE TABLE Digital_Assets (asset_name TEXT,category TEXT); INSERT INTO Digital_Assets (asset_name,category) VALUES ('Asset A','Utility'),('Asset B','Security'),('Asset C','Utility'),('Asset D','Utility'),('Asset E','Security'); | SELECT COUNT(*) FROM Digital_Assets WHERE category = 'Utility'; |
What was the total drug approval count for 'MedHealth' in the USA for 2021? | CREATE TABLE drug_approval (company TEXT,country TEXT,approval_year INT,approval_count INT); INSERT INTO drug_approval (company,country,approval_year,approval_count) VALUES ('MedHealth','USA',2021,5); | SELECT SUM(approval_count) FROM drug_approval WHERE company = 'MedHealth' AND country = 'USA' AND approval_year = 2021; |
How many traffic accidents were reported in the state of New York in the year 2020? | CREATE TABLE traffic_accidents (id INT,state VARCHAR(20),year INT,accidents INT); INSERT INTO traffic_accidents (id,state,year,accidents) VALUES (1,'New York',2020,120); | SELECT SUM(accidents) FROM traffic_accidents WHERE state = 'New York' AND year = 2020; |
What is the total donation amount for the 'Arts & Culture' category, excluding donations made by donor_id 101? | CREATE TABLE category (cat_id INT,name VARCHAR(255)); INSERT INTO category (cat_id,name) VALUES (1,'Arts & Culture'),(2,'Environment'),(3,'Health'),(4,'Education'); CREATE TABLE donation (don_id INT,donor_id INT,cat_id INT,amount DECIMAL(10,2)); INSERT INTO donation (don_id,donor_id,cat_id,amount) VALUES (1,101,1,500.0... | SELECT SUM(amount) FROM donation WHERE cat_id = (SELECT cat_id FROM category WHERE name = 'Arts & Culture') AND donor_id != 101; |
Find the average soil moisture level for corn in the last week | CREATE TABLE corn_moisture (measurement_date DATE,moisture_level DECIMAL(5,2)); | SELECT AVG(moisture_level) FROM corn_moisture WHERE measurement_date >= NOW() - INTERVAL '7 days'; |
What are the total oil and gas production figures for wells in the Marcellus and Barnett Shale formations? | CREATE TABLE shale_oil_gas_production (well_name TEXT,formation TEXT,oil_production INTEGER,gas_production INTEGER); INSERT INTO shale_oil_gas_production (well_name,formation,oil_production,gas_production) VALUES ('Well1','Marcellus',100000,5000000),('Well2','Marcellus',120000,6000000),('Well3','Barnett',80000,4000000)... | SELECT formation, SUM(oil_production) + SUM(gas_production) AS total_production FROM shale_oil_gas_production WHERE formation IN ('Marcellus', 'Barnett') GROUP BY formation; |
What is the moving average of weekly shipments for each warehouse in the last 3 months? | CREATE TABLE Warehouse (id INT,country VARCHAR(255),city VARCHAR(255),opened_date DATE); CREATE TABLE Shipments (id INT,warehouse_id INT,shipped_date DATE); | SELECT w.country, w.city, AVG(shipment_count) OVER (PARTITION BY w.id ORDER BY s.shipped_date ROWS BETWEEN 11 PRECEDING AND CURRENT ROW) AS moving_avg FROM Warehouse w JOIN Shipments s ON w.id = s.warehouse_id WHERE s.shipped_date >= DATEADD(month, -3, GETDATE()) GROUP BY w.id, s.shipped_date ORDER BY s.shipped_date; |
Update the defense projects table to reflect that project X was completed one month earlier than previously recorded | CREATE TABLE defense_projects (project_name VARCHAR(255),start_date DATE,end_date DATE); INSERT INTO defense_projects (project_name,start_date,end_date) VALUES ('Project X','2021-01-01','2021-06-30'),('Project Y','2021-02-01','2021-07-31'); | UPDATE defense_projects SET end_date = '2021-05-31' WHERE project_name = 'Project X'; |
What is the average maintenance cost for military vehicles by manufacturer, for the past year? | CREATE TABLE military_vehicles(id INT,manufacturer VARCHAR(255),type VARCHAR(255),cost DECIMAL(10,2),date DATE); | SELECT manufacturer, AVG(cost) as avg_cost FROM military_vehicles WHERE date > DATE_SUB(NOW(), INTERVAL 1 YEAR) GROUP BY manufacturer; |
What is the average billing amount for cases in the 'Family' case type? | CREATE TABLE FamilyCases (CaseID INT,CaseType VARCHAR(20),BillingAmount DECIMAL(10,2)); INSERT INTO FamilyCases (CaseID,CaseType,BillingAmount) VALUES (1,'Family',4000.00),(2,'Family',3000.00); | SELECT AVG(BillingAmount) FROM FamilyCases WHERE CaseType = 'Family'; |
What is the minimum age of players who play first-person shooter (FPS) games? | CREATE TABLE PlayerGamePreferences (PlayerID INT,Age INT,GameGenre VARCHAR(30)); INSERT INTO PlayerGamePreferences (PlayerID,Age,GameGenre) VALUES (1,16,'FPS'),(2,20,'RPG'),(3,18,'FPS'); | SELECT MIN(Age) FROM PlayerGamePreferences WHERE GameGenre = 'FPS'; |
Which government agencies in the state of Texas have not submitted any procurement data for the current fiscal year? | CREATE TABLE agencies(id INT,name VARCHAR(100),state VARCHAR(50));CREATE TABLE procurement_data(id INT,agency_id INT,fiscal_year INT,amount INT); | SELECT agencies.name FROM agencies LEFT JOIN procurement_data ON agencies.id = procurement_data.agency_id WHERE fiscal_year = YEAR(NOW()) AND state = 'Texas' GROUP BY agencies.name HAVING COUNT(procurement_data.id) = 0; |
Update the average speed of vessel SS-V002 to 22 knots | vessel_performance(vessel_id,max_speed,average_speed) | UPDATE vessel_performance SET average_speed = 22 WHERE vessel_id = 'SS-V002'; |
List the number of awards won by directors of different genders in Hollywood movies from 2000 to 2020. | CREATE TABLE awards (movie_id INT,title VARCHAR(100),release_year INT,director_gender VARCHAR(50),awards_won INT); INSERT INTO awards (movie_id,title,release_year,director_gender,awards_won) VALUES (1,'The Shape of Water',2017,'Female',4),(2,'The Hurt Locker',2008,'Male',6); | SELECT director_gender, SUM(awards_won) as total_awards_won FROM awards WHERE release_year BETWEEN 2000 AND 2020 GROUP BY director_gender; |
Delete the record with hospital_id 1 from the 'healthcare_staff' table | CREATE TABLE healthcare_staff (name VARCHAR(255),gender VARCHAR(255),position VARCHAR(255),hospital_id INT); INSERT INTO healthcare_staff (name,gender,position,hospital_id) VALUES ('Dr. John Doe','Male','Doctor',1),('Dr. Jane Smith','Female','Doctor',2),('Dr. Maria Garcia','Female','Doctor',3); | DELETE FROM healthcare_staff WHERE hospital_id = 1; |
What is the distribution of economic diversification efforts in the Andes region by sector? | CREATE TABLE Diversification (sector TEXT,initiative TEXT,region TEXT); INSERT INTO Diversification (sector,initiative,region) VALUES ('Agriculture','Crop Rotation','Andes'),('Manufacturing','Textiles','Andes'),('Services','Tourism','Andes'); | SELECT sector, COUNT(initiative) FROM Diversification WHERE region = 'Andes' GROUP BY sector; |
What is the retention rate of employees who have completed diversity and inclusion training? | CREATE TABLE EmployeeTraining (EmployeeID INT,TrainingType VARCHAR(50),TrainingCompletionDate DATE,EmploymentEndDate DATE); INSERT INTO EmployeeTraining (EmployeeID,TrainingType,TrainingCompletionDate,EmploymentEndDate) VALUES (1,'Diversity and Inclusion','2022-01-01','2023-01-01'),(2,NULL,NULL,'2022-01-01'); | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM EmployeeTraining WHERE TrainingType = 'Diversity and Inclusion' AND EmploymentEndDate IS NULL)) FROM EmployeeTraining WHERE TrainingType = 'Diversity and Inclusion' AND EmploymentEndDate IS NOT NULL; |
Which destinations in 'tourism_stats' table have more than 2 million visitors and their respective visitor counts? | CREATE TABLE tourism_stats (destination_name VARCHAR(50),visitor_count INT); INSERT INTO tourism_stats (destination_name,visitor_count) VALUES ('Tokyo',3000000),('New York',2500000),('London',2200000),('Sydney',1800000); | SELECT destination_name, visitor_count FROM tourism_stats WHERE visitor_count > 2000000; |
Which supplier provided the most Praseodymium in 2017? | CREATE TABLE praseodymium_supply (year INT,supplier VARCHAR(20),praseodymium_supply INT); INSERT INTO praseodymium_supply VALUES (2015,'Supplier F',22),(2016,'Supplier G',27),(2017,'Supplier H',32),(2018,'Supplier I',37),(2019,'Supplier J',42); | SELECT supplier, MAX(praseodymium_supply) FROM praseodymium_supply WHERE year = 2017 GROUP BY supplier; |
What is the total investment amount in social enterprises in Africa? | CREATE TABLE investment_data (id INT,investment_amount FLOAT,strategy VARCHAR(50),region VARCHAR(50)); INSERT INTO investment_data (id,investment_amount,strategy,region) VALUES (1,250000.00,'Renewable energy','Americas'); INSERT INTO investment_data (id,investment_amount,strategy,region) VALUES (2,500000.00,'Green ener... | SELECT SUM(investment_amount) FROM investment_data WHERE strategy = 'Social enterprises' AND region = 'Africa'; |
Which startups have a female founder and have had successful Series B rounds? | CREATE TABLE IF NOT EXISTS startups(id INT,name TEXT,founder_gender TEXT,round_type TEXT); INSERT INTO startups (id,name,founder_gender,round_type) VALUES (1,'Glossier','Female','Series B'); INSERT INTO startups (id,name,founder_gender,round_type) VALUES (2,'Rent the Runway','Female','Seed'); INSERT INTO startups (id,n... | SELECT name FROM startups WHERE founder_gender = 'Female' AND round_type = 'Series B'; |
List all donations made by donors from California in the 'donations' table. | CREATE TABLE donations (id INT,donor_name VARCHAR(50),donor_state VARCHAR(50),donation_date DATE,amount DECIMAL(10,2)); | SELECT * FROM donations WHERE donor_state = 'California'; |
Insert new dish 'Chickpea Salad' with ingredients: Chickpeas, Lettuce, Cucumber, Tomatoes. | CREATE TABLE dishes (dish_id INT PRIMARY KEY,dish_name VARCHAR(50)); INSERT INTO dishes (dish_id,dish_name) VALUES (1,'Pizza Margherita'),(2,'Tofu Stir Fry'); CREATE TABLE dishes_ingredients (dish_id INT,ingredient_id INT,quantity INT); | INSERT INTO dishes (dish_id, dish_name) VALUES (3, 'Chickpea Salad'); INSERT INTO dishes_ingredients (dish_id, ingredient_id, quantity) VALUES (3, 5, 200), (3, 6, 150), (3, 7, 100), (3, 1, 150); |
What is the average media literacy score by continent? | CREATE TABLE media_literacy (id INT,user_id INT,country VARCHAR(50),continent VARCHAR(50),score INT); INSERT INTO media_literacy (id,user_id,country,continent,score) VALUES (1,1,'USA','North America',70),(2,2,'Mexico','North America',65),(3,3,'Brazil','South America',60),(4,4,'Canada','North America',75),(5,5,'Argentin... | SELECT continent, AVG(score) as avg_score FROM media_literacy GROUP BY continent; |
What is the average age of defendants for each gender in the court cases? | CREATE TABLE court_cases (case_id INT,court_date DATE); INSERT INTO court_cases (case_id,court_date) VALUES (1,'2022-01-01'),(2,'2021-12-20'),(3,'2022-02-15'); CREATE TABLE defendant_info (defendant_id INT,case_id INT,age INT,gender VARCHAR(50)); INSERT INTO defendant_info (defendant_id,case_id,age,gender) VALUES (1,1,... | SELECT gender, AVG(age) as avg_age FROM defendant_info d INNER JOIN court_cases c ON d.case_id = c.case_id GROUP BY gender; |
Create a table named "conservation_efforts" with columns "country" and "conservation_programs". | CREATE TABLE conservation_efforts (country VARCHAR(255),conservation_programs VARCHAR(255)); | CREATE TABLE conservation_efforts (country VARCHAR(255), conservation_programs VARCHAR(255)); |
What is the total number of community health workers who identify as part of a historically underrepresented community? | CREATE TABLE CommunityHealthWorker (WorkerID INT,Identity VARCHAR(50)); INSERT INTO CommunityHealthWorker (WorkerID,Identity) VALUES (1,'African American'),(2,'Hispanic'),(3,'Asian American'),(4,'Native American'),(5,'Caucasian'),(6,'African American'),(7,'Hispanic'),(8,'Asian American'),(9,'Native American'),(10,'Cauc... | SELECT COUNT(*) as Total FROM CommunityHealthWorker WHERE Identity IN ('African American', 'Hispanic', 'Asian American', 'Native American'); |
What is the total number of volunteers who have contributed more than 50 hours? | CREATE TABLE Volunteers (VolunteerID INT,VolunteerName TEXT,Program TEXT); INSERT INTO Volunteers (VolunteerID,VolunteerName,Program) VALUES (1,'Alice','Education'),(2,'Bob','Health'),(3,'Charlie','Education'); CREATE TABLE VolunteerHours (VolunteerID INT,Hours INT); INSERT INTO VolunteerHours (VolunteerID,Hours) VAL... | SELECT COUNT(DISTINCT Volunteers.VolunteerID) FROM Volunteers JOIN VolunteerHours ON Volunteers.VolunteerID = VolunteerHours.VolunteerID GROUP BY Volunteers.VolunteerID HAVING SUM(VolunteerHours.Hours) > 50; |
Maximum number of biosensor patents filed in Japan | CREATE SCHEMA if not exists biosensor; CREATE TABLE if not exists biosensor.patents (id INT,name TEXT,country TEXT); INSERT INTO biosensor.patents (id,name,country) VALUES (1,'PatentX','Japan'); INSERT INTO biosensor.patents (id,name,country) VALUES (2,'PatentY','Canada'); INSERT INTO biosensor.patents (id,name,country... | SELECT COUNT(*) FROM biosensor.patents WHERE country = 'Japan' GROUP BY country HAVING COUNT(*) >= ALL (SELECT COUNT(*) FROM biosensor.patents GROUP BY country); |
What is the earliest excavation start date for each site? | CREATE TABLE ExcavationSites (id INT,site VARCHAR(20),location VARCHAR(30),start_date DATE,end_date DATE); INSERT INTO ExcavationSites (id,site,location,start_date,end_date) VALUES (1,'BronzeAge','UK','2000-01-01','2005-12-31'),(2,'AncientRome','Italy','1999-01-01','2002-12-31'),(3,'Mycenae','Greece','2003-01-01','2006... | SELECT site, MIN(start_date) FROM ExcavationSites GROUP BY site; |
Which vessels had delays in their arrivals to the port of Rotterdam? | CREATE TABLE vessels (id INT,name VARCHAR(255)); CREATE TABLE vessel_movements (id INT,vessel_id INT,departure_port_id INT,arrival_port_id INT,speed DECIMAL(5,2),date DATE,expected_date DATE); INSERT INTO vessels (id,name) VALUES (101,'VesselA'),(102,'VesselB'),(103,'VesselC'); INSERT INTO vessel_movements (id,vessel_i... | SELECT vessel_id, date, expected_date FROM vessel_movements WHERE arrival_port_id = (SELECT id FROM ports WHERE name = 'Rotterdam') AND date > expected_date; |
What is the total revenue generated from digital museum tours in the last month? | CREATE TABLE digital_tours (id INT,tour_date DATE,revenue DECIMAL(10,2)); INSERT INTO digital_tours (id,tour_date,revenue) VALUES (1,'2022-04-15',15.99),(2,'2022-04-20',12.99),(3,'2022-04-25',17.99); | SELECT SUM(revenue) FROM digital_tours WHERE tour_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE; |
List all financial wellbeing programs offered by lenders in the Middle East and their respective start dates. | CREATE TABLE Lenders (LenderID INT,LenderName VARCHAR(100),Region VARCHAR(50)); INSERT INTO Lenders (LenderID,LenderName,Region) VALUES (1,'Islamic Bank','Middle East'),(2,'Shariah Finance','Middle East'); CREATE TABLE Programs (ProgramID INT,LenderID INT,ProgramName VARCHAR(100),StartDate DATE); INSERT INTO Programs (... | SELECT Lenders.LenderName, Programs.ProgramName, Programs.StartDate FROM Lenders INNER JOIN Programs ON Lenders.LenderID = Programs.LenderID WHERE Lenders.Region = 'Middle East'; |
What is the total number of emergency incidents reported by each neighborhood in district 3? | CREATE TABLE districts (id INT,name VARCHAR(255)); INSERT INTO districts (id,name) VALUES (3,'Downtown'); CREATE TABLE neighborhoods (id INT,district_id INT,name VARCHAR(255)); INSERT INTO neighborhoods (id,district_id,name) VALUES (101,3,'Central Park'); INSERT INTO neighborhoods (id,district_id,name) VALUES (102,3,'R... | SELECT neighborhoods.name, COUNT(emergency_incidents.id) AS total_incidents FROM neighborhoods JOIN emergency_incidents ON neighborhoods.id = emergency_incidents.neighborhood_id WHERE neighborhoods.district_id = 3 GROUP BY neighborhoods.name; |
What is the total number of public transportation trips taken in the City of Los Angeles in the month of July in 2019 and 2020? | CREATE TABLE public_transit(trip_id INT,trip_date DATE,agency VARCHAR(255)); INSERT INTO public_transit(trip_id,trip_date,agency) VALUES (1,'2019-07-01','City of Los Angeles'),(2,'2020-07-01','City of Los Angeles'); | SELECT COUNT(*) FROM public_transit WHERE agency = 'City of Los Angeles' AND EXTRACT(MONTH FROM trip_date) = 7 AND EXTRACT(YEAR FROM trip_date) IN (2019, 2020); |
Show the total budget for habitat preservation in 'habitat_preservation' table for the African region | CREATE TABLE habitat_preservation (id INT,region VARCHAR(50),budget DECIMAL(10,2)); | SELECT SUM(budget) FROM habitat_preservation WHERE region = 'African'; |
Update the 'battery_range' column for the 'Tesla_Model_S' row to 405 miles | CREATE TABLE vehicle_stats (vehicle_make VARCHAR(255),vehicle_model VARCHAR(255),battery_range FLOAT); | UPDATE vehicle_stats SET battery_range = 405 WHERE vehicle_make = 'Tesla' AND vehicle_model = 'Model S'; |
List all military technology in the category of 'Naval Weapons' and their corresponding weights. | CREATE TABLE MilitaryTechnology (TechID INT,Tech TEXT,Category TEXT,Weight INT); INSERT INTO MilitaryTechnology (TechID,Tech,Category,Weight) VALUES (1,'Torpedo','Naval Weapons',1500); INSERT INTO MilitaryTechnology (TechID,Tech,Category,Weight) VALUES (2,'Missile Launcher','Naval Weapons',5000); | SELECT Tech, Weight FROM MilitaryTechnology WHERE Category = 'Naval Weapons'; |
What is the total number of concert tickets sold for artists from Mexico? | CREATE TABLE Artists (ArtistID INT,ArtistName VARCHAR(100),Country VARCHAR(50)); INSERT INTO Artists (ArtistID,ArtistName,Country) VALUES (1,'Taylor Swift','USA'); INSERT INTO Artists (ArtistID,ArtistName,Country) VALUES (5,'BTS','South Korea'); INSERT INTO Artists (ArtistID,ArtistName,Country) VALUES (9,'Café Tacvba',... | SELECT SUM(TicketsSold) FROM Concerts JOIN Artists ON Concerts.ArtistID = Artists.ArtistID WHERE Artists.Country = 'Mexico'; |
How many investment rounds have startups in the health sector participated in? | CREATE TABLE investment (id INT,company_id INT,round_number INT,round_date DATE,funding_amount INT); INSERT INTO investment (id,company_id,round_number,round_date,funding_amount) VALUES (1,1,1,'2018-01-01',500000); CREATE TABLE company (id INT,name TEXT,industry TEXT); INSERT INTO company (id,name,industry) VALUES (1,'... | SELECT company_id, COUNT(DISTINCT round_number) FROM investment GROUP BY company_id HAVING industry = 'Health'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.