instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Delete all safety inspections prior to 2022-01-01 for the 'Ocean Titan' vessel. | CREATE TABLE vessels (id INT,name VARCHAR(255),type VARCHAR(255)); CREATE TABLE safety_inspections (id INT,vessel_id INT,inspection_date DATE,result VARCHAR(255)); | DELETE FROM safety_inspections WHERE vessel_id IN (SELECT id FROM vessels WHERE name = 'Ocean Titan') AND inspection_date < '2022-01-01'; |
Delete the artist 'Taylor Swift' from the artists table. | CREATE TABLE artists (id INT,name VARCHAR(100)); INSERT INTO artists (id,name) VALUES (1,'Taylor Swift'); | DELETE FROM artists WHERE name = 'Taylor Swift'; |
What is the count of policies by policyholder gender? | CREATE TABLE policyholder_gender (policyholder_id INT,policyholder_gender VARCHAR(10)); CREATE TABLE policies (policy_id INT,policyholder_id INT); INSERT INTO policyholder_gender VALUES (1,'Female'); INSERT INTO policies VALUES (1,1); | SELECT policyholder_gender, COUNT(*) as policy_count FROM policies JOIN policyholder_gender ON policies.policyholder_id = policyholder_gender.policyholder_id GROUP BY policyholder_gender; |
Identify the number of threat intelligence reports issued by each agency in the first quarter of 2022 | CREATE TABLE threat_intelligence (report_id INT,report_date DATE,agency VARCHAR(100),report_text TEXT); | SELECT agency, COUNT(*) FROM threat_intelligence WHERE report_date BETWEEN '2022-01-01' AND '2022-03-31' GROUP BY agency; |
List the top 3 states in the US with the highest obesity rate? | CREATE TABLE States (State VARCHAR(50),Population INT,ObesityRate FLOAT); INSERT INTO States (State,Population,ObesityRate) VALUES ('California',39512223,25.1),('Texas',29528404,32.4),('Florida',21647997,27.8),('New York',19453561,26.0),('Pennsylvania',12807060,31.5),('Illinois',12671821,30.3),('Ohio',11689442,32.0),('... | SELECT State, ObesityRate FROM States ORDER BY ObesityRate DESC LIMIT 3; |
What is the maximum age of players who play action games? | CREATE TABLE AgeData (PlayerID INT,Age INT,GameType VARCHAR(20)); INSERT INTO AgeData (PlayerID,Age,GameType) VALUES (1,25,'Action'),(2,30,'Adventure'),(3,20,'Simulation'),(4,35,'Simulation'),(5,22,'Action'),(6,28,'Simulation'),(7,32,'Action'),(8,29,'Action'); | SELECT GameType, MAX(Age) FROM AgeData WHERE GameType = 'Action'; |
How many solar power plants are there in the state 'California' with a capacity greater than 100 MW? | CREATE TABLE solar_plants (id INT,name TEXT,state TEXT,capacity_mw FLOAT); INSERT INTO solar_plants (id,name,state,capacity_mw) VALUES (1,'Topaz Solar Farm','California',550.0),(2,'Solar Star','California',579.0); | SELECT COUNT(*) FROM solar_plants WHERE state = 'California' AND capacity_mw > 100.0; |
What is the explainability score for each AI safety concern? | CREATE TABLE AISafety (id INT,concern VARCHAR(255),explainability_score DECIMAL(5,2)); INSERT INTO AISafety (id,concern,explainability_score) VALUES (1,'Data Privacy',78.91),(2,'Unintended Consequences',65.23),(3,'Bias',82.34); | SELECT concern, AVG(explainability_score) as avg_explainability_score FROM AISafety GROUP BY concern; |
What is the average citizen feedback score for public libraries? | CREATE TABLE Feedback (Service VARCHAR(25),Score INT); INSERT INTO Feedback (Service,Score) VALUES ('Library',8),('Park',7),('Recreation Center',9); | SELECT AVG(Score) FROM Feedback WHERE Service = 'Library'; |
Update the local economic impact of an attraction | CREATE TABLE attraction_economic_impact (attraction_id INT,local_employment INT,annual_revenue FLOAT); | UPDATE attraction_economic_impact SET local_employment = 50, annual_revenue = 250000.00 WHERE attraction_id = 1; |
Which 'online travel agency' has the highest revenue in 'Q1 2022'? | CREATE TABLE otas (id INT,name TEXT,revenue FLOAT,q1_2022 FLOAT); INSERT INTO otas (id,name,revenue,q1_2022) VALUES (1,'Expedia',1000000,350000),(2,'Booking.com',1200000,420000),(3,'Agoda',800000,380000); | SELECT name FROM otas WHERE q1_2022 = (SELECT MAX(q1_2022) FROM otas); |
What are the names of all pollution control initiatives in the Indian Ocean? | CREATE TABLE pollution_control (id INT,name TEXT,region TEXT); INSERT INTO pollution_control (id,name,region) VALUES (1,'Initiative A','Indian Ocean'); INSERT INTO pollution_control (id,name,region) VALUES (2,'Initiative B','Atlantic Ocean'); | SELECT name FROM pollution_control WHERE region = 'Indian Ocean'; |
Identify the supplier with the lowest transparency score for Dysprosium and Terbium | CREATE TABLE supply_chain_transparency (element VARCHAR(10),supplier VARCHAR(20),transparency INT); INSERT INTO supply_chain_transparency VALUES ('Dysprosium','Supplier A',8),('Dysprosium','Supplier B',7),('Dysprosium','Supplier C',6),('Terbium','Supplier A',9),('Terbium','Supplier B',8),('Terbium','Supplier C',5); | SELECT element, MIN(transparency) AS min_transparency FROM supply_chain_transparency GROUP BY element; |
How many cases were handled by each attorney in 'California'? | CREATE TABLE attorneys (attorney_id INT,name VARCHAR(50),state VARCHAR(50)); CREATE TABLE cases (case_id INT,attorney_id INT,state VARCHAR(50)); INSERT INTO attorneys (attorney_id,name,state) VALUES (1,'Smith','California'),(2,'Johnson','New York'),(3,'Williams','California'),(4,'Brown','Texas'); INSERT INTO cases (cas... | SELECT attorneys.name, COUNT(*) as cases_handled FROM attorneys INNER JOIN cases ON attorneys.attorney_id = cases.attorney_id WHERE attorneys.state = 'California' GROUP BY attorneys.name; |
What is the average recycling rate in percentage for cities in Asia with a population greater than 2 million? | CREATE TABLE recycling_rates (city VARCHAR(50),population INT,continent VARCHAR(50),recycling_rate FLOAT); INSERT INTO recycling_rates (city,population,continent,recycling_rate) VALUES ('Tokyo',9000000,'Asia',40),('Delhi',30000000,'Asia',35),('Mumbai',22000000,'Asia',28); | SELECT AVG(recycling_rate) FROM recycling_rates WHERE population > 2000000 AND continent = 'Asia'; |
What was the total revenue for 'Crepe Cafe' in the second quarter of 2022? | CREATE TABLE Pizzeria (Date DATE,Revenue INT); INSERT INTO Pizzeria (Date,Revenue) VALUES ('2022-04-01',600),('2022-04-02',700),('2022-04-03',800),('2022-05-01',600),('2022-05-02',700),('2022-05-03',800),('2022-06-01',600),('2022-06-02',700),('2022-06-03',800); | SELECT SUM(Revenue) FROM Pizzeria WHERE Date BETWEEN '2022-04-01' AND '2022-06-30' AND Date LIKE '2022-04%' OR Date LIKE '2022-05%' OR Date LIKE '2022-06%' AND Restaurant = 'Crepe Cafe'; |
What is the total fare collected for each subway line in January 2022? | CREATE TABLE subway_lines (line_id INT,line_name VARCHAR(255)); INSERT INTO subway_lines VALUES (1,'Line 1'),(2,'Line 2'),(3,'Line 3'); CREATE TABLE fare_collection (collection_id INT,line_id INT,fare DECIMAL(5,2),collection_date DATE); | SELECT sl.line_name, SUM(fc.fare) as total_fare FROM subway_lines sl INNER JOIN fare_collection fc ON sl.line_id = fc.line_id WHERE fc.collection_date BETWEEN '2022-01-01' AND '2022-01-31' GROUP BY sl.line_name; |
List the top 3 water consuming industries in New York in 2021. | CREATE TABLE industrial_water_usage (state VARCHAR(20),year INT,sector VARCHAR(30),usage FLOAT); INSERT INTO industrial_water_usage (state,year,sector,usage) VALUES ('New York',2021,'Agriculture',12345.6),('New York',2021,'Manufacturing',23456.7),('New York',2021,'Mining',34567.8),('New York',2021,'Gasoline Production'... | SELECT sector, usage FROM industrial_water_usage WHERE state = 'New York' AND year = 2021 ORDER BY usage DESC LIMIT 3; |
Find the total number of peacekeeping operations conducted by ASEAN countries? | CREATE TABLE peacekeeping_operations (country VARCHAR(50),operation VARCHAR(100)); INSERT INTO peacekeeping_operations (country,operation) VALUES ('Indonesia','UNMIK'),('Malaysia','UNAMID'),('Philippines','MINUSTAH'),('Singapore','UNMOGIP'),('Thailand','UNFICYP'); | SELECT COUNT(*) FROM peacekeeping_operations WHERE country IN ('Indonesia', 'Malaysia', 'Philippines', 'Singapore', 'Thailand'); |
Display the top 3 AI algorithms with the highest average usage count in Europe. | CREATE TABLE ai_algorithms (algorithm_id INT,algorithm_name VARCHAR(255),region VARCHAR(255),usage_count INT); INSERT INTO ai_algorithms (algorithm_id,algorithm_name,region,usage_count) VALUES (1,'Random Forest','France',120),(2,'SVM','Germany',150),(3,'Neural Network','UK',200),(4,'Decision Tree','Spain',180),(5,'Naiv... | SELECT algorithm_name, AVG(usage_count) as avg_usage_count FROM ai_algorithms WHERE region = 'Europe' GROUP BY algorithm_name ORDER BY avg_usage_count DESC LIMIT 3; |
What is the success rate of cases in which attorney Maria Lopez was involved? | CREATE TABLE attorneys (attorney_id INT,name TEXT); INSERT INTO attorneys (attorney_id,name) VALUES (1,'Maria Lopez'); CREATE TABLE cases (case_id INT,attorney_id INT,outcome TEXT); | SELECT AVG(CASE WHEN cases.outcome = 'Success' THEN 1.0 ELSE 0.0 END) AS success_rate FROM cases INNER JOIN attorneys ON cases.attorney_id = attorneys.attorney_id WHERE attorneys.name = 'Maria Lopez'; |
How many 'critical' vulnerabilities exist in the 'database_systems' table? | CREATE TABLE database_systems (id INT,name VARCHAR(255),severity VARCHAR(255)); INSERT INTO database_systems (id,name,severity) VALUES (1,'Database1','critical'),(2,'Database2','medium'),(3,'Database3','low'),(4,'Database4','medium'); | SELECT COUNT(*) FROM database_systems WHERE severity = 'critical'; |
What are the names of drugs with phase 1 clinical trials in the rare diseases therapeutic area? | CREATE TABLE clinical_trials (drug_name TEXT,phase TEXT); INSERT INTO clinical_trials (drug_name,phase) VALUES ('Drug1','phase 1'),('Drug2','phase 2'),('Drug3','phase 3'),('Drug4','phase 3'),('Drug5','phase 2'),('Drug6','phase 1'); CREATE TABLE therapeutic_areas (drug_name TEXT,therapeutic_area TEXT); INSERT INTO thera... | SELECT DISTINCT drug_name FROM clinical_trials INNER JOIN therapeutic_areas ON clinical_trials.drug_name = therapeutic_areas.drug_name WHERE phase = 'phase 1' AND therapeutic_area = 'rare diseases'; |
List all veteran employment stats for New York state. | CREATE TABLE states (id INT,name VARCHAR(255)); INSERT INTO states (id,name) VALUES (1,'New York'); CREATE TABLE veteran_stats (id INT,state_id INT,employed INT,unemployed INT); INSERT INTO veteran_stats (id,state_id,employed,unemployed) VALUES (1,1,3000,500); | SELECT state_id, employed, unemployed FROM veteran_stats WHERE state_id = (SELECT id FROM states WHERE name = 'New York'); |
How many songs have been released by female artists on the 'Classical Music' platform since 2010? | CREATE TABLE Artists (ArtistID int,ArtistName varchar(100),Gender varchar(50),Platform varchar(50)); CREATE TABLE Songs (SongID int,SongName varchar(100),ReleaseDate date,ArtistID int); INSERT INTO Artists VALUES (1,'Artist E','Female','Classical Music'); INSERT INTO Artists VALUES (2,'Artist F','Male','Classical Music... | SELECT COUNT(*) as NumberOfSongs FROM Artists JOIN Songs ON Artists.ArtistID = Songs.ArtistID WHERE Gender = 'Female' AND Platform = 'Classical Music' AND ReleaseDate >= '2010-01-01'; |
What is the minimum lead time for factories in the fair labor sector? | CREATE TABLE Factories (id INT,sector VARCHAR,lead_time INT); | SELECT MIN(lead_time) FROM Factories WHERE sector = 'fair labor'; |
What is the average account balance for clients who identify as Latinx or Hispanic? | CREATE TABLE clients (client_id INT,account_balance DECIMAL(10,2),ethnicity VARCHAR(50)); INSERT INTO clients (client_id,account_balance,ethnicity) VALUES (1,9000,'Latinx'),(2,7000,'Hispanic'),(3,6000,'Asian'),(4,5000,'African American'),(5,8000,'Caucasian'); | SELECT AVG(account_balance) FROM clients WHERE ethnicity IN ('Latinx', 'Hispanic'); |
Delete all records from the 'donations' table. | CREATE TABLE donations (donation_id INT,donor_id INT,organization_id INT,donation_amount FLOAT); INSERT INTO donations (donation_id,donor_id,organization_id,donation_amount) VALUES (1,2,101,350.00),(2,3,102,700.00),(3,4,103,250.00); | DELETE FROM donations; |
What is the total value of investments in sustainable funds by clients in the European Union in H1 2022? | CREATE TABLE investments (client_id INT,investment_value DECIMAL(10,2),investment_type VARCHAR(50),investment_date DATE,country VARCHAR(50)); INSERT INTO investments (client_id,investment_value,investment_type,investment_date,country) VALUES (1,15000.00,'Sustainable Funds','2022-02-10','Germany'),(2,20000.00,'Bonds','2... | SELECT SUM(investment_value) as total_investment_value FROM investments WHERE investment_type = 'Sustainable Funds' AND country IN ('Germany', 'France', 'Italy') AND investment_date BETWEEN '2022-01-01' AND '2022-06-30'; |
Display the number of threat intelligence records and their source by week | CREATE TABLE threat_weekly (id INT,record_date DATE,source VARCHAR(10)); INSERT INTO threat_weekly (id,record_date,source) VALUES (1,'2022-01-03','TI1'),(2,'2022-01-03','TI2'),(3,'2022-01-10','TI3'),(4,'2022-01-17','TI4'),(5,'2022-01-24','TI1'),(6,'2022-01-31','TI2'); | SELECT EXTRACT(WEEK FROM record_date) as week, source, COUNT(*) as records FROM threat_weekly GROUP BY week, source; |
How many mobile subscribers are there in each plan type? | CREATE TABLE mobile_subscribers (subscriber_id INT,plan_type VARCHAR(10),region VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id,plan_type,region) VALUES (1,'postpaid','Urban'),(2,'postpaid','Rural'),(3,'prepaid','Rural'),(4,'postpaid','Urban'),(5,'prepaid','Urban'); | SELECT plan_type, COUNT(*) FROM mobile_subscribers GROUP BY plan_type; |
Calculate the total budget allocated to 'Disability Accommodations' and 'Assistive Technology' combined in the second quarter. | CREATE TABLE BudgetAllocations (ID INT,Category TEXT,Quarter INT,Amount FLOAT); INSERT INTO BudgetAllocations (ID,Category,Quarter,Amount) VALUES (1,'Disability Accommodations',1,20000.00),(2,'Policy Advocacy',2,15000.00),(3,'Disability Accommodations',2,5000.00),(4,'Assistive Technology',2,8000.00); | SELECT SUM(Amount) FROM BudgetAllocations WHERE Category IN ('Disability Accommodations', 'Assistive Technology') AND Quarter = 2; |
Identify the number of pollution violations in the Southern Ocean region in the 'Compliance' schema. | CREATE SCHEMA Compliance;CREATE TABLE PollutionViolations (id INT,country TEXT,region TEXT,year INT,violations INT); INSERT INTO PollutionViolations (id,country,region,year,violations) VALUES (1,'Argentina','Southern Ocean',2019,3),(2,'Chile','Southern Ocean',2020,5),(3,'South Africa','Southern Ocean',2019,2),(4,'Austr... | SELECT region, SUM(violations) AS total_violations FROM Compliance.PollutionViolations WHERE region = 'Southern Ocean' GROUP BY region; |
Which mining operations have more than 50% of their workforce female? | CREATE TABLE mining_operations (operation_id INT,operation_name VARCHAR(50),employee_id INT,first_name VARCHAR(50),last_name VARCHAR(50),position VARCHAR(50),gender VARCHAR(10)); INSERT INTO mining_operations (operation_id,operation_name,employee_id,first_name,last_name,position,gender) VALUES (1,'Operation A',1,'John'... | SELECT operation_name FROM (SELECT operation_name, (COUNT(*) FILTER (WHERE gender = 'Female'))/COUNT(*) AS female_ratio FROM mining_operations GROUP BY operation_name) AS subquery WHERE female_ratio > 0.5; |
Update the position of an employee in the Employees table | CREATE TABLE Employees (id INT,name VARCHAR(50),position VARCHAR(50),left_company BOOLEAN); | UPDATE Employees SET position = 'Senior Software Engineer' WHERE name = 'Juan Garcia'; |
What is the total cargo weight handled by each port during the second half of 2022? | CREATE TABLE ports (id INT,name TEXT,country TEXT); CREATE TABLE cargo_movements (id INT,port_id INT,cargo_type TEXT,weight INT,date DATE); INSERT INTO ports (id,name,country) VALUES (1,'Port of Singapore','Singapore'),(2,'Port of Shanghai','China'),(3,'Port of Busan','South Korea'); INSERT INTO cargo_movements (id,por... | SELECT p.name, SUM(cm.weight) FROM ports p JOIN cargo_movements cm ON p.id = cm.port_id WHERE MONTH(cm.date) > 6 GROUP BY p.name; |
What are the names and capacities of all geothermal power plants in Indonesia? | CREATE TABLE geothermal_plants (name TEXT,capacity INTEGER,country TEXT); INSERT INTO geothermal_plants (name,capacity,country) VALUES ('Geothermal Plant 1',600,'Indonesia'),('Geothermal Plant 2',700,'Indonesia'); | SELECT name, capacity FROM geothermal_plants WHERE country = 'Indonesia' |
What is the total mass of all spacecraft that have been launched since 2010? | CREATE TABLE Spacecraft (SpacecraftID INT,Name VARCHAR(50),Manufacturer VARCHAR(50),LaunchDate DATE,Mass FLOAT); INSERT INTO Spacecraft VALUES (1,'Juno','NASA','2011-08-05',3625),(2,'Curiosity','NASA','2012-11-26',1982),(3,'Mangalyaan','ISRO','2013-11-05',1350); | SELECT SUM(Mass) FROM Spacecraft WHERE YEAR(LaunchDate) >= 2010; |
What is the average salary of employees in the 'Finance' department? | CREATE TABLE Employees (Employee_ID INT,First_Name VARCHAR(50),Last_Name VARCHAR(50),Department VARCHAR(50),Salary DECIMAL(10,2)); INSERT INTO Employees (Employee_ID,First_Name,Last_Name,Department,Salary) VALUES (1,'Sana','Mir','Finance',80000.00); INSERT INTO Employees (Employee_ID,First_Name,Last_Name,Department,Sal... | SELECT AVG(Salary) FROM Employees WHERE Department = 'Finance'; |
Which ethical AI principles are missing from the provided list? | CREATE TABLE EthicalAI (principle_id INT,principle_name VARCHAR(50)); INSERT INTO EthicalAI (principle_id,principle_name) VALUES (1,'Fairness'),(2,'Accountability'),(3,'Transparency'); | SELECT 'Data Minimization' AS principle_name UNION ALL SELECT 'Explainability' UNION ALL SELECT 'Human Oversight'; |
How many solar power installations were completed in California in 2020 and 2021? | CREATE TABLE power_installations (id INT,location VARCHAR(50),year INT,power_type VARCHAR(50),size INT); INSERT INTO power_installations (id,location,year,power_type,size) VALUES (1,'California',2020,'Solar',1500); INSERT INTO power_installations (id,location,year,power_type,size) VALUES (2,'California',2021,'Solar',18... | SELECT SUM(size) FROM power_installations WHERE location = 'California' AND power_type = 'Solar' AND year IN (2020, 2021); |
What is the average number of visitors to the events organized by the cultural center in the year 2020? | CREATE TABLE CulturalEvents (id INT,year INT,visitors INT); INSERT INTO CulturalEvents (id,year,visitors) VALUES (1,2017,500),(2,2018,700),(3,2019,900),(4,2020,1100); | SELECT AVG(visitors) FROM CulturalEvents WHERE year = 2020; |
What is the total funding by program type in 2022? | CREATE TABLE funding_sources (id INT,program_type VARCHAR(255),funding_year INT,amount DECIMAL(10,2)); | SELECT program_type, SUM(amount) OVER (PARTITION BY program_type) AS total_funding_by_program_type FROM funding_sources WHERE funding_year = 2022 ORDER BY program_type; |
How many cybersecurity incidents were reported by Asian-owned businesses in the past year? | CREATE TABLE businesses (id INT,business_name VARCHAR(255),business_owner_ethnicity VARCHAR(255),business_location VARCHAR(255)); CREATE TABLE incidents (id INT,incident_type VARCHAR(255),incident_date DATE,business_id INT); INSERT INTO businesses (id,business_name,business_owner_ethnicity,business_location) VALUES (1,... | SELECT COUNT(*) FROM incidents i JOIN businesses b ON i.business_id = b.id WHERE b.business_owner_ethnicity = 'Asian' AND i.incident_date >= DATEADD(year, -1, GETDATE()); |
What is the average energy consumption of all buildings constructed before 2010? | CREATE TABLE green_buildings (id INT,name VARCHAR(50),construction_year INT,energy_consumption INT); INSERT INTO green_buildings (id,name,construction_year,energy_consumption) VALUES (1,'GreenHub',2015,1200),(2,'EcoTower',2012,1500),(3,'SolarVista',2008,1800),(4,'WindHaven',2018,1000); | SELECT AVG(energy_consumption) FROM green_buildings WHERE construction_year < 2010; |
What is the maximum dissolved oxygen level (in mg/L) recorded in fish farms in the Bay of Bengal? | CREATE TABLE bay_of_bengal_farms (id INT,name TEXT,dissolved_oxygen FLOAT); | SELECT MAX(dissolved_oxygen) FROM bay_of_bengal_farms; |
Which sustainable garments have the highest sales in the last 6 months? | CREATE TABLE sales_data(sale_id INT,garment_id INT,sale_date DATE,sustainable BOOLEAN,quantity INT,price FLOAT); INSERT INTO sales_data(sale_id,garment_id,sale_date,sustainable,quantity,price) VALUES (1,1,'2022-07-01',true,5,25),(2,3,'2022-08-15',true,10,40),(3,2,'2022-09-05',false,7,35); | SELECT garment_id, SUM(quantity * price) as total_sales FROM sales_data WHERE sale_date >= DATEADD(month, -6, CURRENT_DATE) AND sustainable = true GROUP BY garment_id ORDER BY total_sales DESC; |
What is the average depth of all ocean features? | CREATE TABLE ocean_features (name TEXT,depth FLOAT); INSERT INTO ocean_features (name,depth) VALUES ('Mariana Trench',10994.0),('Puerto Rico Trench',8605.0),('Siberian Traps',3000.0); | SELECT AVG(depth) FROM ocean_features; |
Delete records in the menu_item table that have a price greater than 20 | CREATE TABLE menu_item (item_id INT,item_name VARCHAR(50),category VARCHAR(20),price DECIMAL(5,2)); | DELETE FROM menu_item WHERE price > 20; |
What is the percentage of players who have made a purchase in the last month? | CREATE TABLE players (id INT,made_purchase BOOLEAN); | SELECT 100.0 * COUNT(*) / (SELECT COUNT(*) FROM players) AS percentage FROM players WHERE made_purchase = TRUE AND purchase_date >= CURDATE() - INTERVAL 30 DAY; |
List the number of mines in Texas and Oklahoma, grouped by state. | CREATE TABLE mines (id INT,name VARCHAR(50),location VARCHAR(50),size INT,operational_status VARCHAR(20)); INSERT INTO mines VALUES (1,'Texas Mine','Texas',500,'operational'); INSERT INTO mines VALUES (2,'Oklahoma Mine','Oklahoma',300,'operational'); INSERT INTO mines VALUES (3,'Closed Mine','Texas',400,'closed'); | SELECT location, COUNT(*) as mine_count FROM mines WHERE location IN ('Texas', 'Oklahoma') GROUP BY location; |
Identify faculty members who are female and have published more than 10 papers. | CREATE TABLE faculty (id INT,name VARCHAR(50),gender VARCHAR(50),publication_count INT); INSERT INTO faculty (id,name,gender,publication_count) VALUES (1,'Alice Johnson','Female',12),(2,'Bob Brown','Male',8),(3,'Charlie Davis','Non-binary',5); | SELECT * FROM faculty WHERE gender = 'Female' AND publication_count > 10; |
Show the number of animals in the 'animal_population' table that belong to species that are not endangered. | CREATE TABLE animal_population (species VARCHAR(50),endangered_status VARCHAR(50),animal_count INT); | SELECT species, animal_count FROM animal_population WHERE species NOT IN (SELECT species FROM animal_population WHERE endangered_status = 'endangered'); |
Insert a new record into the "regulations" table with "country" as "India", "regulation_name" as "Information Technology (Intermediaries Guidelines) Rules, 2011" | CREATE TABLE regulations (country VARCHAR(2),regulation_name VARCHAR(100)); | INSERT INTO regulations (country, regulation_name) VALUES ('IN', 'Information Technology (Intermediaries Guidelines) Rules, 2011'); |
Which artists have their works exhibited in the 'Modern Art Museum'? | CREATE TABLE Artists (ArtistID int,Name varchar(50),Nationality varchar(50)); INSERT INTO Artists (ArtistID,Name,Nationality) VALUES (1,'Pablo Picasso','Spanish'),(2,'Vincent van Gogh','Dutch'); CREATE TABLE Exhibitions (ExhibitionID int,Title varchar(50),Artists varchar(50),Museum varchar(50)); INSERT INTO Exhibitions... | SELECT Artists.Name FROM Artists INNER JOIN Exhibitions ON Artists.ArtistID = Cast(Split_Part(Exhibitions.Artists, ',', 1) AS int) WHERE Exhibitions.Museum = 'Modern Art Museum'; |
What is the average temperature recorded for each crop type in the past month? | CREATE TABLE crop_temperature (crop_type VARCHAR(20),record_date DATE,temperature INT); INSERT INTO crop_temperature (crop_type,record_date,temperature) VALUES ('Corn','2022-05-01',25),('Soybean','2022-05-01',22),('Wheat','2022-05-01',18); INSERT INTO crop_temperature (crop_type,record_date,temperature) VALUES ('Corn',... | SELECT crop_type, AVG(temperature) as avg_temperature FROM crop_temperature WHERE record_date >= DATEADD(month, -1, GETDATE()) GROUP BY crop_type; |
What was the waste generation in Bangkok in 2019? | CREATE TABLE waste_generation_bangkok (year INT,total_waste INT); INSERT INTO waste_generation_bangkok (year,total_waste) VALUES (2018,150000),(2019,170000),(2020,185000); | SELECT total_waste FROM waste_generation_bangkok WHERE year = 2019; |
What is the average mental health score for students in each grade level, grouped by school district? | CREATE TABLE mental_health_scores (score_id INT,district_id INT,grade_level INT,mental_health_score INT); | SELECT s.grade_level, sd.district_name, AVG(mhs.mental_health_score) FROM mental_health_scores mhs INNER JOIN students s ON mhs.student_id = s.student_id INNER JOIN school_districts sd ON s.district_id = sd.district_id GROUP BY s.grade_level, sd.district_name; |
What is the average energy efficiency rating for residential buildings in Brazil? | CREATE TABLE brazil_energy_efficiency (state VARCHAR(50),building_type VARCHAR(50),energy_efficiency_rating FLOAT); INSERT INTO brazil_energy_efficiency (state,building_type,energy_efficiency_rating) VALUES ('São Paulo','Residential',80.5),('Rio de Janeiro','Residential',75.3),('Minas Gerais','Residential',78.1),('Bahi... | SELECT AVG(energy_efficiency_rating) FROM brazil_energy_efficiency WHERE building_type = 'Residential'; |
How many agricultural innovation patents were granted to applicants from African countries between 2017 and 2021? | CREATE TABLE agri_patents (id INT,patent_number INT,title TEXT,applicant_country TEXT,grant_year INT); INSERT INTO agri_patents (id,patent_number,title,applicant_country,grant_year) VALUES (1,12345,'Smart Irrigation System','Kenya',2017),(2,67890,'Vertical Farming Design','Nigeria',2018),(3,11121,'Organic Pest Control'... | SELECT COUNT(*) FROM agri_patents WHERE applicant_country LIKE 'Africa%' AND grant_year BETWEEN 2017 AND 2021; |
What's the total amount donated by individual donors who have made more than two donations in the year 2020? | CREATE TABLE Donors (DonorID INT,DonorName VARCHAR(100),DonationAmount DECIMAL(10,2),DonationDate DATE); | SELECT SUM(DonationAmount) FROM Donors WHERE YEAR(DonationDate) = 2020 GROUP BY DonorID HAVING COUNT(DonorID) > 2; |
Update the 'status' column to 'inactive' for all vessels in the 'vessels' table that have not been active in the past year. | CREATE TABLE vessel_activity (vessel_id INT,activity_date DATE,PRIMARY KEY(vessel_id,activity_date)); | UPDATE vessels v1 SET status = 'inactive' WHERE NOT EXISTS (SELECT 1 FROM vessel_activity va1 WHERE va1.vessel_id = v1.id AND va1.activity_date > DATE(NOW()) - INTERVAL 1 YEAR); |
What are the names and capacities of solar farms in California? | CREATE TABLE solar_farms (name TEXT,state TEXT,capacity FLOAT); INSERT INTO solar_farms (name,state,capacity) VALUES ('Mojave Solar','California',250.0),('Desert Sunlight','California',550.0),('Topaz Solar','California',550.0); | SELECT name, capacity FROM solar_farms WHERE state = 'California'; |
What is the minimum number of air defense systems supplied by YZ Corp to European countries in the year 2021? | CREATE TABLE Military_Equipment_Sales (supplier VARCHAR(255),region VARCHAR(255),equipment VARCHAR(255),quantity INT,sale_price DECIMAL(10,2),sale_year INT); | SELECT MIN(quantity) FROM Military_Equipment_Sales WHERE supplier = 'YZ Corp' AND region = 'Europe' AND equipment = 'air defense systems' AND sale_year = 2021; |
List all renewable energy projects in India that were completed in 2018. | CREATE TABLE renewable_projects (id INT PRIMARY KEY,project_name VARCHAR(255),project_location VARCHAR(255),project_type VARCHAR(255),completion_year INT,capacity_mw FLOAT); | SELECT * FROM renewable_projects WHERE project_location = 'India' AND completion_year = 2018; |
What is the total number of peacekeeping operations conducted by the UN? | CREATE TABLE PeacekeepingOperations (OperationID INT,OperationName VARCHAR(100),OperationType VARCHAR(50),StartDate DATE,EndDate DATE); | SELECT COUNT(OperationID) FROM PeacekeepingOperations WHERE OperationType = 'Peacekeeping'; |
List the names and case numbers of cases in 'cases' table that have a billing rate greater than $300 in 'billing' table | CREATE TABLE cases (case_id INT,case_number VARCHAR(50),client_name VARCHAR(50),attorney_id INT); CREATE TABLE billing (billing_id INT,attorney_id INT,client_id INT,hours_billed INT,billing_rate DECIMAL(5,2)); | SELECT cases.case_number, cases.client_name FROM cases INNER JOIN billing ON cases.attorney_id = billing.attorney_id WHERE billing.billing_rate > 300; |
What is the total number of tourists visiting countries in the Oceania continent? | CREATE TABLE oceania_tourists (id INT,country VARCHAR(20),tourists INT); INSERT INTO oceania_tourists (id,country,tourists) VALUES (1,'Australia',20000000),(2,'New Zealand',3000000); | SELECT SUM(tourists) FROM oceania_tourists; |
Who is the community health worker with the most mental health parity consultations in Florida? | CREATE TABLE community_health_workers (id INT,name TEXT,zip TEXT,consultations INT); INSERT INTO community_health_workers (id,name,zip,consultations) VALUES (1,'John Doe','32001',35),(2,'Jane Smith','33101',45); CREATE VIEW fl_workers AS SELECT * FROM community_health_workers WHERE zip BETWEEN '32001' AND '34999'; | SELECT name FROM fl_workers WHERE consultations = (SELECT MAX(consultations) FROM fl_workers); |
What is the minimum budget for a community development project in the 'community_development' table? | CREATE TABLE community_development (id INT,name VARCHAR(50),type VARCHAR(50),budget FLOAT); INSERT INTO community_development (id,name,type,budget) VALUES (1,'Green Spaces','Community Development',75000.00),(2,'Smart Street Lighting','Agricultural Innovation',120000.00),(3,'Cultural Center','Community Development',1000... | SELECT MIN(budget) FROM community_development WHERE type = 'Community Development'; |
Identify the top 5 most frequently used bus stops. | CREATE TABLE stop (stop_id INT,stop_name TEXT);CREATE TABLE trip (trip_id INT,stop_id INT,passenger_count INT); INSERT INTO stop (stop_id,stop_name) VALUES (1,'Stop1'),(2,'Stop2'),(3,'Stop3'),(4,'Stop4'),(5,'Stop5'),(6,'Stop6'); INSERT INTO trip (trip_id,stop_id,passenger_count) VALUES (1,1,5),(2,1,7),(3,2,3),(4,2,6),(... | SELECT s.stop_name, SUM(t.passenger_count) as total_passenger_count FROM stop s JOIN trip t ON s.stop_id = t.stop_id GROUP BY s.stop_id ORDER BY total_passenger_count DESC LIMIT 5; |
How many public libraries are there in California, and what is the total budget allocated to them? | CREATE TABLE public_libraries (state VARCHAR(20),num_libraries INT,budget FLOAT); INSERT INTO public_libraries (state,num_libraries,budget) VALUES ('California',1500,25000000); | SELECT SUM(budget) FROM public_libraries WHERE state = 'California'; SELECT COUNT(*) FROM public_libraries WHERE state = 'California'; |
Which countries have the highest average container weight for exports to the USA, and what is the average weight per container for those shipments? | CREATE TABLE countries (country_id INT,country_name VARCHAR(100)); CREATE TABLE exports (export_id INT,container_weight INT,country_id INT,shipped_date DATE,destination_country VARCHAR(100)); INSERT INTO countries VALUES (1,'China'); INSERT INTO countries VALUES (2,'India'); INSERT INTO exports VALUES (1,10,1,'2022-03-... | SELECT exports.destination_country, countries.country_name, AVG(exports.container_weight) as avg_weight_per_container FROM countries INNER JOIN exports ON countries.country_id = exports.country_id WHERE exports.destination_country = 'USA' GROUP BY exports.destination_country, countries.country_name ORDER BY AVG(exports... |
What is the total number of hospital beds in rural areas of Brazil, Argentina, and Colombia? | CREATE TABLE hospitals (name TEXT,location TEXT,beds INTEGER); INSERT INTO hospitals (name,location,beds) VALUES ('Hospital A','Rural Brazil',50),('Hospital B','Rural Brazil',40),('Hospital C','Rural Argentina',30),('Hospital D','Rural Argentina',20),('Hospital E','Rural Colombia',10); | SELECT SUM(beds) FROM hospitals WHERE location LIKE 'Rural%'; |
What is the average number of labor rights violations per month for the year 2020, for each union? | CREATE TABLE labor_rights_violations (union_name TEXT,violation_date DATE); INSERT INTO labor_rights_violations (union_name,violation_date) VALUES ('Union A','2020-01-05'),('Union B','2020-02-10'),('Union C','2020-03-15'),('Union A','2020-04-20'),('Union D','2020-05-25'),('Union E','2020-06-30'),('Union A','2020-07-05'... | SELECT union_name, AVG(EXTRACT(MONTH FROM violation_date)) as avg_violations_per_month FROM labor_rights_violations WHERE EXTRACT(YEAR FROM violation_date) = 2020 GROUP BY union_name; |
What are the total ticket sales for each conference in the ticket_sales table? | CREATE TABLE ticket_sales (id INT,team VARCHAR(50),conference VARCHAR(50),tickets_sold INT,revenue FLOAT); | SELECT conference, SUM(tickets_sold) AS total_tickets_sold FROM ticket_sales GROUP BY conference; |
Calculate the maximum transaction amount for the 'SME' customer segment in the last month. | CREATE TABLE customers (id INT,segment VARCHAR(20)); CREATE TABLE transactions (id INT,customer_id INT,amount DECIMAL(10,2),transaction_date DATE); INSERT INTO customers (id,segment) VALUES (1,'SME'); INSERT INTO transactions (id,customer_id,amount,transaction_date) VALUES (1,1,1200,'2022-05-15'); | SELECT MAX(amount) FROM transactions JOIN customers ON transactions.customer_id = customers.id WHERE customers.segment = 'SME' AND transaction_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH); |
What is the total number of marine species observed in the Pacific and Atlantic oceans with a depth greater than 2000 meters? | CREATE TABLE marine_species (id INT,species_name VARCHAR(255),ocean VARCHAR(255),depth INT); INSERT INTO marine_species (id,species_name,ocean,depth) VALUES (1,'Mariana Snailfish','Pacific',8178); INSERT INTO marine_species (id,species_name,ocean,depth) VALUES (2,'Hadal Snailfish','Atlantic',7500); | SELECT SUM(CASE WHEN ocean IN ('Pacific', 'Atlantic') AND depth > 2000 THEN 1 ELSE 0 END) FROM marine_species; |
What is the average AI ethical concern rating by region? | CREATE TABLE ai_ethics (region VARCHAR(255),concern_rating FLOAT); INSERT INTO ai_ethics (region,concern_rating) VALUES ('APAC',3.2),('EMEA',4.1),('NA',3.8),('LA',3.5); | SELECT region, AVG(concern_rating) OVER (PARTITION BY region) AS avg_rating FROM ai_ethics; |
What is the total number of employees hired from the LGBTQ+ community after 2020? | CREATE TABLE Hiring (HireID INT,EmployeeID INT,HireDate DATE,Community VARCHAR(50)); INSERT INTO Hiring (HireID,EmployeeID,HireDate,Community) VALUES (1,5,'2022-01-15','LatinX'),(2,6,'2022-02-20','African American'),(3,7,'2022-03-05','LGBTQ+'),(4,8,'2022-04-12','Women in STEM'),(5,9,'2021-11-30','LGBTQ+'),(6,10,'2021-1... | SELECT COUNT(*) FROM Hiring WHERE YEAR(HireDate) > 2020 AND Community = 'LGBTQ+'; |
What is the total value of ethical jewelry purchases made by customers in Canada in 2020? | CREATE TABLE customers (id INT,customer_name VARCHAR(50),total_spent DECIMAL(10,2)); CREATE TABLE ethical_jewelry_purchases (id INT,purchase_id INT,customer_id INT,purchase_value DECIMAL(10,2)); INSERT INTO customers (id,customer_name,total_spent) VALUES (1,'EcoBuyer',1200.00),(2,'GreenSpender',1800.00),(3,'Sustainable... | SELECT SUM(purchase_value) FROM ethical_jewelry_purchases JOIN customers ON customers.id = ethical_jewelry_purchases.customer_id WHERE customers.country_of_residence = 'Canada' AND YEAR(purchase_date) = 2020; |
Insert a new impact investment for a US investor in climate change mitigation with an impact score of 80. | CREATE TABLE investor (investor_id INT,name VARCHAR(255),country VARCHAR(255)); INSERT INTO investor (investor_id,name,country) VALUES (1,'Acme Corp','United States'); CREATE TABLE investment (investment_id INT,investor_id INT,strategy VARCHAR(255),impact_score FLOAT); | INSERT INTO investment (investment_id, investor_id, strategy, impact_score) VALUES (101, (SELECT investor_id FROM investor WHERE name = 'Acme Corp' AND country = 'United States'), 'Climate Change Mitigation', 80); |
Update the charging stations table to add a new charging station, 'GreenTech Los Angeles', with a quantity of 10. | CREATE TABLE charging_stations (station_id INT,station_name VARCHAR(50),location VARCHAR(50),quantity INT); | UPDATE charging_stations SET quantity = quantity + 10 WHERE station_name = 'GreenTech Los Angeles'; |
Insert a new precedent named 'Roe v. Wade' into the 'precedents' table | CREATE TABLE precedents (precedent_id INT PRIMARY KEY,precedent_name VARCHAR(50),year DECIMAL(4,0),court VARCHAR(50)); | INSERT INTO precedents (precedent_id, precedent_name, year, court) VALUES (1, 'Roe v. Wade', 1973, 'Supreme Court'); |
How many indigenous farmers in 'tribal_area_1' produce food for their community? | CREATE TABLE tribal_area_1 (farmer_id TEXT,indigenous BOOLEAN,community_food BOOLEAN); INSERT INTO tribal_area_1 (farmer_id,indigenous,community_food) VALUES ('i001',true,true),('i002',true,false),('i003',false,true),('i004',false,false); | SELECT COUNT(*) FROM tribal_area_1 WHERE indigenous = true AND community_food = true; |
Determine the number of registered users for each country in Africa, returning only countries with more than 1,000,000 users. | CREATE TABLE africa_users (id INT,name VARCHAR(255),country VARCHAR(255)); INSERT INTO africa_users (id,name,country) VALUES (1,'John Doe','Nigeria'),(2,'Jane Smith','South Africa'); | SELECT country, COUNT(*) as num_users FROM africa_users GROUP BY country HAVING num_users > 1000000; |
Which artifacts were found in the 'CeramicMound' site and have more than 500 pieces? | CREATE TABLE Artifacts (id INT,excavation_site VARCHAR(20),artifact_name VARCHAR(30),pieces INT); INSERT INTO Artifacts (id,excavation_site,artifact_name,pieces) VALUES (1,'CeramicMound','Pot',700,),(2,'CeramicMound','Plate',300,); | SELECT artifact_name, pieces FROM Artifacts WHERE excavation_site = 'CeramicMound' AND pieces > 500; |
Display the total cost and average resilience score for each project type in the Resilience_Cost_By_Type view | CREATE VIEW Resilience_Cost_By_Type AS SELECT project_id,project_name,project_type,cost,resilience_score FROM Water_Infrastructure JOIN Resilience_Scores ON Water_Infrastructure.project_id = Resilience_Scores.project_id WHERE year >= 2015; CREATE TABLE Project_Types (project_type VARCHAR(255),type_description VARCHAR(2... | SELECT project_type, AVG(resilience_score), SUM(cost) FROM Resilience_Cost_By_Type JOIN Project_Types ON Resilience_Cost_By_Type.project_type = Project_Types.project_type GROUP BY project_type; |
Show the percentage of energy consumption from renewable sources for each state in the United States, sorted by the highest percentage. | CREATE TABLE state_energy (name VARCHAR(50),energy_consumption DECIMAL(5,2),renewable_energy DECIMAL(5,2),country VARCHAR(50)); INSERT INTO state_energy (name,energy_consumption,renewable_energy,country) VALUES ('California',12345.6,3421.7,'United States'),('Texas',15678.9,2950.1,'United States'),('New York',10987.5,26... | SELECT name, (renewable_energy / energy_consumption) * 100 AS percentage FROM state_energy WHERE country = 'United States' ORDER BY percentage DESC; |
Calculate the average salary of employees in each department, with a rank based on the average salary. | CREATE TABLE Employees (EmployeeID INT,EmployeeName VARCHAR(50),Department VARCHAR(50),Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID,EmployeeName,Department,Salary) VALUES (1,'John Doe','IT',70000),(2,'Jane Smith','IT',85000),(3,'Mike Johnson','HR',60000),(4,'Sara Brown','HR',65000); | SELECT Department, AVG(Salary) AS AverageSalary, RANK() OVER (ORDER BY AVG(Salary) DESC) AS SalaryRank FROM Employees GROUP BY Department; |
Delete the record of the client from the 'clients' table who resides in the 'CA' region. | CREATE TABLE clients (client_id INT,name TEXT,region TEXT); INSERT INTO clients (client_id,name,region) VALUES (1,'John Doe','US'),(2,'Jane Smith','CA'); | DELETE FROM clients WHERE region = 'CA'; |
Delete outdated professional development workshops | CREATE TABLE workshops (id INT,name VARCHAR(20),updated_at DATE); INSERT INTO workshops (id,name,updated_at) VALUES (1,'Tech Tools','2022-02-01'); INSERT INTO workshops (id,name,updated_at) VALUES (2,'Diversity Training','2022-04-15'); INSERT INTO workshops (id,name,updated_at) VALUES (3,'Project-based Learning','2021-... | DELETE FROM workshops WHERE updated_at < DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH); |
How many investment rounds have been raised by companies with female co-founders? | CREATE TABLE company (id INT,name VARCHAR(50),founder_gender VARCHAR(10)); CREATE TABLE investment_round (id INT,company_id INT,round_number INT); INSERT INTO company (id,name,founder_gender) VALUES (1,'Acme Corp','Female'); INSERT INTO investment_round (id,company_id,round_number) VALUES (1,1,1); INSERT INTO investmen... | SELECT COUNT(*) AS num_investment_rounds FROM company c JOIN investment_round ir ON c.id = ir.company_id WHERE c.founder_gender = 'Female'; |
What is the total amount of interest earned by each lender on socially responsible loans in the last 3 months? | CREATE TABLE lenders (lender_id INT,lender_name VARCHAR(255));CREATE TABLE loans (loan_id INT,lender_id INT,issue_date DATE,loan_amount DECIMAL(10,2),borrower_social_responsibility_score INT,interest_rate DECIMAL(5,2),interest_earned DECIMAL(10,2));INSERT INTO lenders (lender_id,lender_name) VALUES (1,'Lender A'),(2,'L... | SELECT l.lender_name, SUM(l.interest_earned) as total_interest_earned FROM loans l INNER JOIN lenders le ON l.lender_id = le.lender_id WHERE l.issue_date BETWEEN (CURRENT_DATE - INTERVAL '3 months') AND CURRENT_DATE AND l.borrower_social_responsibility_score > 70 GROUP BY l.lender_id; |
What are the names of vessels that have not reported their positions in the past month in the South China Sea? | CREATE TABLE Vessel_Positions (position_date date,vessel_name text,position_location text); | SELECT DISTINCT v.vessel_name FROM Vessel_Positions v LEFT JOIN (SELECT position_date FROM Vessel_Positions WHERE position_date > NOW() - INTERVAL '1 month') AS sub ON v.position_date = sub.position_date WHERE sub.position_date IS NULL AND position_location LIKE '%South China Sea%'; |
What is the minimum number of days it took to remediate vulnerabilities in the 'HR' department? | CREATE TABLE hr_dept_vulnerabilities (id INT,incident_date DATE,department VARCHAR(255),days_to_remediate INT); INSERT INTO hr_dept_vulnerabilities (id,incident_date,department,days_to_remediate) VALUES (1,'2022-01-01','HR',3),(2,'2022-02-01','HR',7),(3,'2022-03-01','HR',5); | SELECT department, MIN(days_to_remediate) FROM hr_dept_vulnerabilities WHERE department = 'HR'; |
What are the top 3 games by total playtime in the 'game_sessions' table, and what is the total playtime for each? | CREATE TABLE games (game_id INT,game_name VARCHAR(50)); INSERT INTO games VALUES (1,'GameA'); INSERT INTO games VALUES (2,'GameB'); INSERT INTO games VALUES (3,'GameC'); CREATE TABLE game_sessions (session_id INT,player_id INT,game_id INT,duration INT); INSERT INTO game_sessions VALUES (1,1,1,12); INSERT INTO game_sess... | SELECT g.game_name, SUM(gs.duration) as total_playtime FROM game_sessions gs JOIN games g ON gs.game_id = g.game_id GROUP BY gs.game_id ORDER BY total_playtime DESC LIMIT 3; |
What is the average annual precipitation for levees in Louisiana? | CREATE TABLE levees (id INT,name TEXT,state TEXT,avg_annual_precipitation FLOAT); INSERT INTO levees (id,name,state,avg_annual_precipitation) VALUES (1,'LA-1 Floodgate','LA',60); | SELECT AVG(avg_annual_precipitation) FROM levees WHERE state = 'LA'; |
Display the recycling rate for each location | CREATE TABLE recycling_rates (id INT PRIMARY KEY,location VARCHAR(50),rate FLOAT); | SELECT location, rate FROM recycling_rates; |
What is the maximum billing amount for clients in the 'los angeles' region? | CREATE TABLE clients (id INT,name TEXT,region TEXT,billing_amount DECIMAL(10,2)); INSERT INTO clients (id,name,region,billing_amount) VALUES (1,'Alice','los angeles',200.00),(2,'Bob','los angeles',300.00),(3,'Charlie','los angeles',400.00); | SELECT MAX(billing_amount) FROM clients WHERE region = 'los angeles'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.