Chinastark/bird_dataset huggingface dataset:
Database: regional_sales
Question: How many states located in the Midwest region?
SQL: SELECT count(DISTINCT t) FROM ( SELECT CASE  WHEN region = 'Midwest' THEN statecode ELSE NULL END AS t FROM regions ) WHERE t IS NOT NULL
Database: regional_sales
Question: List out the product name of order which has unit cost of 781.22.
SQL: SELECT t FROM ( SELECT DISTINCT iif(sales orders.`unit cost` = 781.22, products.`product name`, NULL) AS t FROM `sales orders` sales orders INNER JOIN products products ON products.productid = sales orders._productid ) WHERE t IS NOT NULL
Database: regional_sales
Note: Cookware is the name of the product;
Question: State the delivery date of cookware.
SQL: SELECT t FROM ( SELECT DISTINCT iif(products.`product name` = 'Cookware', sales orders.deliverydate, NULL) AS t FROM `sales orders` sales orders INNER JOIN products products ON products.productid = sales orders._productid ) WHERE t IS NOT NULL
Database: regional_sales
Note: furniture cushions orders refer to ordernumber where product name = 'Furniture Cushions'; date of order in 2018 refers to SUBSTR(orderdate, -2) = '18';
Question: How many furniture cushions orders which have date of order in 2018?
SQL: SELECT sum(CASE WHEN sales orders.orderdate LIKE '%/%/18' AND products.`product name` = 'Furniture Cushions' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid
Database: regional_sales
Note: applied 10% discount refers to discount applied = 0.1;
Question: List out the name of products which have been applied 10% discount.
SQL: SELECT t FROM ( SELECT DISTINCT iif(sales orders.`discount applied` = 0.1, products.`product name`, NULL) AS t FROM `sales orders` sales orders INNER JOIN products products ON products.productid = sales orders._productid ) WHERE t IS NOT NULL
Database: regional_sales
Note: net profit can be computed as SUBTRACT(unit price, unit cost); AVG(net profit) where product name = 'Phones' and sales channel = 'Distributor';
Question: Calculate the average net profit of phones which have sales channel of distributor.
SQL: SELECT sum(replace(sales orders.`unit price`, ',', '') - replace(sales orders.`unit cost`, ',', '')) / count(sales orders.ordernumber) FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE products.`product name` = 'Phones' AND sales orders.`sales channel` = 'Distributor'
Database: regional_sales
Note: net profit can be computed as SUBTRACT(unit price, unit cost); AVG(net profit) where product name = 'Bar Tools' and order quantity > 5;
Question: Calculate the average net profit of bar tools which has ordered quantity exceed 5.
SQL: SELECT sum(replace(sales orders.`unit price`, ',', '') - replace(sales orders.`unit cost`, ',', '')) / count(sales orders.ordernumber) FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE products.`product name` = 'Bar Tools' AND sales orders.`order quantity` > 5
Database: regional_sales
Question: List out the city name of states located in South region.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN regions.region = 'South' THEN store locations.`city name` END AS t FROM regions regions INNER JOIN `store locations` store locations ON store locations.statecode = regions.statecode ) WHERE t IS NOT NULL
Database: regional_sales
Question: What is the region of stores which have type of "Town" in the list?
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN store locations.type = 'Town' THEN regions.region END AS t FROM regions regions INNER JOIN `store locations` store locations ON store locations.statecode = regions.statecode ) WHERE t IS NOT NULL
Database: regional_sales
Note: Medsep Group is the name of the customer; orders refer to ordernumber;
Question: How many orders that Medsep Group had made?
SQL: SELECT sum(CASE WHEN customers.`customer names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM customers INNER JOIN `sales orders` ON sales orders._customerid = customers.customerid
Database: regional_sales
Note: Ole Group is the name of the customer; discount levels applied refer to discount applied NOT NULL;
Question: List out the discount levels applied for all orders from Ole Group.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN customers.`customer names` = 'Ole Group' THEN sales orders.`discount applied` END AS t FROM customers customers INNER JOIN `sales orders` sales orders ON sales orders._customerid = customers.customerid ) WHERE t IS NOT NULL
Database: regional_sales
Note: shipped date in 7/8/2018 refers to shipdate = '7/8/18';
Question: State the customer name of orders which has shipped date in 7/8/2018.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sales orders.shipdate = '7/8/18' THEN customers.`customer names` END AS t FROM customers customers INNER JOIN `sales orders` sales orders ON sales orders._customerid = customers.customerid ) WHERE t IS NOT NULL
Database: regional_sales
Note: Ei is the name of the customer; orders have quantity greater than 4 refer to ordernumber WHERE order quantity > 4;
Question: Among the orders placed by Ei, how many orders have quantity greater than 4?
SQL: SELECT sum(CASE WHEN sales orders.`order quantity` > 4 AND customers.`customer names` = 'Ei ' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN customers ON customers.customerid = sales orders._customerid
Database: regional_sales
Note: orders by Pacific Ltd refer to ordernumber where customer names = 'Pacific Ltd'; applied 5% discount refers to discount applied = 0.05;
Question: Among the orders placed by Pacific Ltd, how many orders have been applied 5% discount ?
SQL: SELECT sum(CASE WHEN sales orders.`discount applied` = 0.05 AND customers.`customer names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN customers ON customers.customerid = sales orders._customerid
Database: regional_sales
Note: unit cost greater than 4000USD refers to unit cost > 4000;
Question: What is the customer names of orders which have unit cost greater than 4000USD?
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sales orders.`unit cost` > 4000 THEN customers.`customer names` END AS t FROM customers customers INNER JOIN `sales orders` sales orders ON sales orders._customerid = customers.customerid ) WHERE t IS NOT NULL
Database: regional_sales
Note: latitude and longitude coordinates can be used to identify the detailed position of stores; id refers to storeid;
Question: Please list the id and detailed position of all stores in Birmingham city.
SQL: SELECT storeid, latitude, longitude FROM `store locations` WHERE `city name` = 'Birmingham'
Database: regional_sales
Note: city has the largest population refers to city name where MAX(population);
Question: Which city has the largest population?
SQL: SELECT `city name` FROM `store locations` ORDER BY population DESC LIMIT 1
Database: regional_sales
Note: California is a state; CDP stores refer to storeid where type = 'CDP';
Question: How many CDP stores are there in California?
SQL: SELECT sum(CASE WHEN state = 'California' AND TYPE = 'CDP' THEN 1 ELSE 0 END) FROM `store locations`
Database: regional_sales
Note: the lowest unit price refers to MIN(unit price);
Question: Please give the order number and product name of the order which has the lowest unit price.
SQL: SELECT sales orders.ordernumber, products.`product name` FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE replace(sales orders.`unit price`, ',', '') = ( SELECT replace(sales orders.`unit price`, ',', '') FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid ORDER BY replace(sales orders.`unit price`, ',', '') LIMIT 1 )
Database: regional_sales
Note: net profit can be computed as SUBTRACT(unit price, unit cost); the highest net profit in 2019 refers to MAX(Net Profit) where orderdate LIKE '%/19'; product refers to product name;
Question: Which product has the highest net profit in 2019?
SQL: SELECT products.`product name` FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE sales orders.orderdate LIKE '%/%/19' ORDER BY replace(sales orders.`unit price`, ',', '') - replace(sales orders.`unit cost`, ',', '') DESC LIMIT 1
Database: regional_sales
Note: AVG(unit price where product name = 'Cookware');
Question: What is the average unit price of a Cookware product?
SQL: SELECT avg(replace(sales orders.`unit price`, ',', '')) FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE products.`product name` = 'Cookware'
Database: regional_sales
Note: had orders on 5/31/2018 refer to orderdate = '5/31/18'; sale team names refer to sales team;
Question: Please list all sale team names which had orders on 5/31/2018.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sales orders.orderdate = '5/31/18' THEN sales team.`sales team` ELSE NULL END AS t FROM `sales orders` sales orders INNER JOIN `sales team` sales team ON sales team.salesteamid = sales orders._salesteamid ) WHERE t IS NOT NULL
Database: regional_sales
Note: sale team names refer to sales team; the least orders in 2019 refer to MIN(COUNT(ordernumber where SUBSTR(orderdate, -2) = '19'));
Question: Which sales team name has the least orders in 2019?
SQL: SELECT sales team.`sales team` FROM `sales orders` INNER JOIN `sales team` ON sales team.salesteamid = sales orders._salesteamid WHERE sales orders.orderdate LIKE '%/%/19' GROUP BY sales team.`sales team` ORDER BY count(sales orders.ordernumber) ASC LIMIT 1
Database: regional_sales
Note: George Lewis refers to sales team; the highest number of orders refers to MAX(COUNT(ordernumber)); which year from 2018 to 2020 refers to SUBSTR(orderdate, -2) IN ('18', '19', '20') GROUP BY SUBSTR(orderdate, -2);
Question: From 2018 to 2020, which year did the George Lewis group have the highest number of orders?
SQL: SELECT substr(sales orders.orderdate, -2, 2) FROM `sales orders` INNER JOIN `sales team` ON sales team.salesteamid = sales orders._salesteamid WHERE sales team.`sales team` = 'George Lewis' GROUP BY substr(sales orders.orderdate, -2, 2) ORDER BY count(sales orders.ordernumber) DESC LIMIT 1
Database: regional_sales
Note: DIVIDE(COUNT(ordernumber where county = 'Orange county' and SUBSTR(orderdate, -2) = '18'), COUNT(ordernumber where SUBSTR(orderdate, -2) = '18')) as percentage;
Question: What is the percentage of total orders from stores in Orange County in 2018?
SQL: SELECT cast(sum(CASE WHEN store locations.county = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / count(sales orders.ordernumber) FROM `sales orders` INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid WHERE sales orders.orderdate LIKE '%/%/18'
Database: regional_sales
Note: the highest unit price refers to MAX(unit price);
Question: Which order number has the highest unit price?
SQL: SELECT ordernumber FROM `sales orders` WHERE replace(`unit price`, ',', '') = ( SELECT replace(`unit price`, ',', '') FROM `sales orders` ORDER BY replace(`unit price`, ',', '') DESC LIMIT 1 )
Database: regional_sales
Note: the highest number of orders in 2018 refers to MAX(COUNT(ordernumber where SUBSTR(orderdate, -2) = '18'));
Question: Which sales team id has the highest number of orders in 2018?
SQL: SELECT _salesteamid FROM `sales orders` WHERE orderdate LIKE '%/%/18' GROUP BY _salesteamid ORDER BY count(_salesteamid) DESC LIMIT 1
Database: regional_sales
Note: ordernumber = 'SO - 000103';
Question: What is the unit cost of order SO - 000103?
SQL: SELECT DISTINCT t FROM ( SELECT iif(ordernumber = 'SO - 000103', `unit cost`, NULL) AS t FROM `sales orders` ) WHERE t IS NOT NULL
Database: regional_sales
Note: total orders refer to COUNT(ordernumber); 2020 refers to SUBSTR(orderdate, -2) = '20';
Question: In 2020, what were the total orders of all stores in Maricopa County?
SQL: SELECT sum(CASE WHEN store locations.county = 'Maricopa County' AND orderdate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid
Database: regional_sales
Note: latitude and longitude coordinates can be used to identify the detailed position of stores; store refers to storeid WHERE ordernumber = 'SO - 000115';
Question: What is the detailed position of the store which has order SO - 000115?
SQL: SELECT store locations.latitude, store locations.longitude FROM `sales orders` INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid WHERE sales orders.ordernumber = 'SO - 000115'
Database: regional_sales
Note: total number of orders refers to COUNT(ordernumber); 2019 refers to orderdate between 01-01-2019 and 31-12-2019; city refers to city name;
Question: Please calculate the total number of orders by each city in 2019.
SQL: SELECT count(sales orders.ordernumber) FROM `sales orders` INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid WHERE sales orders.orderdate LIKE '%/%/19' GROUP BY store locations.`city name` HAVING count(sales orders.ordernumber)
Database: regional_sales
Note: total orders of over 3 in 2018 refer to COUNT(ordernumber) > 3 where SUBSTR(orderdate, -2) = '18';
Question: Please list the names of customers who have total orders of over 3 in 2018.
SQL: SELECT DISTINCT iif(count(customers.customerid) > 3, customers.`customer names`, NULL) FROM `sales orders` INNER JOIN customers ON customers.customerid = sales orders._customerid WHERE sales orders.orderdate LIKE '%/%/18' GROUP BY sales orders._customerid HAVING count(customers.customerid)
Database: regional_sales
Note: Medsep Group is the name of the customer; total orders refer to COUNT(ordernumber); from 2018 to 2020 refers to SUBSTR(orderdate, -2) IN ('18', '19', '20');
Question: What were the total orders of Medsep Group from 2018 to 2020?
SQL: SELECT sum(CASE WHEN substr(sales orders.orderdate, -2) IN ('18', '19', '20') AND customers.`customer names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN customers ON customers.customerid = sales orders._customerid
Database: regional_sales
Note: order quantity was more than 5 on 6/1/2018 refers to order quantity > 5 where orderdate = 6/1/2018;
Question: Please list the customer names whose order quantity was more than 5 on 6/1/2018.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sum(sales orders.`order quantity`) > 5 THEN customers.`customer names` END AS t FROM `sales orders` sales orders INNER JOIN customers customers ON customers.customerid = sales orders._customerid WHERE sales orders.orderdate = '6/1/18' GROUP BY sales orders._customerid ) WHERE t IS NOT NULL
Database: regional_sales
Note: sales team = 'Stephen Payne'; net profit can be computed as SUBTRACT(unit price, unit cost); DIVIDE(COUNT(ordernumber where sales team = 'Stephen Payne' and Net Profit > 1000)), (COUNT(ordernumber where sales team = 'Stephen Payne')) as percentage;
Question: What is the percentage of total orders of Stephen Payne that had a net profit of over 1000?
SQL: SELECT cast(sum(CASE WHEN replace(sales orders.`unit price`, ',', '') - replace(sales orders.`unit cost`, ',', '') > 1000 THEN 1 ELSE 0 END) AS REAL) * 100 / count(sales orders.ordernumber) FROM `sales orders` INNER JOIN `sales team` ON sales team.salesteamid = sales orders._salesteamid WHERE sales team.`sales team` = 'Stephen Payne'
Database: regional_sales
Note: Northeast is the name of the region;
Question: How many sales team were from Northeast?
SQL: SELECT sum(CASE WHEN region = 'Northeast' THEN 1 ELSE 0 END) FROM `sales team`
Database: regional_sales
Question: State the name of all city in Maricopa County along with its latitude and longitude.
SQL: SELECT DISTINCT `city name`, latitude, longitude FROM `store locations` WHERE county = 'Maricopa County'
Database: regional_sales
Note: order have the highest unit cost refers to ordernumber where MAX(unit cost);
Question: Which order have the highest unit cost?
SQL: SELECT ordernumber FROM `sales orders` WHERE replace(`unit cost`, ',', '') = ( SELECT replace(`unit cost`, ',', '') FROM `sales orders` ORDER BY replace(`unit cost`, ',', '') DESC LIMIT 1 )
Database: regional_sales
Note: products with the ID of 30 to 40 refer to product name WHERE productid BETWEEN 30 AND 40;
Question: List all the name of products with the ID of 30 to 40.
SQL: SELECT t FROM ( SELECT CASE  WHEN productid BETWEEN 30 AND 40 THEN `product name` ELSE NULL END AS t FROM products ) WHERE t IS NOT NULL
Database: regional_sales
Note: ratio can be calculated as DIVIDE(MAX(Unit_Cost)), MIN(unit cost);
Question: Calculate ratio between the highest unit cost and the lowest unit cost?
SQL: SELECT ( SELECT replace(`unit cost`, ',', '') FROM `sales orders` WHERE replace(`unit cost`, ',', '') = ( SELECT replace(`unit cost`, ',', '') FROM `sales orders` ORDER BY replace(`unit cost`, ',', '') DESC LIMIT 1 ) ORDER BY replace(`unit cost`, ',', '') DESC LIMIT 1 ) / ( SELECT replace(`unit cost`, ',', '') FROM `sales orders` WHERE replace(`unit cost`, ',', '') = ( SELECT replace(`unit cost`, ',', '') FROM `sales orders` ORDER BY replace(`unit cost`, ',', '') ASC LIMIT 1 ) ORDER BY replace(`unit cost`, ',', '') ASC LIMIT 1 )
Database: regional_sales
Note: product refers to product name; ordered the most in 2018 refers to MAX(COUNT(ordernumber)) where SUBSTR(orderdate, -2) = '18';
Question: Which product was ordered the most in 2018?
SQL: SELECT products.`product name` FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE sales orders.orderdate LIKE '%/%/18' GROUP BY sales orders._productid ORDER BY count(sales orders._productid) DESC LIMIT 1
Database: regional_sales
Note: products sold by Adam Hernandez refer to SUM(order quantity where sales team = 'Adam Hernandez');
Question: How many products sold by Adam Hernandez?
SQL: SELECT sum(CASE WHEN sales team.`sales team` = 'Adam Hernandez' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN `sales team` ON sales team.salesteamid = sales orders._salesteamid
Database: regional_sales
Note: shipped from Daly City refers to store locations where city name = 'Daly City'; orders refer to ordernumber;
Question: List all orders where its products were shipped from Daly City.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN store locations.`city name` = 'Daly City' THEN sales orders.ordernumber END AS t FROM `sales orders` sales orders INNER JOIN `store locations` store locations ON store locations.storeid = sales orders._storeid ) WHERE t IS NOT NULL
Database: regional_sales
Note: Rochester Ltd is the name of the customer; orders refer to ordernumber;
Question: How many orders made by Rochester Ltd?
SQL: SELECT sum(CASE WHEN customers.`customer names` = 'Rochester Ltd' THEN 1 ELSE 0 END) FROM customers INNER JOIN `sales orders` ON sales orders._customerid = customers.customerid
Database: regional_sales
Note: Qualitest ordered the highest product quantity refers to customer names where MAX(order quantity);
Question: State the order number where Qualitest ordered the highest product quantity.
SQL: SELECT sales orders.ordernumber FROM `sales orders` INNER JOIN customers ON customers.customerid = sales orders._customerid WHERE customers.`customer names` = 'Qualitest ' ORDER BY sales orders.`order quantity` DESC LIMIT 1
Database: regional_sales
Note: orders for all in-store sales refer to ordernumber where sales channel = 'In-Store'; products refer to product name;
Question: List the order for all in-store sales along with the products sold.
SQL: SELECT DISTINCT sales orders.ordernumber, products.`product name` FROM `sales orders` INNER JOIN products ON products.productid = sales orders._productid WHERE sales orders.`sales channel` = 'In-Store'
Database: regional_sales
Note: online sales refer to ordernumber where sales channel = 'Online'; May 2018 refers to orderdate LIKE '5/%/18'; Norman is the name of the city;
Question: How many online sales were made in May 2018 where products were shipped from Norman?
SQL: SELECT sum(CASE WHEN sales orders.orderdate LIKE '5/%/18' AND sales orders.`sales channel` = 'Online' AND store locations.`city name` = 'Norman' THEN 1 ELSE 0 END) FROM `sales orders` INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid
Database: regional_sales
Note: the least sold product refers to product name where MIN(order quantity);
Question: Among the products sold in Maricopa County, which was the least sold?
SQL: SELECT products.`product name` FROM products INNER JOIN `sales orders` ON sales orders._productid = products.productid INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid WHERE store locations.county = 'Maricopa County' ORDER BY sales orders.`order quantity` ASC LIMIT 1
Database: regional_sales
Question: State all the order numbers for sales team of Samuel Fowler.
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sales team.`sales team` = 'Samuel Fowler' THEN sales orders.ordernumber ELSE NULL END AS t FROM `sales orders` sales orders INNER JOIN `sales team` sales team ON sales team.salesteamid = sales orders._salesteamid ) WHERE t IS NOT NULL
Database: regional_sales
Note: product name = 'Baseball'; December 2017 refers to orderdate LIKE '12/%/17';
Question: Find the number of baseball ordered in December 2017.
SQL: SELECT count(sales orders.ordernumber) FROM products INNER JOIN `sales orders` ON sales orders._productid = products.productid WHERE products.`product name` = 'Baseball' AND sales orders.orderdate LIKE '12/%/18'
Database: regional_sales
Note: DIVIDE(SUM(order quantity where product name = 'Ornaments' and orderdate LIKE '%/18'), 12);
Question: Find the average number of ornaments sold each month in 2018.
SQL: SELECT cast(sum(sales orders.`order quantity`) AS REAL) / 12 FROM products INNER JOIN `sales orders` ON sales orders._productid = products.productid WHERE products.`product name` = 'Ornaments' AND sales orders.orderdate LIKE '%/%/18'
Database: regional_sales
Note: DIVIDE(SUM(order quantity where city name = 'Burbank' and SUBSTR(orderdate, -2) = '18')), (SUM(order quantity where SUBSTR(orderdate, -2) = '18')) as percentage;
Question: Find the percentage of products that were shipped from Burbank in 2018?
SQL: SELECT cast(sum(CASE WHEN store locations.`city name` = 'Burbank' THEN sales orders.`order quantity` ELSE 0 END) AS REAL) * 100 / sum(sales orders.`order quantity`) FROM products INNER JOIN `sales orders` ON sales orders._productid = products.productid INNER JOIN `store locations` ON store locations.storeid = sales orders._storeid WHERE sales orders.orderdate LIKE '%/%/18'
Database: regional_sales
Note: "WARE-NBV1002" and "WARE-MKL1006" are both warehousecode; difference in order number = Subtract(Count(ordernumber where warehousecode = 'WARE-MKL1006'), Count(ordernumber where warehousecode = 'WARE-NBV1002'));
Question: What is the difference in order number from "WARE-MKL1006" and "WARE-NBV1002"?
SQL: SELECT sum(iif(warehousecode = 'WARE-MKL1006', 1, 0)) - sum(iif(warehousecode = 'WARE-NBV1002', 1, 0)) AS difference FROM `sales orders`
Database: regional_sales
Note: delivered in 2021 refer to deliverydate LIKE '%/21'; 'Sundial' is the customer names;
Question: Describe the product names delivered in 2021 for the customer "Sundial".
SQL: SELECT t FROM ( SELECT DISTINCT CASE  WHEN sales orders.deliverydate LIKE '%/%/21' AND customers.`customer names` = 'Sundial ' THEN products.`product name` END AS t FROM customers customers INNER JOIN `sales orders` sales orders ON sales orders._customerid = customers.customerid INNER JOIN products products ON products.productid = sales orders._productid ) WHERE t IS NOT NULL
Database: regional_sales
Note: "Michigan" is the state;
Question: Write down the store IDs and region of the state "Michigan".
SQL: SELECT DISTINCT store locations.storeid, regions.region FROM regions INNER JOIN `store locations` ON store locations.statecode = regions.statecode WHERE store locations.state = 'Michigan'