instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Show all contracts that have been negotiated with country Z
CREATE TABLE contract_negotiations (country VARCHAR(255),contract_value INT,negotiation_date DATE); INSERT INTO contract_negotiations (country,contract_value,negotiation_date) VALUES ('Country B',3000000,'2021-01-01'),('Country C',4000000,'2021-02-01'),('Country Z',6000000,'2021-03-01');
SELECT * FROM contract_negotiations WHERE country = 'Country Z';
What is the percentage of autonomous vehicles sold in the state of California?
CREATE TABLE Autonomous_Vehicle_Sales (vehicle VARCHAR(100),state VARCHAR(100),quantity INT); INSERT INTO Autonomous_Vehicle_Sales (vehicle,state,quantity) VALUES ('2020 Tesla Model 3','California',12000),('2021 Ford Mustang Mach-E','California',5000),('2022 Hyundai Kona Electric','California',7000),('2019 Toyota Camry','California',8000),('2020 Tesla Model X','California',10000);
SELECT 100.0 * SUM(CASE WHEN state = 'California' THEN quantity ELSE 0 END) / SUM(quantity) FROM Autonomous_Vehicle_Sales;
How many indigenous communities are present in the 'Arctic_Communities' table, with more than 400 members, and located in Alaska or Russia?
CREATE TABLE Arctic_Communities (ID INT,Name VARCHAR(50),Members INT,Country VARCHAR(50)); INSERT INTO Arctic_Communities VALUES (1,'Inuit_1',700,'Greenland'); INSERT INTO Arctic_Communities VALUES (2,'Inuit_2',350,'Greenland'); INSERT INTO Arctic_Communities VALUES (3,'Inuit_3',800,'Canada'); INSERT INTO Arctic_Communities VALUES (4,'Yupik_1',450,'Alaska'); INSERT INTO Arctic_Communities VALUES (5,'Chukchi_1',600,'Russia');
SELECT COUNT(*) FROM Arctic_Communities WHERE Members > 400 AND (Country = 'Alaska' OR Country = 'Russia');
What is the obesity rate by age group in Canada?
CREATE TABLE Obesity (ID INT,Country VARCHAR(100),AgeGroup VARCHAR(50),ObesityRate FLOAT); INSERT INTO Obesity (ID,Country,AgeGroup,ObesityRate) VALUES (1,'Canada','0-4',11.7);
SELECT AgeGroup, ObesityRate FROM Obesity WHERE Country = 'Canada';
What is the average time to resolution for security incidents in the past month, grouped by their category?
CREATE TABLE incident_resolution(id INT,incident_category VARCHAR(50),resolution_time INT,incident_date DATE);
SELECT incident_category, AVG(resolution_time) as avg_resolution_time FROM incident_resolution WHERE incident_date > DATE(NOW()) - INTERVAL 30 DAY GROUP BY incident_category;
What is the average gas fee for transactions on the Binance Smart Chain network in the past month?
CREATE TABLE binance_smart_chain_transactions (transaction_id TEXT,gas_fee INTEGER,transaction_date DATE);
SELECT AVG(gas_fee) FROM binance_smart_chain_transactions WHERE transaction_date >= DATEADD(month, -1, GETDATE());
What are the names and capacities of all hydroelectric power plants in Brazil?
CREATE TABLE hydro_plants (name TEXT,capacity INTEGER,country TEXT); INSERT INTO hydro_plants (name,capacity,country) VALUES ('Hydro Plant 1',400,'Brazil'),('Hydro Plant 2',500,'Brazil');
SELECT name, capacity FROM hydro_plants WHERE country = 'Brazil'
Identify the total number of intelligence operations and their respective operation types for 'Counterintelligence' and 'Surveillance'.
CREATE TABLE IntelligenceOps (id INT,name VARCHAR(50),description TEXT,operation_type VARCHAR(30)); INSERT INTO IntelligenceOps (id,name,description,operation_type) VALUES (1,'Operation Red Sparrow','A counterterrorism operation in the Middle East.','Counterterrorism'),(2,'Operation Nightfall','A cyber intelligence operation against a foreign government.','Cyber Intelligence'),(3,'Operation Silver Shield','An intelligence operation to gather information about a rogue nation.','Counterintelligence'),(4,'Operation Iron Curtain','An intelligence operation to secure communications.','Surveillance');
SELECT operation_type, COUNT(*) FROM IntelligenceOps WHERE operation_type IN ('Counterintelligence', 'Surveillance') GROUP BY operation_type;
What is the average property tax for properties in each price range?
CREATE TABLE properties (property_id INT,price_range VARCHAR(10),property_tax FLOAT);
SELECT price_range, AVG(property_tax) as avg_property_tax FROM properties GROUP BY price_range;
Delete containers from the 'containers' table that have been in storage for more than 60 days.
CREATE TABLE containers (id INT,content VARCHAR(50),storage_start_date DATE,PRIMARY KEY(id));
DELETE FROM containers WHERE storage_start_date < DATE(NOW()) - INTERVAL 60 DAY;
What was the total number of public services delivered in District I and J in Q2 of 2021 and Q3 of 2022?
CREATE TABLE PublicServices (District VARCHAR(10),Quarter INT,Year INT,ServiceCount INT); INSERT INTO PublicServices VALUES ('District I',2,2021,900),('District I',3,2022,1100),('District J',2,2021,800),('District J',3,2022,1000);
SELECT SUM(ServiceCount) FROM PublicServices WHERE District IN ('District I', 'District J') AND (Quarter = 2 AND Year = 2021 OR Quarter = 3 AND Year = 2022);
Find the number of employees hired in each quarter of 2020
CREATE TABLE Employees (id INT,hire_date DATE);
SELECT DATE_FORMAT(hire_date, '%Y-%m') AS quarter, COUNT(*) FROM Employees WHERE hire_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY quarter;
What's the minimum number of likes for posts by users from Spain in the travel category?
CREATE TABLE users (id INT,country VARCHAR(255),category VARCHAR(255)); INSERT INTO users (id,country,category) VALUES (1,'Spain','travel'); CREATE TABLE posts (id INT,user_id INT,likes INT);
SELECT MIN(posts.likes) FROM posts INNER JOIN users ON posts.user_id = users.id WHERE users.country = 'Spain' AND users.category = 'travel';
Delete fan records that are older than 60 years in the 'fans' table
CREATE TABLE fans (fan_id INT PRIMARY KEY,age INT,gender VARCHAR(10),country VARCHAR(50));
DELETE FROM fans WHERE age > 60;
What is the average response time for public service requests in urban and rural areas of Japan, for the last quarter?
CREATE TABLE ResponseTimes (Area VARCHAR(50),ResponseTime DECIMAL(3,2),RequestDate DATE); INSERT INTO ResponseTimes (Area,ResponseTime,RequestDate) VALUES ('Urban',2.50,'2022-04-01'),('Urban',2.75,'2022-04-02'),('Rural',3.25,'2022-04-01'),('Rural',3.00,'2022-04-02');
SELECT Area, AVG(ResponseTime) as AvgResponseTime FROM ResponseTimes WHERE RequestDate >= DATEADD(quarter, -1, CURRENT_DATE) GROUP BY Area;
What is the total number of clothing items made from sustainable materials?
CREATE TABLE Clothing (id INT,sustainable BOOLEAN); INSERT INTO Clothing VALUES (1,true),(2,false),(3,true),(4,true),(5,false); CREATE TABLE SustainableMaterials (id INT,clothing_id INT,material TEXT); INSERT INTO SustainableMaterials VALUES (1,1,'OrganicCotton'),(2,3,'Tencel'),(3,4,'Hemp'),(4,2,'Bamboo');
SELECT COUNT(*) FROM Clothing INNER JOIN SustainableMaterials ON Clothing.id = SustainableMaterials.clothing_id WHERE Clothing.sustainable = true;
What is the maximum number of art pieces in the museums of Mexico?
CREATE TABLE mexican_museums (id INT,name VARCHAR(50),location VARCHAR(50),num_pieces INT); INSERT INTO mexican_museums (id,name,location,num_pieces) VALUES (1,'Museum 1','Mexico',6000),(2,'Museum 2','United States',7000),(3,'Museum 3','Canada',4000);
SELECT MAX(num_pieces) FROM mexican_museums WHERE location = 'Mexico';
What is the total investment in rural infrastructure projects in the 'Africa' region for the years 2016 and 2017, grouped by project_domain?
CREATE TABLE rural_infrastructure (id INT,project_name VARCHAR(100),project_domain VARCHAR(50),project_location VARCHAR(100),investment FLOAT,start_date DATE,end_date DATE);
SELECT project_domain, SUM(investment) FROM rural_infrastructure WHERE project_location IN ('Africa', 'african_countries') AND YEAR(start_date) BETWEEN 2016 AND 2017 GROUP BY project_domain;
Insert a new record into the 'Grants' table for a grant named 'Grant 2' with a grant amount of $12,000
CREATE TABLE Grants (id INT PRIMARY KEY,grant_name VARCHAR(255),grant_amount DECIMAL(10,2)); INSERT INTO Grants (grant_name,grant_amount) VALUES ('Grant 1',10000.00);
INSERT INTO Grants (grant_name, grant_amount) VALUES ('Grant 2', 12000.00);
List all the drought-affected counties in each state in 2019.
CREATE TABLE drought_impact (county VARCHAR(30),state VARCHAR(20),year INT,impact BOOLEAN);
SELECT state, county FROM drought_impact WHERE year=2019 AND impact=TRUE;
What is the average price of natural products, ranked in ascending order of average price?
CREATE TABLE products (product_id INT,category VARCHAR(20),is_organic BOOLEAN,price DECIMAL(5,2)); INSERT INTO products (product_id,category,is_organic,price) VALUES (1,'Natural',false,15.99),(2,'Organic',true,30.49),(3,'Natural',false,25.99),(4,'Conventional',false,29.99);
SELECT AVG(price) as avg_price, category FROM products WHERE category = 'Natural' GROUP BY category ORDER BY avg_price ASC;
What is the average account balance for high-risk customers?
CREATE TABLE accounts (id INT,risk_level VARCHAR(10),account_balance DECIMAL(10,2)); INSERT INTO accounts (id,risk_level,account_balance) VALUES (1,'high',25000.00),(2,'medium',15000.00),(3,'high',30000.00);
SELECT AVG(account_balance) FROM accounts WHERE risk_level = 'high';
Find the minimum budget for agricultural innovation projects.
CREATE TABLE agricultural_innovation (id INT,project_name VARCHAR(50),location VARCHAR(50),budget FLOAT); INSERT INTO agricultural_innovation (id,project_name,location,budget) VALUES (1,'Organic Farming','Haiti',50000.00);
SELECT MIN(budget) FROM agricultural_innovation;
Monthly sales revenue of organic cosmetics by region?
CREATE TABLE sales_data (sale_id INT,product_id INT,sale_date DATE,organic BOOLEAN,region VARCHAR(50)); INSERT INTO sales_data (sale_id,product_id,sale_date,organic,region) VALUES (1,101,'2022-01-05',true,'North America'),(2,102,'2022-02-10',false,'Europe'),(3,103,'2022-03-15',true,'Asia');
SELECT DATEPART(month, sale_date) as month, region, SUM(CASE WHEN organic THEN 1 ELSE 0 END) as organic_sales FROM sales_data GROUP BY DATEPART(month, sale_date), region;
Which drug categories have the highest and lowest approval rates in the 'approval_dates' and 'drug_categories' tables?
CREATE TABLE approval_dates (drug_name TEXT,approval_date DATE); CREATE TABLE drug_categories (drug_name TEXT,drug_category TEXT); INSERT INTO approval_dates (drug_name,approval_date) VALUES ('DrugA','2018-01-01'),('DrugB','2019-01-01'),('DrugC','2020-01-01'),('DrugD','2021-01-01'); INSERT INTO drug_categories (drug_name,drug_category) VALUES ('DrugA','Antihypertensive'),('DrugB','Antidiabetic'),('DrugC','Lipid-lowering'),('DrugD','Antihypertensive');
SELECT drug_category, COUNT(*) as num_approved, (SELECT COUNT(*) FROM approval_dates WHERE drug_name = dc.drug_name) as total_drugs, 100.0 * COUNT(*) / (SELECT COUNT(*) FROM approval_dates WHERE drug_name = dc.drug_name) as approval_rate FROM drug_categories dc GROUP BY drug_category ORDER BY approval_rate DESC, num_approved DESC, drug_category;
What is the total salary cost of the 'Industry 4.0' department?
CREATE TABLE Employees (EmployeeID INT,Name VARCHAR(50),Department VARCHAR(50),Salary FLOAT); INSERT INTO Employees (EmployeeID,Name,Department,Salary) VALUES (1,'John Doe','Industry 4.0',70000.00); INSERT INTO Employees (EmployeeID,Name,Department,Salary) VALUES (2,'Jane Smith','Industry 4.0',75000.00);
SELECT SUM(Salary) FROM Employees WHERE Department = 'Industry 4.0';
Determine the average cost of all road projects in New York
CREATE TABLE road_projects (id INT,name TEXT,cost FLOAT,location TEXT); INSERT INTO road_projects (id,name,cost,location) VALUES (1,'Road Project A',500000.00,'New York'),(2,'Road Project B',750000.00,'California');
SELECT AVG(cost) FROM road_projects WHERE location = 'New York';
What percentage of digital divide initiatives are led by non-profits?
CREATE TABLE initiatives (id INT,is_non_profit BOOLEAN,initiative_type VARCHAR(255)); INSERT INTO initiatives (id,is_non_profit,initiative_type) VALUES (1,true,'digital_divide'),(2,false,'digital_divide'),(3,true,'accessibility');
SELECT (COUNT(*) FILTER (WHERE is_non_profit = true)) * 100.0 / COUNT(*) FROM initiatives WHERE initiative_type = 'digital_divide';
What is the average cost of spacecraft manufactured in the US?
CREATE TABLE SpacecraftManufacturing(id INT,country VARCHAR(50),cost FLOAT); INSERT INTO SpacecraftManufacturing(id,country,cost) VALUES (1,'USA',20000000),(2,'Canada',15000000),(3,'USA',22000000);
SELECT AVG(cost) FROM SpacecraftManufacturing WHERE country = 'USA';
List the top 3 countries with the most certified green hotels, and the average certification level for each.
CREATE TABLE GreenHotels (HotelID INT,HotelName VARCHAR(50),Country VARCHAR(50),CertificationLevel INT); INSERT INTO GreenHotels (HotelID,HotelName,Country,CertificationLevel) VALUES (1,'GreenPalace','Morocco',5),(2,'EcoLodge','Kenya',4),(3,'SustainableResort','Egypt',3);
SELECT Country, AVG(CertificationLevel) as AvgCertification, COUNT(*) as HotelCount FROM GreenHotels GROUP BY Country ORDER BY HotelCount DESC, AvgCertification DESC LIMIT 3;
What is the total energy consumption of industrial facilities in Canada and Mexico?
CREATE TABLE industrial_facilities (country VARCHAR(20),consumption FLOAT); INSERT INTO industrial_facilities (country,consumption) VALUES ('Canada',5000.0),('Mexico',4000.0),('Canada',5500.0);
SELECT SUM(consumption) FROM industrial_facilities WHERE country IN ('Canada', 'Mexico');
What is the minimum fare for a trip on the Tokyo metro?
CREATE TABLE metro (id INT,line VARCHAR(20),fare DECIMAL(5,2)); INSERT INTO metro (id,line,fare) VALUES (1,'Ginza',170),(2,'Marunouchi',210),(3,'Hibiya',180);
SELECT MIN(fare) FROM metro;
What is the maximum and minimum loan amount for socially responsible lending institutions in Canada?
CREATE TABLE SociallyResponsibleLending (id INT,institution_name VARCHAR(50),country VARCHAR(50),loan_amount FLOAT); INSERT INTO SociallyResponsibleLending (id,institution_name,country,loan_amount) VALUES (1,'ACME Socially Responsible Lending','Canada',9000),(2,'XYZ Socially Responsible Lending','Canada',12000),(3,'Community Development Lending','Canada',15000);
SELECT country, MAX(loan_amount) as max_loan_amount, MIN(loan_amount) as min_loan_amount FROM SociallyResponsibleLending WHERE country = 'Canada' GROUP BY country;
What is the total quantity of ethically sourced products in the electronics category?
CREATE TABLE products (product_id INT,is_ethical BOOLEAN,category VARCHAR(20),quantity INT); INSERT INTO products (product_id,is_ethical,category,quantity) VALUES (1,true,'Electronics',100),(2,false,'Clothing',50),(3,true,'Electronics',200);
SELECT SUM(products.quantity) FROM products WHERE products.is_ethical = true AND products.category = 'Electronics';
List all the cases in the Southeast region that involved a female defendant and the sentence length.
CREATE TABLE cases (id INT,defendant_gender VARCHAR(10),sentence_length INT,region VARCHAR(20)); INSERT INTO cases (id,defendant_gender,sentence_length,region) VALUES (1,'Female',36,'Southeast'),(2,'Male',48,'Northeast');
SELECT cases.defendant_gender, cases.sentence_length FROM cases WHERE cases.region = 'Southeast' AND cases.defendant_gender = 'Female';
Insert the following records into the 'autonomous_driving_research' table: 'Baidu' with 'China', 'NVIDIA' with 'USA', 'Tesla' with 'USA'
CREATE TABLE autonomous_driving_research (id INT PRIMARY KEY,company VARCHAR(255),country VARCHAR(255));
INSERT INTO autonomous_driving_research (company, country) VALUES ('Baidu', 'China'), ('NVIDIA', 'USA'), ('Tesla', 'USA');
How many vessels have been inspected for illegal fishing activities in the Arctic region in the last 5 years?"
CREATE TABLE vessels (vessel_id INTEGER,vessel_name TEXT,last_inspection_date DATE); CREATE TABLE arctic_region (region_name TEXT,region_description TEXT); CREATE TABLE inspection_results (inspection_id INTEGER,vessel_id INTEGER,inspection_date DATE,result TEXT);
SELECT COUNT(v.vessel_id) FROM vessels v INNER JOIN arctic_region ar ON v.last_inspection_date >= (CURRENT_DATE - INTERVAL '5 years') AND ar.region_name = 'Arctic' INNER JOIN inspection_results ir ON v.vessel_id = ir.vessel_id;
What is the total installed capacity of renewable energy in Canada, Brazil, and India, and which one has the highest capacity?
CREATE TABLE renewable_energy (country VARCHAR(20),source VARCHAR(20),capacity INT); INSERT INTO renewable_energy (country,source,capacity) VALUES ('Canada','Solar',50000),('Canada','Wind',40000),('Brazil','Solar',60000),('Brazil','Wind',50000),('India','Solar',70000),('India','Wind',60000);
SELECT r1.country, SUM(r1.capacity) as total_capacity FROM renewable_energy r1 WHERE r1.country IN ('Canada', 'Brazil', 'India') GROUP BY r1.country;
List the top 10 customers with the highest account balances in the Northeast region.
CREATE TABLE customers (customer_id INT,name VARCHAR(50),region VARCHAR(20),account_balance DECIMAL(10,2));
SELECT name, account_balance FROM customers WHERE region = 'Northeast' ORDER BY account_balance DESC LIMIT 10;
What is the minimum founding year for companies founded by Indigenous entrepreneurs in the foodtech sector?
CREATE TABLE companies (company_id INT,company_name TEXT,industry TEXT,founding_year INT,founder_race TEXT); INSERT INTO companies (company_id,company_name,industry,founding_year,founder_race) VALUES (1,'NativeBites','Foodtech',2013,'Indigenous');
SELECT MIN(founding_year) FROM companies WHERE industry = 'Foodtech' AND founder_race = 'Indigenous';
Display all artifacts from a specific excavation site
CREATE TABLE ExcavationSites (SiteID int,Name varchar(50),Country varchar(50),StartDate date); INSERT INTO ExcavationSites (SiteID,Name,Country,StartDate) VALUES (3,'Site C','Mexico','2009-09-09'); CREATE TABLE Artifacts (ArtifactID int,SiteID int,Name varchar(50),Description text,DateFound date); INSERT INTO Artifacts (ArtifactID,SiteID,Name,Description,DateFound) VALUES (3,3,'Artifact Z','A Mexican artifact','2016-06-06');
SELECT a.* FROM Artifacts a INNER JOIN ExcavationSites es ON a.SiteID = es.SiteID WHERE es.SiteID = 3;
What is the maximum word count of articles published in the 'sports' section?
CREATE TABLE articles (id INT,section VARCHAR(255),word_count INT,date DATE);
SELECT MAX(word_count) FROM articles WHERE section='sports';
What is the average crime clearance rate for each officer?
CREATE TABLE Officers (OfficerID INT,Name VARCHAR(50)); CREATE TABLE Crimes (CrimeID INT,OfficerID INT,ClearanceRate DECIMAL(10,2));
SELECT O.Name, AVG(C.ClearanceRate) as AvgClearanceRate FROM Officers O INNER JOIN Crimes C ON O.OfficerID = C.OfficerID GROUP BY O.Name;
What is the total budget spent on disability support programs for individuals with mobility impairments?
CREATE TABLE Individuals (id INT,impairment TEXT,budget DECIMAL(10,2)); INSERT INTO Individuals (id,impairment,budget) VALUES (1,'Mobility',15000.00),(2,'Visual',10000.00),(3,'Hearing',12000.00);
SELECT SUM(budget) FROM Individuals WHERE impairment = 'Mobility';
What is the average valuation for companies founded by veterans, in each industry category?
CREATE TABLE company (id INT,name TEXT,founder TEXT,industry TEXT,valuation INT); INSERT INTO company (id,name,founder,industry,valuation) VALUES (1,'Acme Inc','Veteran','Tech',5000000);
SELECT industry, AVG(valuation) FROM company WHERE founder LIKE '%Veteran%' GROUP BY industry;
What was the total quantity of products sold in each category?
CREATE TABLE sales (sale_id int,product_id int,quantity int,date date); INSERT INTO sales (sale_id,product_id,quantity,date) VALUES (1,1,10,'2021-01-01'),(2,2,15,'2021-01-02'),(3,1,12,'2021-01-03'),(4,3,20,'2021-01-04'),(5,4,18,'2021-01-05'); CREATE TABLE products (product_id int,product_name varchar(255),category varchar(255),price decimal(10,2),quantity int); INSERT INTO products (product_id,product_name,category,price,quantity) VALUES (1,'Product A','Category X',150.00,200),(2,'Product B','Category Y',250.00,150),(3,'Product C','Category X',100.00,300),(4,'Product D','Category Y',200.00,250);
SELECT p.category, SUM(s.quantity) as total_quantity_sold FROM sales s JOIN products p ON s.product_id = p.product_id GROUP BY p.category;
List all habitats where the tiger population is greater than 1000
CREATE TABLE if not exists animal_population (id INT,animal VARCHAR(255),country VARCHAR(255),population INT); INSERT INTO animal_population (id,animal,country,population) VALUES (1,'Tiger','India',2500),(2,'Tiger','Bangladesh',150),(3,'Tiger','Russia',1200),(4,'Tiger','Nepal',300);
SELECT DISTINCT habitat FROM habitat_info h INNER JOIN animal_population ap ON h.habitat = ap.habitat WHERE ap.animal = 'Tiger' AND ap.population > 1000;
What are the bus routes that intersect with tram routes?
CREATE TABLE BusRoutes (id INT,route VARCHAR(20)); CREATE TABLE TramRoutes (id INT,route VARCHAR(20)); INSERT INTO BusRoutes (id,route) VALUES (1,'Route1'),(2,'Route2'),(3,'Route3'); INSERT INTO TramRoutes (id,route) VALUES (1,'Route1'),(2,'Route4'),(3,'Route5');
SELECT BusRoutes.route FROM BusRoutes INNER JOIN TramRoutes ON BusRoutes.route = TramRoutes.route;
Identify animal populations with decreasing trends over the last 3 years
CREATE TABLE animal_population (year INT,animal_name VARCHAR(255),population INT); INSERT INTO animal_population (year,animal_name,population) VALUES (2019,'Tiger',200),(2020,'Tiger',180),(2021,'Tiger',160),(2019,'Elephant',300),(2020,'Elephant',280),(2021,'Elephant',260),(2019,'Crane',150),(2020,'Crane',140),(2021,'Crane',130);
SELECT animal_name, population, LAG(population) OVER (PARTITION BY animal_name ORDER BY year) as previous_population FROM animal_population WHERE year > 2019 AND population < previous_population;
Delete all records of smart contracts with a name starting with 'SC_' from the smart_contracts table.
CREATE TABLE smart_contracts (id INT,name VARCHAR(100),code VARCHAR(1000),creation_date DATE); INSERT INTO smart_contracts (id,name,code,creation_date) VALUES (1,'SC_123','0x123...','2017-01-01'); INSERT INTO smart_contracts (id,name,code,creation_date) VALUES (2,'OtherSC','0x456...','2018-05-05');
DELETE FROM smart_contracts WHERE name LIKE 'SC_%';
What is the total number of military personnel in the 'army' branch, for countries in the 'Americas' region, with a rank of 'colonel' or higher?
CREATE TABLE military_personnel (id INT,name TEXT,rank TEXT,branch TEXT,country TEXT,region TEXT); INSERT INTO military_personnel (id,name,rank,branch,country,region) VALUES (1,'John Doe','colonel','army','USA','Americas');
SELECT COUNT(*) FROM military_personnel WHERE branch = 'army' AND region = 'Americas' AND rank >= 'colonel';
What is the average rating of movies produced in 2005 or later, grouped by genre?
CREATE TABLE movies (id INT,title VARCHAR(100),release_year INT,rating DECIMAL(2,1),genre VARCHAR(50)); INSERT INTO movies (id,title,release_year,rating,genre) VALUES (1,'Movie1',2006,8.5,'Action'),(2,'Movie2',2008,7.2,'Comedy'),(3,'Movie3',2003,6.9,'Drama');
SELECT genre, AVG(rating) FROM movies WHERE release_year >= 2005 GROUP BY genre;
What is the average funding round size for companies founded by women?
CREATE TABLE company (id INT,name TEXT,founding_year INT,founder_gender TEXT); INSERT INTO company (id,name,founding_year,founder_gender) VALUES (1,'Acme Inc',2010,'female'); INSERT INTO company (id,name,founding_year,founder_gender) VALUES (2,'Beta Corp',2015,'male');
SELECT AVG(funding_round_size) FROM investment_rounds INNER JOIN company ON investment_rounds.company_id = company.id WHERE company.founder_gender = 'female';
What is the total amount of donations for each sector in 2019?
CREATE TABLE Donations (DonationID int,Sector varchar(50),Amount int,Year int); INSERT INTO Donations (DonationID,Sector,Amount,Year) VALUES (1,'Health',1000,2018),(2,'Education',2000,2019),(3,'Health',1500,2019),(4,'Infrastructure',500,2018);
SELECT s.Sector, SUM(d.Amount) AS TotalDonations FROM Donations d RIGHT JOIN (SELECT DISTINCT Sector FROM Donations WHERE Year = 2019) s ON d.Sector = s.Sector GROUP BY s.Sector;
Which fashion trends are popular among plus-size customers in the US?
CREATE TABLE FashionTrends (trend_id INT,trend_name VARCHAR(50),popularity INT); CREATE TABLE CustomerSizes (customer_id INT,customer_country VARCHAR(50),size_category VARCHAR(50)); INSERT INTO FashionTrends (trend_id,trend_name,popularity) VALUES (1,'Oversized Clothing',80),(2,'Wide-Leg Pants',70),(3,'Boho Dresses',65); INSERT INTO CustomerSizes (customer_id,customer_country,size_category) VALUES (1,'USA','Plus Size'),(2,'Canada','Regular Size'),(3,'USA','Regular Size');
SELECT f.trend_name, c.size_category FROM FashionTrends f INNER JOIN CustomerSizes c ON f.popularity > 75 WHERE c.customer_country = 'USA' AND c.size_category = 'Plus Size';
What is the average duration of teletherapy sessions for patients with anxiety in Illinois in Q2 2022?
CREATE TABLE teletherapy_sessions (patient_id INT,condition VARCHAR(20),duration INT,state VARCHAR(20),quarter INT,year INT); INSERT INTO teletherapy_sessions VALUES (1,'Anxiety',60,'Illinois',2,2022),(2,'Depression',45,'Illinois',2,2022),(3,'Anxiety',45,'Illinois',2,2022);
SELECT AVG(duration) FROM teletherapy_sessions WHERE condition = 'Anxiety' AND state = 'Illinois' AND quarter = 2 AND year = 2022;
What is the total quantity of military equipment sold by each salesperson, ordered by the highest sales?
CREATE TABLE salesperson (salesperson_id INT,name VARCHAR(50),region VARCHAR(50)); INSERT INTO salesperson VALUES (1,'John Doe','East Coast'); INSERT INTO salesperson VALUES (2,'Jane Smith','West Coast'); CREATE TABLE military_equipment_sales (sale_id INT,salesperson_id INT,equipment_type VARCHAR(50),quantity INT,sale_date DATE); INSERT INTO military_equipment_sales VALUES (1,1,'Tanks',10,'2021-01-01'); INSERT INTO military_equipment_sales VALUES (2,1,'Aircraft',15,'2021-01-05'); INSERT INTO military_equipment_sales VALUES (3,2,'Helicopters',8,'2021-01-08');
SELECT salesperson_id, name, SUM(quantity) as total_quantity FROM military_equipment_sales mES JOIN salesperson s ON mES.salesperson_id = s.salesperson_id GROUP BY salesperson_id, name ORDER BY total_quantity DESC;
Which explainable AI techniques were applied in the past year for natural language processing tasks, in the Explainable AI database?
CREATE TABLE techniques (id INT,name VARCHAR(255),domain VARCHAR(255),published_date DATE);
SELECT name FROM techniques WHERE domain = 'Natural Language Processing' AND YEAR(published_date) = YEAR(CURRENT_DATE());
What is the total number of electric vehicles sold in each country?
CREATE TABLE ElectricVehicles (Make VARCHAR(50),Model VARCHAR(50),Year INT,Country VARCHAR(50),Sales INT);
SELECT Country, SUM(Sales) AS TotalSales FROM ElectricVehicles GROUP BY Country;
What is the total number of posts containing the hashtag #art, by users from Brazil, in the last week?
CREATE TABLE users (id INT,country VARCHAR(255)); CREATE TABLE posts (id INT,user_id INT,hashtags TEXT,post_date DATE);
SELECT COUNT(*) FROM posts INNER JOIN users ON posts.user_id = users.id WHERE users.country = 'Brazil' AND hashtags LIKE '%#art%' AND post_date >= DATE(NOW()) - INTERVAL 1 WEEK;
Find the number of unique users who prefer matte finish lipsticks.
CREATE TABLE user_preference (id INT,user_id INT,product_id INT,finish VARCHAR(50),PRIMARY KEY (id)); INSERT INTO user_preference (id,user_id,product_id,finish) VALUES (1,1,1,'Matte'),(2,2,1,'Matte'),(3,3,2,'Gloss');
SELECT COUNT(DISTINCT user_id) as unique_users FROM user_preference WHERE finish = 'Matte';
Delete all dispensaries from the state of 'OR'.
CREATE TABLE dispensaries (id INT,name TEXT,state TEXT,revenue FLOAT); INSERT INTO dispensaries (id,name,state,revenue) VALUES (1,'Dispensary A','CA',200000.00),(2,'Dispensary B','CA',300000.00),(3,'Dispensary C','OR',400000.00),(4,'Dispensary D','OR',500000.00),(5,'Dispensary E','WA',600000.00),(6,'Dispensary F','WA',700000.00);
DELETE FROM dispensaries WHERE state = 'OR';
What is the average speed of all electric vehicles in the city of Seattle?
CREATE TABLE EVs (id INT,make VARCHAR(50),model VARCHAR(50),year INT,city VARCHAR(50),avg_speed DECIMAL(5,2));
SELECT AVG(avg_speed) FROM EVs WHERE city = 'Seattle' AND make = 'Tesla';
What is the total quantity of 'Fair Trade Coffee' sold yesterday?
CREATE TABLE beverages (id INT,name VARCHAR(255),qty_sold INT); INSERT INTO beverages (id,name,qty_sold) VALUES (1,'Fair Trade Coffee',120),(2,'Organic Juice',150),(3,'Smoothies',180); CREATE TABLE date (id INT,date DATE); INSERT INTO date (id,date) VALUES (1,'2022-03-14'),(2,'2022-03-15'),(3,'2022-03-16');
SELECT SUM(qty_sold) AS total_qty_sold FROM beverages WHERE name = 'Fair Trade Coffee' AND date IN (SELECT date FROM date WHERE date = CURDATE() - INTERVAL 1 DAY);
Update the address of the volunteer with ID 1001
CREATE TABLE volunteers (volunteer_id INT,name TEXT,address TEXT); INSERT INTO volunteers (volunteer_id,name,address) VALUES (1001,'John Doe','123 Main St');
UPDATE volunteers SET address = '456 Elm St' WHERE volunteer_id = 1001;
What is the minimum age of attendees who visited the museum last year?
CREATE TABLE MuseumAttendees (attendeeID INT,visitDate DATE,age INT); INSERT INTO MuseumAttendees (attendeeID,visitDate,age) VALUES (1,'2022-02-03',35),(2,'2022-08-17',42),(3,'2022-12-25',28);
SELECT MIN(age) FROM MuseumAttendees WHERE visitDate >= '2022-01-01' AND visitDate <= '2022-12-31';
Identify suppliers with the least price volatility and their average price change.
CREATE TABLE suppliers (supplier_id INT,supplier_name VARCHAR(255),product_price INT); CREATE VIEW supplier_price_changes AS SELECT supplier_id,product_price,LAG(product_price,30) OVER (PARTITION BY supplier_id ORDER BY order_date) as prev_price FROM orders;
SELECT s.supplier_name, AVG(ABS(spc.product_price - spc.prev_price)) as avg_price_change FROM suppliers s INNER JOIN supplier_price_changes spc ON s.supplier_id = spc.supplier_id GROUP BY s.supplier_name ORDER BY avg_price_change ASC LIMIT 10;
What is the total budget for bridges in Illinois that have a length greater than 500 meters?
CREATE TABLE bridges (id INT,name TEXT,state TEXT,budget FLOAT,length INT); INSERT INTO bridges (id,name,state,budget,length) VALUES (1,'IL-1 River Bridge','IL',15000000,600);
SELECT SUM(budget) FROM bridges WHERE state = 'IL' AND length > 500;
Insert a new record for a public library in the state of Washington with a satisfaction score of 9.
CREATE TABLE services (state VARCHAR(20),service_type VARCHAR(50),satisfaction_score INT);
INSERT INTO services (state, service_type, satisfaction_score) VALUES ('Washington', 'public_library', 9);
What is the average value of investments made in the 'Healthcare' sector?
CREATE TABLE investments (id INT,sector VARCHAR(20),date DATE,value FLOAT); INSERT INTO investments (id,sector,date,value) VALUES (1,'Technology','2018-01-01',100000.0),(2,'Finance','2016-01-01',75000.0),(3,'Healthcare','2017-01-01',150000.0),(4,'Healthcare','2018-01-01',50000.0);
SELECT AVG(value) FROM investments WHERE sector = 'Healthcare';
What's the total number of ethical AI projects by organizations from the UK?
CREATE TABLE ai_ethics (id INT,project VARCHAR(50),organization VARCHAR(50),country VARCHAR(50),start_date DATE,end_date DATE); INSERT INTO ai_ethics (id,project,organization,country,start_date,end_date) VALUES (2,'Ethical AI Implementation','AI Pioneers','UK','2020-01-01','2020-12-31');
SELECT organization, COUNT(*) as total_projects FROM ai_ethics WHERE country = 'UK' GROUP BY organization;
List the top 5 most expensive ticket sales
CREATE TABLE ticket_sales (ticket_id INT,team_id INT,price DECIMAL(5,2)); INSERT INTO ticket_sales (ticket_id,team_id,price) VALUES (1,1,75.50),(2,1,85.20),(3,2,65.00),(4,2,75.00),(5,3,100.00),(6,3,120.00);
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY price DESC) AS rank, ticket_id, team_id, price FROM ticket_sales) tmp WHERE rank <= 5;
Insert a new organization focused on animal rights and effective altruism with id 5.
CREATE TABLE organizations (id INT,name VARCHAR(255),focus VARCHAR(255)); INSERT INTO organizations (id,name,focus) VALUES (3,'Climate Foundation','Climate Change');
INSERT INTO organizations (id, name, focus) VALUES (5, 'Animal Rights Effective Altruism', 'Animal Rights, Effective Altruism');
What are the names of unions with the highest and lowest membership counts?
CREATE TABLE unions (id INT PRIMARY KEY,name VARCHAR(255),member_count INT); INSERT INTO unions (id,name,member_count) VALUES (1,'Union A',3000),(2,'Union B',5000),(3,'Union C',2000);
SELECT name FROM unions WHERE member_count = (SELECT MAX(member_count) FROM unions) UNION SELECT name FROM unions WHERE member_count = (SELECT MIN(member_count) FROM unions);
How many food safety violations were recorded in the past year?
CREATE TABLE Inspections (id INT,date DATE,violation BOOLEAN);
SELECT COUNT(*) FROM Inspections WHERE date >= DATEADD(year, -1, GETDATE()) AND violation = TRUE;
Find the number of members who did workouts on the same day they joined.
CREATE TABLE membership_data (member_id INT,join_date DATE); CREATE TABLE workout_data (workout_id INT,member_id INT,workout_date DATE);
SELECT COUNT(*) FROM (SELECT m.member_id FROM membership_data m JOIN workout_data w ON m.member_id = w.member_id WHERE m.join_date = w.workout_date) as same_day_workouts;
Insert a new volunteer 'Eva' who participated in the 'Arts & Culture' program in April 2022.
CREATE TABLE Programs (ProgramID int,Name varchar(50),Budget money); CREATE TABLE Volunteers (VolunteerID int,Name varchar(50),Age int,ProgramID int,VolunteerDate date); INSERT INTO Programs (ProgramID,Name,Budget) VALUES (1,'Education',10000),(2,'Healthcare',15000),(3,'Arts & Culture',9000); INSERT INTO Volunteers (VolunteerID,Name,Age,ProgramID,VolunteerDate) VALUES (1,'Alice',25,1,'2022-01-01'),(2,'Bob',22,1,'2022-01-15'),(3,'Charlie',30,2,'2022-03-01'),(4,'David',28,2,'2022-03-10');
INSERT INTO Volunteers (VolunteerID, Name, Age, ProgramID, VolunteerDate) VALUES (5, 'Eva', 35, 3, '2022-04-15');
What is the average GDP growth rate of countries in Europe?
CREATE TABLE gdp_growth (country VARCHAR(50),region VARCHAR(50),gdp_growth_rate FLOAT); INSERT INTO gdp_growth (country,region,gdp_growth_rate) VALUES ('Germany','Europe',2.2),('France','Europe',1.8),('United Kingdom','Europe',1.4),('Italy','Europe',0.3),('Spain','Europe',2.6),('Russia','Europe',1.7),('Poland','Europe',4.6),('Netherlands','Europe',2.9);
SELECT AVG(gdp_growth_rate) FROM gdp_growth WHERE region = 'Europe';
Show all records in the 'social_good' table
CREATE TABLE social_good (organization VARCHAR(255),initiative VARCHAR(255)); INSERT INTO social_good (organization,initiative) VALUES ('CodeForAmerica','Civic Technology'),('BlackGirlsCode','Digital Literacy'),('CodeForAmerica','Data Science');
SELECT * FROM social_good;
What was the average rural infrastructure expenditure per capita in Africa in 2020?
CREATE TABLE rural_infrastructure (country VARCHAR(50),year INT,population INT,expenditure FLOAT); INSERT INTO rural_infrastructure (country,year,population,expenditure) VALUES ('Nigeria',2020,200000000,2000000000),('South Africa',2020,60000000,1200000000),('Egypt',2020,100000000,1500000000),('Kenya',2020,50000000,750000000),('Ghana',2020,30000000,900000000);
SELECT country, AVG(expenditure/population) as avg_expenditure_per_capita FROM rural_infrastructure WHERE year = 2020 GROUP BY country;
List all cultural heritage sites in Japan with their respective tourism revenue.
CREATE TABLE cultural_sites (site_id INT,site_name TEXT,country TEXT,revenue INT); INSERT INTO cultural_sites (site_id,site_name,country,revenue) VALUES (1,'Mount Fuji','Japan',15000000),(2,'Himeji Castle','Japan',8000000);
SELECT site_name, revenue FROM cultural_sites WHERE country = 'Japan';
What is the total oil and gas production in the Arabian Sea for each year?
CREATE TABLE total_production (year INT,region VARCHAR(255),oil_quantity INT,gas_quantity INT); INSERT INTO total_production (year,region,oil_quantity,gas_quantity) VALUES (2015,'Arabian Sea',1230000,2300000),(2016,'Arabian Sea',1500000,2600000),(2017,'Arabian Sea',1750000,2900000),(2018,'Arabian Sea',1900000,3200000),(2019,'Arabian Sea',2100000,3500000);
SELECT year, SUM(oil_quantity + gas_quantity) FROM total_production WHERE region = 'Arabian Sea' GROUP BY year;
What is the total energy generated by wind farms in Germany and France?
CREATE TABLE wind_farms (id INT,country VARCHAR(255),energy_generated FLOAT); INSERT INTO wind_farms (id,country,energy_generated) VALUES (1,'Germany',1234.56),(2,'France',6543.21);
SELECT SUM(energy_generated) FROM wind_farms WHERE country IN ('Germany', 'France');
What is the earliest biosensor reading per sensor type and per day, ordered by day?
CREATE SCHEMA if not exists biosensors;CREATE TABLE if not exists biosensors.readings (id INT PRIMARY KEY,sensor_id INT,sensor_type VARCHAR(50),reading DECIMAL(10,2),read_date DATE); INSERT INTO biosensors.readings (id,sensor_id,sensor_type,reading,read_date) VALUES (1,1,'Temp',25.5,'2022-02-01'),(2,2,'Humidity',45.3,'2022-02-01'),(3,1,'Temp',26.2,'2022-02-02'),(4,3,'Pressure',1200.5,'2022-02-02');
SELECT sensor_type, MIN(read_date) AS min_read_date FROM biosensors.readings WINDOW W AS (PARTITION BY sensor_type ORDER BY read_date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) GROUP BY sensor_type, W.read_date ORDER BY min_read_date;
What is the total number of animals in all habitats?
CREATE TABLE habitat (type TEXT,animal_count INTEGER); INSERT INTO habitat (type,animal_count) VALUES ('Forest',30),('Grassland',25),('Wetland',45);
SELECT SUM(animal_count) FROM habitat;
What is the landfill capacity in cubic meters for the year 2021 for District C?
CREATE TABLE landfills (landfill_id INT,district_name TEXT,capacity_cubic_meters INT,year INT); INSERT INTO landfills (landfill_id,district_name,capacity_cubic_meters,year) VALUES (1,'District A',10000,2021),(2,'District B',15000,2021),(3,'District C',20000,2021);
SELECT capacity_cubic_meters FROM landfills WHERE district_name = 'District C' AND year = 2021;
Update the fairness category of a model to 'Bias' if its fairness score is lower than 0.7.
CREATE TABLE fairness_data (id INT PRIMARY KEY,model_id INT,fairness_score DECIMAL(5,4),fairness_category VARCHAR(50),measurement_date DATE); INSERT INTO fairness_data (id,model_id,fairness_score,fairness_category,measurement_date) VALUES (1,1,0.8765,'Demographics','2021-01-15'),(2,2,0.6321,'Performance','2021-01-15');
UPDATE fairness_data SET fairness_category = 'Bias' WHERE fairness_score < 0.7;
Find the top 3 countries with the most marine protected areas by area.
CREATE TABLE marine_protected_areas (area_name TEXT,country TEXT,area REAL);
SELECT country, SUM(area) FROM marine_protected_areas GROUP BY country ORDER BY SUM(area) DESC LIMIT 3;
What was the total financial wellbeing program budget for each organization in Oceania that launched programs before 2018, and what was the average budget per program for each organization?
CREATE TABLE FinancialWellbeingOCE (org_name VARCHAR(50),location VARCHAR(50),launch_date DATE,budget DECIMAL(10,2),num_programs INT);
SELECT org_name, AVG(budget) as avg_budget, SUM(budget) as total_budget FROM FinancialWellbeingOCE WHERE location = 'Oceania' AND launch_date < '2018-01-01' GROUP BY org_name;
What is the age of the youngest reader?
CREATE TABLE readers (id INT,name VARCHAR(50),age INT,gender VARCHAR(10),country VARCHAR(50));
SELECT MIN(age) FROM readers;
List the names of models with a safety score below 0.75, ordered by safety score.
CREATE TABLE model_scores (model_id INT,name VARCHAR(50),safety FLOAT); INSERT INTO model_scores (model_id,name,safety) VALUES (1,'ModelA',0.91),(2,'ModelB',0.68),(3,'ModelC',0.87),(4,'ModelD',0.59),(5,'ModelE',0.71);
SELECT name FROM model_scores WHERE safety < 0.75 ORDER BY safety DESC;
What is the minimum depth of all deep-sea exploration sites?
CREATE TABLE deep_sea_exploration (site_id INT,name VARCHAR(255),depth FLOAT); INSERT INTO deep_sea_exploration (site_id,name,depth) VALUES (1,'Atlantis',5000.0),(2,'Challenger Deep',10994.0),(3,'Sirena Deep',8098.0);
SELECT MIN(depth) FROM deep_sea_exploration;
List all tables and views in the 'telecom' schema
CREATE SCHEMA telecom; CREATE TABLE mobile_subscribers (id INT,name TEXT,data_plan TEXT); CREATE VIEW broadband_subscribers AS SELECT * FROM subscribers WHERE type = 'broadband'; CREATE TABLE network_investments (year INT,amount FLOAT); CREATE TABLE compliance_reports (quarter INT,filed BOOLEAN);
SELECT * FROM information_schema.tables WHERE table_schema = 'telecom';
Delete records of drugs not approved by the FDA
CREATE TABLE drugs (drug_id INT,drug_name VARCHAR(50),fda_approval BOOLEAN); INSERT INTO drugs (drug_id,drug_name,fda_approval) VALUES (1,'DrugA',true),(2,'DrugB',false),(3,'DrugC',true)
DELETE FROM drugs WHERE fda_approval = false
What is the total number of 'construction' union members who joined after 2015?
CREATE TABLE construction_union_members (member_id INT,union VARCHAR(20),join_date DATE); INSERT INTO construction_union_members (member_id,union,join_date) VALUES (1,'Construction','2016-01-01'); INSERT INTO construction_union_members (member_id,union,join_date) VALUES (2,'Construction','2014-01-01');
SELECT COUNT(*) FROM construction_union_members WHERE YEAR(join_date) > 2015;
What was the revenue generated from users in the United States for the "sports" category in Q2 of 2021?
CREATE TABLE ads (id INT,user_id INT,category VARCHAR(255),revenue FLOAT,country VARCHAR(255),date DATE); INSERT INTO ads (id,user_id,category,revenue,country,date) VALUES (1,123,'sports',150.50,'USA','2021-04-01'); INSERT INTO ads (id,user_id,category,revenue,country,date) VALUES (2,456,'games',100.00,'USA','2021-04-02');
SELECT SUM(revenue) FROM ads WHERE country = 'USA' AND category = 'sports' AND date BETWEEN '2021-04-01' AND '2021-06-30';
What is the total quantity of mineral X extracted from the 'north' region in the year 2021?'
CREATE TABLE extraction (id INT,region TEXT,mineral TEXT,year INT,quantity INT); INSERT INTO extraction (id,region,mineral,year,quantity) VALUES (1,'north','X',2021,500),(2,'north','X',2020,550),(3,'south','X',2021,600);
SELECT SUM(quantity) FROM extraction WHERE region = 'north' AND mineral = 'X' AND year = 2021;
List dishes with a price above the average price of vegan dishes.
CREATE TABLE dishes (id INT,name TEXT,type TEXT,price DECIMAL); INSERT INTO dishes (id,name,type,price) VALUES (1,'Quinoa Salad','Vegan',12.99),(2,'Chickpea Curry','Vegan',10.99),(3,'Beef Burger','Non-Vegan',15.99);
SELECT name, price FROM dishes WHERE type = 'Vegan' AND price > (SELECT AVG(price) FROM dishes WHERE type = 'Vegan');
What is the total distance run by each athlete in the last 7 days?
CREATE TABLE runs (athlete VARCHAR(50),date DATE,distance FLOAT); INSERT INTO runs (athlete,date,distance) VALUES ('Smith','2022-01-01',10),('Smith','2022-01-02',12),('Jones','2022-01-01',8),('Jones','2022-01-02',9);
SELECT athlete, SUM(distance) AS total_distance FROM runs WHERE date >= DATEADD(day, -7, GETDATE()) GROUP BY athlete
What is the total number of shared bicycles available in Madrid?
CREATE TABLE shared_bicycles (bicycle_id INT,station_id INT,availability_status TEXT,availability_time TIMESTAMP);
SELECT COUNT(*) FROM shared_bicycles WHERE availability_status = 'available' AND station_id IN (SELECT station_id FROM station_information WHERE city = 'Madrid');