instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the minimum budget for accessible technology projects in Asia? | CREATE TABLE Accessible_Tech_Projects (ID INT,Project_Name VARCHAR(100),Location VARCHAR(50),Budget DECIMAL(10,2)); INSERT INTO Accessible_Tech_Projects (ID,Project_Name,Location,Budget) VALUES (1,'Tech4All','Asia',150000.00),(2,'AI4Good','Asia',200000.00),(3,'EqualWeb','Europe',120000.00); | SELECT MIN(Budget) FROM Accessible_Tech_Projects WHERE Location = 'Asia'; |
Delete all records of chemical containers that have not been inspected in the past 6 months and are not in use. | CREATE TABLE chemical_containers (container_id INT,container_name TEXT,last_inspection_date DATE,in_use BOOLEAN); INSERT INTO chemical_containers (container_id,container_name,last_inspection_date,in_use) VALUES (1,'Container A','2021-01-01',TRUE),(2,'Container B','2021-04-15',FALSE),(3,'Container C','2021-07-22',TRUE),... | DELETE FROM chemical_containers WHERE last_inspection_date IS NULL OR last_inspection_date < NOW() - INTERVAL 6 MONTH AND in_use = FALSE; |
List all cities with their respective counts of conventional vehicles | CREATE TABLE public.vehicles (id INT,type VARCHAR(20),city VARCHAR(20)); INSERT INTO public.vehicles (id,type,city) VALUES (1,'electric_car','Paris'),(2,'conventional_car','Paris'),(3,'autonomous_bus','Paris'),(4,'conventional_car','Berlin'),(5,'electric_bus','Berlin'); | SELECT city, COUNT(*) FROM public.vehicles WHERE type NOT LIKE 'electric%' AND type NOT LIKE 'autonomous%' GROUP BY city; |
What is the distribution of accessible technology costs by gender? | CREATE TABLE people (id INT,gender VARCHAR(50),technology_id INT); | SELECT gender, AVG(cost) as avg_cost FROM people p INNER JOIN technology t ON p.technology_id = t.id WHERE t.accessibility_rating > 6 GROUP BY gender; |
What was the average R&D expenditure for drugs in 2020? | CREATE TABLE rd_expenditure (drug_name TEXT,amount INTEGER,year INTEGER); | SELECT AVG(amount) FROM rd_expenditure WHERE year = 2020; |
What is the total weight of space debris in orbit around Earth? | CREATE TABLE space_debris (id INT,debris_name VARCHAR(50),orbit_type VARCHAR(50),launch_year INT,weight FLOAT); INSERT INTO space_debris (id,debris_name,orbit_type,launch_year,weight) VALUES (1,'DEBRISSAT-1','LEO',1973,800.0); INSERT INTO space_debris (id,debris_name,orbit_type,launch_year,weight) VALUES (2,'FENGYUN-1C... | SELECT SUM(weight) FROM space_debris WHERE orbit_type IN ('LEO', 'GEO'); |
What is the average age of teachers who have completed a professional development course in the past year? | CREATE TABLE teachers (id INT,name VARCHAR(50),age INT,last_pd_course DATE); | SELECT AVG(age) FROM teachers WHERE last_pd_course >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); |
Update the 'Spruce' species population in Europe to 5,200,000. | CREATE TABLE regions (id INT PRIMARY KEY,name VARCHAR(255)); INSERT INTO regions (id,name) VALUES (1,'Europe'); INSERT INTO regions (id,name) VALUES (2,'North America'); CREATE TABLE population_by_region (region_id INT,species_id INT,population INT); INSERT INTO population_by_region (region_id,species_id,population) VA... | UPDATE population_by_region SET population = 5200000 WHERE region_id = 1 AND species_id = 1; |
Update the "average_session_length" column for the "RPG Quest" game | CREATE TABLE game_stats (game_name VARCHAR(255),players_online INT,peak_players INT,average_session_length TIME); | UPDATE game_stats SET average_session_length = '02:00:00' WHERE game_name = 'RPG Quest'; |
What is the internet penetration in African countries with a total population greater than 20 million? | CREATE TABLE internet_access (id INT,country VARCHAR(50),urban_population FLOAT,rural_population FLOAT,total_population FLOAT,internet_users FLOAT); INSERT INTO internet_access (id,country,urban_population,rural_population,total_population,internet_users) VALUES (3,'Nigeria',71.4,57.1,200.96,112.03); | SELECT country, (internet_users / total_population) * 100 as internet_penetration FROM internet_access WHERE total_population > 20000000 AND country IN ('Nigeria', 'South Africa', 'Egypt', 'Ethiopia', 'Kenya') ORDER BY internet_penetration DESC; |
What is the percentage of multimodal trips in the city of Vancouver in the month of September? | CREATE TABLE Multimodal_Data (Id INT,City VARCHAR(50),Mode VARCHAR(50),Month VARCHAR(10)); INSERT INTO Multimodal_Data (Id,City,Mode,Month) VALUES (1,'Vancouver','Skytrain','September'); INSERT INTO Multimodal_Data (Id,City,Mode,Month) VALUES (2,'Vancouver','Bus','September'); | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Multimodal_Data WHERE City = 'Vancouver' AND Month = 'September')) FROM Multimodal_Data WHERE City = 'Vancouver' AND Month = 'September' AND Mode IN ('Skytrain', 'Bus'); |
Delete all records with an ESG rating above 8 for 'climate_change_mitigation' initiatives. | CREATE TABLE climate_initiatives (id INT,initiative_type VARCHAR(20),ESG_rating FLOAT); INSERT INTO climate_initiatives (id,initiative_type,ESG_rating) VALUES (1,'climate_change_mitigation',8.5),(2,'climate_change_mitigation',7.6),(3,'climate_change_mitigation',8.8); | DELETE FROM climate_initiatives WHERE initiative_type = 'climate_change_mitigation' AND ESG_rating > 8; |
What is the average life expectancy in 'Los Angeles County'? | CREATE TABLE life_expectancy_data (county VARCHAR(255),life_expectancy FLOAT); INSERT INTO life_expectancy_data (county,life_expectancy) VALUES ('Los Angeles County',81.7),('Orange County',83.2); | SELECT life_expectancy FROM life_expectancy_data WHERE county = 'Los Angeles County'; |
Add a new TV show 'The Mandalorian' with a genre 'Sci-fi' | CREATE TABLE tv_shows (id INT,title TEXT,genre TEXT); | INSERT INTO tv_shows (id, title, genre) VALUES (1, 'The Mandalorian', 'Sci-fi'); |
Find the maximum and minimum funding amounts for companies founded by individuals from the same country | CREATE TABLE company_founding(id INT PRIMARY KEY,company_name VARCHAR(100),founder_country VARCHAR(50),funding_amount INT); INSERT INTO company_founding VALUES (1,'Acme Inc','USA',1000000); INSERT INTO company_founding VALUES (2,'Beta Corp','USA',2000000); INSERT INTO company_founding VALUES (3,'Charlie LLC','Canada',5... | SELECT MAX(funding_amount), MIN(funding_amount) FROM company_founding WHERE founder_country = 'USA'; |
How many unique donors have contributed to the health program? | CREATE TABLE Donors (id INT,name VARCHAR(255),contact_info VARCHAR(255)); CREATE TABLE Donations (id INT,donor_id INT,program VARCHAR(255),amount DECIMAL(10,2)); INSERT INTO Donors (id,name,contact_info) VALUES (1,'John Doe','johndoe@example.com'),(2,'Jane Smith','janesmith@example.com'); INSERT INTO Donations (id,dono... | SELECT COUNT(DISTINCT donor_id) as num_unique_donors FROM Donations WHERE program = 'Health'; |
What is the minimum mental health score of students in 'Tribal School Y'? | CREATE TABLE TribalSchoolY (studentID INT,mentalHealthScore INT); INSERT INTO TribalSchoolY (studentID,mentalHealthScore) VALUES (1,75),(2,78),(3,81); | SELECT MIN(mentalHealthScore) FROM TribalSchoolY WHERE schoolName = 'Tribal School Y'; |
How many disasters were responded to in Haiti from 2010 to 2020? | CREATE TABLE disasters (id INT,country TEXT,year INT,num_disasters INT); INSERT INTO disasters | SELECT COUNT(*) FROM disasters WHERE country = 'Haiti' AND year BETWEEN 2010 AND 2020; |
List all volunteers who have participated in programs in the last week? | CREATE TABLE Volunteer (VolunteerID int,VolunteerName varchar(50),Country varchar(50)); CREATE TABLE VolunteerProgram (ProgramID int,VolunteerID int,ProgramDate date); | SELECT VolunteerName FROM Volunteer JOIN VolunteerProgram ON Volunteer.VolunteerID = VolunteerProgram.VolunteerID WHERE ProgramDate >= DATEADD(week, -1, GETDATE()); |
How many IoT sensors are there in the 'sensors' table for crop type 'corn'? | CREATE TABLE sensors (id INT,sensor_id INT,crop VARCHAR(10)); INSERT INTO sensors (id,sensor_id,crop) VALUES (1,101,'corn'),(2,102,'soybean'),(3,103,'corn'),(4,104,'wheat'); | SELECT COUNT(*) FROM sensors WHERE crop = 'corn'; |
List all climate communication campaigns in the Arctic and their end dates | CREATE TABLE climate_communication_campaigns (id INT,campaign VARCHAR(50),location VARCHAR(50),start_date DATE,end_date DATE); INSERT INTO climate_communication_campaigns (id,campaign,location,start_date,end_date) VALUES (1,'Permafrost Thaw Awareness','Arctic','2010-01-01','2011-01-01'),(2,'Polar Bear Conservation','Ar... | SELECT campaign, end_date FROM climate_communication_campaigns WHERE location = 'Arctic'; |
What is the maximum energy storage capacity in Texas and Ontario? | CREATE TABLE energy_storage (id INT,location VARCHAR(255),capacity INT); INSERT INTO energy_storage (id,location,capacity) VALUES (1,'Texas',500),(2,'Ontario',600),(3,'California',400); | SELECT MAX(capacity) FROM energy_storage WHERE location IN ('Texas', 'Ontario'); |
What is the minimum rating of hotels in Japan that have adopted AI-powered guest communication? | CREATE TABLE hotel_features (hotel_id INT,country TEXT,rating FLOAT,ai_guest_comm INT); INSERT INTO hotel_features (hotel_id,country,rating,ai_guest_comm) VALUES (1,'Japan',4.5,1),(2,'Japan',4.7,0),(3,'Canada',4.2,1); | SELECT MIN(rating) FROM hotel_features WHERE country = 'Japan' AND ai_guest_comm = 1; |
Delete a record from the "attendees" table where the attendee is from Japan | CREATE TABLE attendees (id INT PRIMARY KEY,name VARCHAR(100),event_date DATE,country VARCHAR(50)); | DELETE FROM attendees WHERE country = 'Japan'; |
Show the average account balance for customers in each region, and the total number of customers in each region. | CREATE TABLE customers (customer_id INT,name VARCHAR(50),region VARCHAR(20),account_balance DECIMAL(10,2)); | SELECT region, AVG(account_balance) as avg_account_balance, COUNT(*) as num_customers FROM customers GROUP BY region; |
What is the total revenue for the 'Summer Fest' and 'Rock N Roll Festival'? | CREATE TABLE festival_revenue (festival_id INT,festival_name VARCHAR(100),ticket_price DECIMAL(5,2),total_tickets_sold INT); INSERT INTO festival_revenue (festival_id,festival_name,ticket_price,total_tickets_sold) VALUES (1,'Summer Fest',100.00,50000); INSERT INTO festival_revenue (festival_id,festival_name,ticket_pric... | SELECT festival_name, ticket_price * total_tickets_sold AS total_revenue FROM festival_revenue WHERE festival_name IN ('Summer Fest', 'Rock N Roll Festival'); |
Find players who have never played a specific game | CREATE TABLE players (player_id INT,name VARCHAR(100),game VARCHAR(50)); CREATE TABLE played_games (player_id INT,game VARCHAR(50)); | SELECT p.name, p.game FROM players p LEFT JOIN played_games pg ON p.player_id = pg.player_id WHERE pg.game IS NULL AND p.game = 'GameY'; |
Who are the artists that have created art pieces in both the 'Impressionism' and 'Cubism' categories? | CREATE TABLE Art_Inventory (art_id INT,art_name VARCHAR(255),category VARCHAR(255),year INT); INSERT INTO Art_Inventory (art_id,art_name,category,year) VALUES (1,'Composition VIII','Abstract Art',1916),(2,'The Scream','Expressionism',1893),(3,'Black Square','Suprematism',1915); | SELECT artist_name FROM (SELECT artist_name, category, COUNT(DISTINCT category) OVER (PARTITION BY artist_name) AS num_categories FROM Art_Inventory) tmp WHERE num_categories = 2; |
What is the average biosensor production cost per month for the last year, per manufacturer? | CREATE TABLE biosensor_production (prod_id INT,manufacturer VARCHAR(50),production_month DATE,cost FLOAT); INSERT INTO biosensor_production (prod_id,manufacturer,production_month,cost) VALUES (1,'BioSys','2021-01-01',3500),(2,'NanoSensors','2021-02-01',4000),(3,'BioSys','2021-03-01',3700),(4,'NanoSensors','2021-04-01',... | SELECT manufacturer, AVG(cost) as avg_monthly_cost FROM biosensor_production WHERE production_month BETWEEN DATEADD(year, -1, CURRENT_DATE) AND CURRENT_DATE GROUP BY manufacturer, YEAR(production_month), MONTH(production_month); |
What is the average salary of workers in the textile industry who are part of a workforce development program, grouped by gender? | CREATE TABLE textile_workers (id INT,name VARCHAR(50),salary FLOAT,program VARCHAR(50),gender VARCHAR(50)); INSERT INTO textile_workers (id,name,salary,program,gender) VALUES (1,'John Doe',40000.0,'Workforce Development','Male'); INSERT INTO textile_workers (id,name,salary,program,gender) VALUES (2,'Jane Smith',45000.0... | SELECT AVG(salary), gender FROM textile_workers WHERE program IN ('Workforce Development', 'Apprenticeship') GROUP BY gender; |
What is the minimum recycling rate in the 'Government' sector? | CREATE TABLE GovernmentRecycling (id INT,sector VARCHAR(20),recycling_rate FLOAT); INSERT INTO GovernmentRecycling (id,sector,recycling_rate) VALUES (1,'Government',0.6),(2,'Government',0.4); | SELECT MIN(recycling_rate) FROM GovernmentRecycling WHERE sector = 'Government'; |
How many sustainable projects were completed in Texas in 2021? | CREATE TABLE Projects (Id INT,Name VARCHAR(50),City VARCHAR(50),StartDate DATE,EndDate DATE,Sustainable BOOLEAN); | SELECT COUNT(p.Id) FROM Projects p WHERE p.City = 'Texas' AND p.EndDate <= '2021-12-31' AND p.Sustainable = TRUE; |
Show the total number of fans for each sport | CREATE TABLE fans (fan_id INT,gender VARCHAR(10),sport_preference VARCHAR(20)); INSERT INTO fans (fan_id,gender,sport_preference) VALUES (1,'Male','Basketball'),(2,'Female','Football'),(3,'Male','Soccer'),(4,'Female','Basketball'),(5,'Male','Football'),(6,'Female','Soccer'); | SELECT sport_preference, COUNT(*) as num_fans FROM fans GROUP BY sport_preference; |
How many times did each vessel visit ports in the Caribbean region in the last year? | CREATE TABLE vessel_port_visits (id INT,vessel_id INT,port_id INT,visit_date DATE); INSERT INTO vessel_port_visits (id,vessel_id,port_id,visit_date) VALUES (1,12,20,'2021-02-03'); INSERT INTO vessel_port_visits (id,vessel_id,port_id,visit_date) VALUES (2,13,21,'2021-01-15'); | SELECT vessel_id, COUNT(DISTINCT visit_date) as visits_to_caribbean_ports FROM vessel_port_visits WHERE port_id BETWEEN 1 AND 50 GROUP BY vessel_id; |
Delete all records from the Garments table where the size is 'XL' | CREATE TABLE Garments (id INT,name VARCHAR(255),category VARCHAR(255),color VARCHAR(255),size VARCHAR(10)); | DELETE FROM Garments WHERE size = 'XL'; |
What is the total number of electric vehicle charging stations by country and state? | CREATE TABLE ElectricVehicleChargingStationsByRegion(Country VARCHAR(50),State VARCHAR(50),Stations INT); | SELECT Country, State, SUM(Stations) FROM ElectricVehicleChargingStationsByRegion GROUP BY Country, State; |
What are the top 3 regions with the most climate communication campaigns in 2019? | CREATE TABLE climate_communication_campaigns (year INT,region VARCHAR(255),campaign VARCHAR(255)); INSERT INTO climate_communication_campaigns (year,region,campaign) VALUES (2019,'North America','Climate Action Day A'),(2019,'Europe','Green Living B'),(2019,'South America','Climate Change Education C'),(2019,'Asia','Re... | SELECT region, COUNT(*) as campaign_count FROM climate_communication_campaigns WHERE year = 2019 GROUP BY region ORDER BY campaign_count DESC LIMIT 3; |
Find the average production rate (bpd) of wells in Brazil. | CREATE TABLE well_production (id INT,country VARCHAR(50),rate FLOAT); | SELECT AVG(rate) FROM well_production WHERE country = 'Brazil'; |
What is the percentage of fair trade certified garments, by type, in the Australian ethical fashion market? | CREATE TABLE australian_garments (id INT PRIMARY KEY,garment VARCHAR(50),type VARCHAR(50),fair_trade_certified BOOLEAN); INSERT INTO australian_garments (id,garment,type,fair_trade_certified) VALUES (1,'T-Shirt','Cotton',true),(2,'Sweater','Wool',false),(3,'Pants','Hemp',true),(4,'Jacket','Polyester',true),(5,'Skirt','... | SELECT type, 100.0 * SUM(fair_trade_certified) / COUNT(*) as percentage FROM australian_garments GROUP BY type; |
What is the average response time for emergency calls in the city of Oakland? | CREATE TABLE emergency_calls (id INT,city VARCHAR(20),response_time INT); | SELECT AVG(response_time) FROM emergency_calls WHERE city = 'Oakland'; |
How many deep-sea species have been found in areas with low ocean acidification? | CREATE TABLE deep_sea_species (name VARCHAR(255),habitat VARCHAR(255)); CREATE TABLE ocean_acidification (location VARCHAR(255),level FLOAT); | SELECT COUNT(*) FROM deep_sea_species dss INNER JOIN ocean_acidification oa ON dss.habitat = oa.location WHERE oa.level < 7.5; |
Insert new records for a dispensary license in Oakland, CA. | CREATE TABLE DispensaryLicense (LicenseID INT PRIMARY KEY,BusinessName VARCHAR(255),Location VARCHAR(255),LicenseType VARCHAR(255),IssueDate DATE); | INSERT INTO DispensaryLicense (LicenseID, BusinessName, Location, LicenseType, IssueDate) VALUES (123, 'Emerald City', 'Oakland, CA', 'Medical', '2022-05-01'); |
What is the total installed capacity (in kW) of renewable energy projects for each country, sorted by the highest capacity? | CREATE TABLE renewable_projects (project_id INT,project_name VARCHAR(255),country VARCHAR(255),capacity DECIMAL(10,2)); INSERT INTO renewable_projects (project_id,project_name,country,capacity) VALUES (1,'Solar Farm 1','USA',1000.00),(2,'Wind Farm 1','Canada',1500.00),(3,'Hydro Plant 1','Brazil',2000.00); | SELECT country, SUM(capacity) as total_capacity FROM renewable_projects GROUP BY country ORDER BY total_capacity DESC; |
What is the total number of solar and geothermal power projects, and their average duration? | CREATE TABLE projects (id INT,name VARCHAR(255),type VARCHAR(255),start_date DATE,end_date DATE); INSERT INTO projects (id,name,type,start_date,end_date) VALUES (1,'Solar Farm','Renewable Energy','2018-01-01','2019-12-31'),(2,'Geothermal Plant','Renewable Energy','2019-01-01','2020-12-31'); | SELECT type, COUNT(*) as total, AVG(DATEDIFF(end_date, start_date)) as avg_duration FROM projects WHERE type IN ('Solar Farm', 'Geothermal Plant') GROUP BY type; |
List the top 2 subscribers with the highest data usage in 'Africa'. | CREATE TABLE subscribers (subscriber_id INT,data_usage FLOAT,region VARCHAR(20)); INSERT INTO subscribers (subscriber_id,data_usage,region) VALUES (1,15.5,'Rural'),(2,200.0,'Africa'),(3,30.0,'Metro'),(4,10.0,'Rural'),(5,250.0,'Africa'); | SELECT subscriber_id, data_usage FROM subscribers WHERE region = 'Africa' ORDER BY data_usage DESC LIMIT 2; |
Which department in the Russian government had the least number of public meetings in 2020? | CREATE TABLE RussianMeetings (Department VARCHAR(50),MeetingDate DATE); INSERT INTO RussianMeetings (Department,MeetingDate) VALUES ('Defense','2020-01-01'),('Defense','2020-02-03'),('Interior','2020-01-15'); | SELECT Department, MIN(COUNT(*)) OVER (PARTITION BY Department) FROM RussianMeetings WHERE MeetingDate >= '2020-01-01' AND MeetingDate < '2021-01-01' GROUP BY Department; |
What is the minimum response time for medical emergencies in 'Hillside'? | CREATE TABLE emergencies (id INT,emergency_type VARCHAR(20),neighborhood VARCHAR(20),response_time FLOAT); INSERT INTO emergencies (id,emergency_type,neighborhood,response_time) VALUES (1,'medical','Northside',12.5),(2,'fire','Hillside',6.3),(3,'fire','Downtown',8.1),(4,'medical','Hillside',6.8),(5,'medical','Northside... | SELECT MIN(response_time) FROM emergencies WHERE emergency_type = 'medical' AND neighborhood = 'Hillside'; |
Show the number of unique tree species in the tree_inventory table that have a diameter at breast height less than 30 inches | CREATE TABLE tree_inventory (id INT,species VARCHAR(50),diameter FLOAT); INSERT INTO tree_inventory (id,species,diameter) VALUES (1,'Oak',35.2),(2,'Cedar',28.9),(3,'Oak',22.1),(4,'Pine',31.6),(5,'Maple',29.4); | SELECT COUNT(DISTINCT species) FROM tree_inventory WHERE diameter < 30; |
Insert data into 'agricultural_projects' table | CREATE TABLE agricultural_projects (id INT PRIMARY KEY,name VARCHAR(100),location VARCHAR(50),funding_source VARCHAR(50),start_date DATE,end_date DATE); | INSERT INTO agricultural_projects (id, name, location, funding_source, start_date, end_date) VALUES (1, 'Solar Powered Irrigation', 'Rural Kenya', 'World Bank', '2022-01-01', '2023-12-31'); |
What is the average age of offenders who participated in restorative justice programs in California? | CREATE TABLE offenders (offender_id INT,age INT,state VARCHAR(20)); INSERT INTO offenders (offender_id,age,state) VALUES (1,34,'California'),(2,28,'California'); CREATE TABLE restorative_justice (offender_id INT,program_id INT); INSERT INTO restorative_justice (offender_id,program_id) VALUES (1,101),(2,101); | SELECT AVG(offenders.age) FROM offenders INNER JOIN restorative_justice ON offenders.offender_id = restorative_justice.offender_id WHERE offenders.state = 'California'; |
How many disaster response volunteers were there in total as of January 1, 2020? | CREATE TABLE volunteers (id INT,region VARCHAR(50),volunteer_type VARCHAR(50),registration_date DATE); INSERT INTO volunteers (id,region,volunteer_type,registration_date) VALUES (1,'North','Disaster Response','2019-12-20'),(2,'South','Disaster Response','2019-11-15'),(3,'East','Disaster Response','2020-01-03'),(4,'West... | SELECT COUNT(*) as total_volunteers FROM volunteers WHERE volunteer_type = 'Disaster Response' AND registration_date <= '2020-01-01'; |
What is the average mental health score of students who participated in lifelong learning workshops, by school district? | CREATE TABLE districts (district_id INT,district_name VARCHAR(255)); CREATE TABLE student_mental_health (student_id INT,district_id INT,mental_health_score INT); CREATE TABLE workshops (workshop_id INT,district_id INT,workshop_topic VARCHAR(255),participant_id INT); INSERT INTO districts (district_id,district_name) VAL... | SELECT sd.district_name, AVG(smh.mental_health_score) as avg_score FROM districts sd JOIN student_mental_health smh ON sd.district_id = smh.district_id JOIN workshops w ON smh.student_id = w.participant_id WHERE w.workshop_topic = 'Lifelong Learning' GROUP BY sd.district_name; |
Determine the difference in maintenance costs between consecutive years for each bridge, and return the bridge with the largest difference. | CREATE TABLE BridgeYears (BridgeID INT,Year INT,MaintenanceCost DECIMAL(10,2)); | SELECT BridgeID, MAX(Diff) as LargestDifference FROM ( SELECT BridgeID, Year, MaintenanceCost, MaintenanceCost - LAG(MaintenanceCost) OVER (PARTITION BY BridgeID ORDER BY Year) as Diff FROM BridgeYears) sub WHERE Diff IS NOT NULL GROUP BY BridgeID; |
What is the average carbon offset of buildings in a given neighborhood? | CREATE TABLE Neighborhood (neighborhood_id INT,neighborhood_name VARCHAR(50)); CREATE TABLE Building (building_id INT,building_name VARCHAR(50),building_type VARCHAR(50),carbon_offset INT,neighborhood_id INT); | SELECT Neighborhood.neighborhood_name, AVG(Building.carbon_offset) as avg_carbon_offset FROM Neighborhood JOIN Building ON Neighborhood.neighborhood_id = Building.neighborhood_id GROUP BY Neighborhood.neighborhood_name; |
Which departments have more than 5 veteran employees? | CREATE TABLE employees (id INT,veteran BOOLEAN,department VARCHAR(255)); INSERT INTO employees (id,veteran,department) VALUES (1,true,'Engineering'),(2,false,'Marketing'),(3,true,'Human Resources'),(4,false,'Finance'),(5,true,'Engineering'),(6,true,'Engineering'),(7,false,'Marketing'),(8,true,'Human Resources'),(9,fals... | SELECT department, COUNT(*) as veteran_count FROM employees WHERE veteran = true GROUP BY department HAVING veteran_count > 5; |
What is the average depth of all marine protected areas in the Pacific Ocean?" | CREATE TABLE marine_protected_areas (id INT,name TEXT,area_size FLOAT,avg_depth FLOAT,ocean TEXT); INSERT INTO marine_protected_areas (id,name,area_size,avg_depth,ocean) VALUES (1,'Galapagos Marine Reserve',133000,200,'Pacific'); | SELECT AVG(avg_depth) FROM marine_protected_areas WHERE ocean = 'Pacific'; |
Insert a new record into the vessel_emissions table with the following details: vessel_id = V008, emission_type = 'CO2', emission_amount = 100 | vessel_emissions(emission_id,vessel_id,emission_type,emission_amount) | INSERT INTO vessel_emissions (emission_id, vessel_id, emission_type, emission_amount) VALUES (1008, 'V008', 'CO2', 100); |
Which donors did not donate to the 'Health' program? | CREATE TABLE Donors (DonorID INT,DonorName VARCHAR(50)); INSERT INTO Donors (DonorID,DonorName) VALUES (1,'John Smith'),(2,'Jane Doe'),(3,'Bob Johnson'),(4,'Alice Williams'),(5,'Charlie Brown'); CREATE TABLE Donations (DonationID INT,DonorID INT,ProgramID INT); INSERT INTO Donations (DonationID,DonorID,ProgramID) VALUE... | SELECT D.DonorID, D.DonorName FROM Donors D LEFT JOIN Donations DON ON D.DonorID = DON.DonorID WHERE DON.ProgramID IS NULL AND D.DonorID NOT IN (SELECT DON2.DonorID FROM Donations DON2 JOIN Programs P ON DON2.ProgramID = P.ProgramID WHERE P.ProgramName = 'Health'); |
List the top 5 most common sizes for customers in the 'US' region. | CREATE TABLE Customers (id INT,name VARCHAR(255),size VARCHAR(10),region VARCHAR(50)); INSERT INTO Customers (id,name,size,region) VALUES (1,'Alice','S','US'),(2,'Bob','M','US'),(3,'Charlie','L','CA'),(4,'David','M','US'),(5,'Eve','S','US'); | SELECT size, COUNT(*) FROM Customers WHERE region = 'US' GROUP BY size ORDER BY COUNT(*) DESC LIMIT 5; |
What is the average sustainability rating of properties in the city of Austin? | CREATE TABLE properties (id INT,city VARCHAR(255),sustainability_rating INT); INSERT INTO properties (id,city,sustainability_rating) VALUES (1,'Austin',3),(2,'Austin',4),(3,'Austin',5),(4,'Houston',2); | SELECT AVG(sustainability_rating) FROM properties WHERE city = 'Austin'; |
What is the total revenue generated by each game genre in the US? | CREATE TABLE revenue (id INT,game VARCHAR(30),genre VARCHAR(20),revenue INT,country VARCHAR(20)); INSERT INTO revenue (id,game,genre,revenue,country) VALUES (1,'Skyrim','RPG',1000000,'US'),(2,'CS:GO','FPS',500000,'US'),(3,'Half-Life: Alyx','VR',2000000,'US'); | SELECT genre, SUM(revenue) AS total_revenue FROM revenue WHERE country = 'US' GROUP BY genre; |
What's the average number of artworks viewed per visitor in the 'Europe' region? | CREATE TABLE Artworks (ArtworkID INT,ExhibitionID INT,VisitorID INT); | SELECT AVG(a.ArtworksViewed) FROM (SELECT v.VisitorID, COUNT(a.ArtworkID) ArtworksViewed FROM Artworks a JOIN Exhibitions e ON a.ExhibitionID = e.ExhibitionID JOIN Visitors v ON a.VisitorID = v.VisitorID JOIN Regions r ON v.Country = r.CountryName WHERE r.Region = 'Europe' GROUP BY v.VisitorID) a; |
What is the number of streams by hour for a specific artist in Germany? | CREATE TABLE artist_streams (stream_id int,user_id int,track_id int,timestamp datetime,artist_id int); INSERT INTO artist_streams (stream_id,user_id,track_id,timestamp,artist_id) VALUES (1,123,345,'2022-01-01 10:00:00',678); | SELECT DATE_FORMAT(timestamp, '%H') as hour, COUNT(*) as stream_count FROM artist_streams WHERE artist_id = 678 AND timestamp BETWEEN '2022-01-01' AND '2022-12-31' AND DATE_FORMAT(timestamp, '%Y-%m') = '2022-01' AND country = 'Germany' GROUP BY hour; |
Report the total number of marine species that are endangered | CREATE TABLE species_status (id INT,name VARCHAR(255),status VARCHAR(255)); INSERT INTO species_status (id,name,status) VALUES (1,'Dolphin','Endangered'); INSERT INTO species_status (id,name,status) VALUES (2,'Shark','Vulnerable'); INSERT INTO species_status (id,name,status) VALUES (3,'Tuna','Endangered'); | SELECT COUNT(*) FROM species_status WHERE status = 'Endangered'; |
What is the difference between the average donation amount for male and female donors in 2021? | CREATE TABLE Donors (DonorID INT,DonorName TEXT,DonorGender TEXT,TotalDonation FLOAT); | SELECT AVG(CASE WHEN DonorGender = 'Male' THEN TotalDonation ELSE 0 END) as 'Average Donation Amount for Males', AVG(CASE WHEN DonorGender = 'Female' THEN TotalDonation ELSE 0 END) as 'Average Donation Amount for Females', AVG(CASE WHEN DonorGender IN ('Male', 'Female') THEN TotalDonation ELSE 0 END) as 'Average Donati... |
What are the names of the farmers who have cultivated more than one type of crop? | CREATE TABLE farmers (id INT,name VARCHAR(50)); CREATE TABLE crops_farmers (farmer_id INT,crop_id INT); CREATE TABLE crops (id INT,name VARCHAR(50)); INSERT INTO farmers (id,name) VALUES (1,'John'),(2,'Jane'),(3,'Mary'); INSERT INTO crops (id,name) VALUES (1,'Corn'),(2,'Soybean'),(3,'Wheat'); INSERT INTO crops_farmers ... | SELECT f.name FROM farmers f JOIN crops_farmers cf ON f.id = cf.farmer_id JOIN crops c ON cf.crop_id = c.id GROUP BY f.name HAVING COUNT(DISTINCT c.name) > 1; |
What are the names and locations of indigenous communities in Greenland with a population over 10,000 that speak Greenlandic? | CREATE TABLE Indigenous_Communities (id INT,name VARCHAR(100),population INT,location VARCHAR(100),language VARCHAR(100)); INSERT INTO Indigenous_Communities (id,name,population,location,language) VALUES (1,'Inuit',15000,'Greenland','Greenlandic'); INSERT INTO Indigenous_Communities (id,name,population,location,languag... | SELECT name, location FROM Indigenous_Communities WHERE population > 10000 AND language = 'Greenlandic' |
How many artworks were created by each artist in the 20th century? | CREATE TABLE Artists (ArtistID int,ArtistName varchar(50),BirthYear int); CREATE TABLE Artworks (ArtworkID int,ArtistID int,ArtworkYear int,ArtworkTitle varchar(50)); | SELECT Artists.ArtistName, COUNT(Artworks.ArtworkID) as TotalArtworks FROM Artists INNER JOIN Artworks ON Artists.ArtistID = Artworks.ArtistID WHERE Artworks.ArtworkYear BETWEEN 1900 AND 2000 GROUP BY Artists.ArtistName; |
Find the total number of games played by each player | game_stats(player_id,game_id,score,date_played) | SELECT player_id, COUNT(DISTINCT game_id) as total_games_played FROM game_stats GROUP BY player_id; |
Which threat actors have been involved in the most security incidents in the last month? | CREATE TABLE security_incidents (id INT,threat_actor VARCHAR(255),timestamp DATETIME); | SELECT threat_actor, COUNT(*) as total_incidents FROM security_incidents WHERE timestamp >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY threat_actor ORDER BY total_incidents DESC; |
What is the most common type of crime committed in the South district? | CREATE TABLE crimes (id INT,district VARCHAR(20),type VARCHAR(20),date DATE); INSERT INTO crimes (id,district,type,date) VALUES (1,'Downtown','Theft','2022-01-02'); INSERT INTO crimes (id,district,type,date) VALUES (2,'Uptown','Vandalism','2022-01-03'); INSERT INTO crimes (id,district,type,date) VALUES (3,'Westside','A... | SELECT type, COUNT(*) AS count FROM crimes WHERE district = 'South' GROUP BY type ORDER BY count DESC LIMIT 1; |
What is the average age of athletes in the basketball_teams table? | CREATE TABLE basketball_teams (team_name TEXT,athlete_name TEXT,athlete_age INTEGER); | SELECT AVG(athlete_age) FROM basketball_teams; |
What is the minimum price of cerium produced in China in 2017? | CREATE TABLE china_cerium (id INT,year INT,price DECIMAL); INSERT INTO china_cerium (id,year,price) VALUES (1,2015,150),(2,2016,160),(3,2017,170); | SELECT MIN(price) FROM china_cerium WHERE year = 2017; |
How many medical supplies were delivered to "Africa" in Q4 2020? | CREATE TABLE medical_supplies (id INT,delivery_id INT,destination_country VARCHAR(255),delivery_quantity INT,delivery_date DATE); INSERT INTO medical_supplies (id,delivery_id,destination_country,delivery_quantity,delivery_date) VALUES (1,2001,'Nigeria',500,'2020-10-01'); INSERT INTO medical_supplies (id,delivery_id,des... | SELECT SUM(delivery_quantity) FROM medical_supplies WHERE destination_country = 'Africa' AND QUARTER(delivery_date) = 4 AND YEAR(delivery_date) = 2020; |
How many regulatory compliance incidents were reported for 'Container Ship' vessels in Q2 2022? | CREATE TABLE vessel (vessel_id INT,vessel_name VARCHAR(20),vessel_type VARCHAR(10)); INSERT INTO vessel VALUES (1,'V1','Bulk Carrier'),(2,'V2','Container Ship'); CREATE TABLE incident (incident_id INT,vessel_id INT,incident_date DATE,incident_type VARCHAR(20)); INSERT INTO incident VALUES (1,1,'2022-04-15','Safety'),(2... | SELECT COUNT(*) FROM incident INNER JOIN vessel ON incident.vessel_id = vessel.vessel_id WHERE vessel.vessel_type = 'Container Ship' AND incident_date BETWEEN '2022-04-01' AND '2022-06-30' AND incident_type = 'Regulatory Compliance'; |
What is the total loan amount for socially responsible lending in the Caribbean? | CREATE TABLE socially_responsible_lending (id INT,country VARCHAR(50),loan_amount DECIMAL(10,2)); | SELECT SUM(loan_amount) FROM socially_responsible_lending WHERE country LIKE 'Caribbean%'; |
How many shared bikes were available in Berlin during each day in January 2022? | CREATE TABLE shared_bikes (bike_id INT,availability_date DATE,availability_time TIME,availability_count INT); INSERT INTO shared_bikes (bike_id,availability_date,availability_time,availability_count) VALUES (1,'2022-01-01','06:00:00',100),(2,'2022-01-01','12:00:00',120),(3,'2022-01-01','18:00:00',90); | SELECT availability_date, COUNT(DISTINCT bike_id) AS bikes_available FROM shared_bikes WHERE availability_time BETWEEN '06:00:00' AND '23:59:59' GROUP BY availability_date |
What is the total population of the state of Florida, and what is the percentage of the population that lives in rural areas? | CREATE TABLE StatePopulation (State VARCHAR(100),Population INT,RuralPopulation INT); INSERT INTO StatePopulation (State,Population,RuralPopulation) VALUES ('Florida',21674000,2584000); | SELECT (RuralPopulation / Population) * 100.0 AS RuralPercentage, Population FROM StatePopulation WHERE State = 'Florida'; |
What are the vessel names and their corresponding total cargo quantities for the Americas region? | CREATE TABLE vessels_region (vessel_id INT,vessel_name TEXT,region TEXT); INSERT INTO vessels_region VALUES (1,'Vessel A','Americas'),(2,'Vessel B','Asia Pacific'),(3,'Vessel C','Americas'); CREATE TABLE cargo_region (vessel_id INT,cargo_quantity INT); INSERT INTO cargo_region VALUES (1,1200),(2,900),(3,1500); | SELECT vessels_region.vessel_name, SUM(cargo_region.cargo_quantity) FROM vessels_region INNER JOIN cargo_region ON vessels_region.vessel_id = cargo_region.vessel_id WHERE vessels_region.region = 'Americas' GROUP BY vessels_region.vessel_name; |
List all companies that have had an acquisition as an exit strategy and their corresponding exit date. | CREATE TABLE company (id INT,name TEXT); CREATE TABLE exit_strategy (id INT,company_id INT,exit_date DATE,exit_type TEXT); | SELECT company.name, exit_strategy.exit_date FROM company JOIN exit_strategy ON company.id = exit_strategy.company_id WHERE exit_strategy.exit_type = 'Acquisition'; |
What is the average age of all cheetahs in the 'animal_population' table? | CREATE TABLE animal_population (animal_id INT,animal_type VARCHAR(10),age INT); INSERT INTO animal_population (animal_id,animal_type,age) VALUES (1,'cheetah',8); INSERT INTO animal_population (animal_id,animal_type,age) VALUES (2,'cheetah',6); | SELECT AVG(age) FROM animal_population WHERE animal_type = 'cheetah'; |
What is the minimum number of military personnel in the Asian region, excluding personnel from countries with more than 10000 personnel? | CREATE TABLE MilitaryPersonnel (region VARCHAR(255),country VARCHAR(255),personnel INT); INSERT INTO MilitaryPersonnel (region,country,personnel) VALUES ('Africa','CountryA',4000),('Africa','CountryB',6000),('Africa','CountryC',5000),('Asia','CountryD',3000),('Asia','CountryE',2000); | SELECT MIN(personnel) FROM MilitaryPersonnel WHERE region = 'Asia' HAVING SUM(personnel) < 10000; |
What are the names and launch dates of telescopes launched by Japan or India? | CREATE TABLE telescopes (id INT,name VARCHAR(255),country VARCHAR(255),type VARCHAR(255),launch_date DATE); INSERT INTO telescopes (id,name,country,type,launch_date) VALUES (1,'Hubble Space Telescope','USA','Optical','1990-04-24'); INSERT INTO telescopes (id,name,country,type,launch_date) VALUES (2,'Spitzer Space Teles... | SELECT name, launch_date FROM telescopes WHERE country = 'Japan' OR country = 'India'; |
What is the total number of healthcare providers in urban and rural areas? | CREATE TABLE healthcare_providers (id INT,name VARCHAR(50),area_type VARCHAR(20)); | SELECT COUNT(*) FROM healthcare_providers WHERE area_type IN ('urban', 'rural'); |
What was the highest scoring game for Team H in the 2017 season? | CREATE TABLE games (id INT,team_a TEXT,team_b TEXT,location TEXT,score_team_a INT,score_team_b INT); INSERT INTO games (id,team_a,team_b,location,score_team_a,score_team_b) VALUES (1,'Team A','Team H','Home',120,130),(2,'Team H','Team B','Away',150,120); | SELECT MAX(GREATEST(score_team_a, score_team_b)) FROM games WHERE team_a = 'Team H' OR team_b = 'Team H' AND year = 2017; |
What is the total recycling rate for South America in the year 2019? | CREATE TABLE recycling_rates (region VARCHAR(50),year INT,recycling_rate FLOAT); INSERT INTO recycling_rates (region,year,recycling_rate) VALUES ('South America',2019,0.45); | SELECT SUM(recycling_rate) FROM recycling_rates WHERE region = 'South America' AND year = 2019; |
What is the maximum number of volunteer hours for a single volunteer in each program? | CREATE TABLE volunteers (volunteer_id INT,program_id VARCHAR(20),hours INT); INSERT INTO volunteers (volunteer_id,program_id,hours) VALUES (1,'Education',50),(2,'Health',75),(3,'Education',100); | SELECT program_id, MAX(hours) AS max_hours FROM volunteers GROUP BY program_id; |
What is the difference in age between the oldest and youngest visitor, partitioned by exhibition? | CREATE TABLE Exhibitions (ExhibitionID INT,Exhibition VARCHAR(50)); INSERT INTO Exhibitions (ExhibitionID,Exhibition) VALUES (1,'Photography'),(2,'Sculpture'); CREATE TABLE Visitors (VisitorID INT,Age INT,ExhibitionID INT); INSERT INTO Visitors (VisitorID,Age,ExhibitionID) VALUES (1,30,1),(2,45,1),(3,25,2),(4,50,2); | SELECT Exhibition, MAX(Age) - MIN(Age) AS AgeDifference FROM Visitors V JOIN Exhibitions E ON V.ExhibitionID = E.ExhibitionID GROUP BY Exhibition; |
List all biosensor technology patents filed in Germany. | CREATE TABLE patents (id INT,title VARCHAR(50),technology VARCHAR(50),location VARCHAR(50)); INSERT INTO patents (id,title,technology,location) VALUES (1,'BioSensor 1000','Biosensor','Germany'); | SELECT title FROM patents WHERE technology = 'Biosensor' AND location = 'Germany'; |
How many cases were opened in each state in 2021? | CREATE TABLE Cases (CaseID int,ClientID int,OpenDate date); INSERT INTO Cases (CaseID,ClientID,OpenDate) VALUES (1,1,'2021-01-01'); CREATE TABLE Clients (ClientID int,State text); INSERT INTO Clients (ClientID,State) VALUES (1,'California'); | SELECT Clients.State, COUNT(*) as NumCases FROM Cases INNER JOIN Clients ON Cases.ClientID = Clients.ClientID WHERE Cases.OpenDate BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY Clients.State; |
What is the minimum age of community health workers in each state? | CREATE TABLE community_health_workers (id INT,name VARCHAR(50),age INT,state VARCHAR(2)); INSERT INTO community_health_workers (id,name,age,state) VALUES (1,'John Doe',45,'Texas'),(2,'Jane Smith',35,'California'),(3,'Alice Johnson',20,'California'),(4,'Bob Brown',50,'New York'); | SELECT state, MIN(age) FROM community_health_workers GROUP BY state; |
Determine the average funding amount for companies founded by a team that is at least 50% women in the e-commerce industry. | CREATE TABLE companies (id INT,name TEXT,industry TEXT,founding_date DATE,founder_gender TEXT,founder_count INT);CREATE TABLE funds (id INT,company_id INT,amount INT,funding_round TEXT);CREATE TABLE company_funds (company_id INT,fund_id INT); | SELECT AVG(funds.amount) FROM funds INNER JOIN company_funds ON funds.id = company_funds.fund_id INNER JOIN companies ON company_funds.company_id = companies.id WHERE companies.industry = 'e-commerce' GROUP BY companies.id HAVING SUM(CASE WHEN companies.founder_gender = 'woman' THEN companies.founder_count ELSE 0 END) ... |
Calculate the percentage of employees who are people of color, by department | CREATE TABLE employee_demographics(emp_id INT,dept_id INT,race VARCHAR(50)); INSERT INTO employee_demographics VALUES (1,1,'White'),(2,1,'Black'),(3,2,'Asian'),(4,2,'White'),(5,3,'Hispanic'); | SELECT d.dept_name, (COUNT(CASE WHEN e.race IN ('Black', 'Asian', 'Hispanic') THEN 1 END) / COUNT(e.emp_id)) * 100 as pct_employees_of_color FROM departments d JOIN employee_demographics e ON d.dept_id = e.dept_id GROUP BY d.dept_name; |
What is the average bioprocess engineering patent filing date, per country, in the past 5 years? | CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.patents (id INT,name VARCHAR(50),location VARCHAR(50),filed_date DATE,industry VARCHAR(50)); INSERT INTO biotech.patents (id,name,location,filed_date,industry) VALUES (1,'PatentA','India','2021-05-15','Bioprocess Engineering'),(2,'PatentB','Brazil'... | SELECT location, AVG(filed_date) as avg_filing_date FROM biotech.patents WHERE industry = 'Bioprocess Engineering' AND filed_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) GROUP BY location; |
What is the average temperature in field A during March? | CREATE TABLE Weather (field VARCHAR(50),date DATE,temperature FLOAT); INSERT INTO Weather (field,date,temperature) VALUES ('Field A','2021-03-01',15.2),('Field A','2021-03-02',16.7),('Field A','2021-03-03',14.5); | SELECT AVG(temperature) FROM Weather WHERE field = 'Field A' AND date BETWEEN '2021-03-01' AND '2021-03-31'; |
What is the percentage of community health workers in California who have received anti-discrimination training? | CREATE TABLE anti_discrimination_training (id INT,worker_id INT,training_date DATE); INSERT INTO anti_discrimination_training (id,worker_id,training_date) VALUES (1,789,'2021-04-01'),(2,789,'2021-06-15'); CREATE TABLE community_health_workers (id INT,name VARCHAR(50),region VARCHAR(50)); INSERT INTO community_health_wo... | SELECT 100.0 * COUNT(DISTINCT anti_discrimination_training.worker_id) / COUNT(DISTINCT community_health_workers.id) FROM anti_discrimination_training RIGHT JOIN community_health_workers ON anti_discrimination_training.worker_id = community_health_workers.id WHERE community_health_workers.region = 'California'; |
Show programs with donation amounts over $10,000, ordered by total donation | CREATE TABLE programs (id INT,name VARCHAR); CREATE TABLE financial_donations (id INT,program_id INT,amount INT) | SELECT p.name, SUM(fd.amount) AS total_donation FROM programs p JOIN financial_donations fd ON p.id = fd.program_id GROUP BY p.id, p.name HAVING total_donation > 10000 ORDER BY total_donation DESC; |
Create a table named 'diversity_quota' to store diversity metrics | CREATE TABLE diversity_quota (id INT PRIMARY KEY,region VARCHAR(255),gender VARCHAR(255),ethnicity VARCHAR(255),total_employees INT); | CREATE TABLE diversity_quota (id INT PRIMARY KEY, region VARCHAR(255), gender VARCHAR(255), ethnicity VARCHAR(255), total_employees INT); |
What is the total number of artworks created by female artists? | CREATE TABLE Artists (ArtistID INT PRIMARY KEY,ArtistName VARCHAR(100),Gender VARCHAR(50)); INSERT INTO Artists (ArtistID,ArtistName,Gender) VALUES (1,'Alice Neel','Female'),(2,'Francisco Goya','Male'),(3,'Yayoi Kusama','Female'); CREATE TABLE Artworks (ArtworkID INT PRIMARY KEY,ArtworkName VARCHAR(100),YearCreated INT... | SELECT COUNT(*) FROM Artworks INNER JOIN Artists ON Artworks.ArtistID = Artists.ArtistID WHERE Artists.Gender = 'Female'; |
What is the earliest launch date for a mission to Mars? | CREATE TABLE SpaceMissions (id INT,name VARCHAR(255),launch_date DATE); INSERT INTO SpaceMissions (id,name,launch_date) VALUES (1,'Mars Rover','2020-07-30'),(2,'Mars Habitat','2022-03-01'); | SELECT MIN(launch_date) FROM SpaceMissions WHERE name LIKE '%Mars%'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.