/* #1 Display all products with a price between $10 and $20. */SELECTProductName,PriceFROMProductsWHEREPriceBETWEEN10and20;
1
2
3
4
/* #2 List all employees born after 1960. */SELECTFirstName,LastName,BirthDateFROMEmployeesWHEREBirthDate>'1960-12-31';
1
2
3
4
/* #3 Show the names of the first 5 customers and their country in alphabetical order. */SELECTCustomerName,CountryFROMCustomersORDERBYCustomerNameLIMIT5;
1
2
3
4
/* #4 List all orders placed in the year 1997. Display the most recent orders first. */SELECTOrderID,OrderDateFROMOrdersWHEREOrderDate>='1997-01-01'ANDOrderDate<'1998-01-01'ORDERBYOrderDateDESC;
1
2
3
/* #5 Show all product names that start with ethier the letter 'A' or the letter 'B'. */SELECTProductNameFROMProductsWHEREProductNameLIKE'A%'ORProductNameLIKE'B%';
/* #6 What is the average price of products in each category? */SELECTCategoryID,AVG(Price)ASAveragePriceFROMProductsGROUPBYCategoryID;
1
2
3
4
5
/* #7 What are the earliest and latest dates that orders were placed in the Northwind database? */SELECTMIN(OrderDate)ASEarliestOrder,MAX(OrderDate)ASLatestOrderFROMOrders;
1
2
3
4
/* #8 List the countries that have more than 5 customers. */SELECTCountry,COUNT(*)ASCustomerCountFROMCustomersGROUPBYCountryHAVINGCustomerCount>5;
1
2
3
4
/* #9 Show the suppliers that provide more than 3 products. */SELECTSupplierID,COUNT(*)ASProductCountFROMProductsGROUPBYSupplierIDHAVINGProductCount>3;
1
2
3
4
5
/* #10 List the 3 countries that have the most customers. */SELECTCountry,COUNT(*)ASCustomerCountFROMCustomersGROUPBYCountryORDERBYCustomerCountDESCLIMIT3;
1
2
3
4
5
6
7
8
/* #11 Challenge: List the months in 1996 where 25 or more orders were placed. */SELECTMONTH(OrderDate)ASOrderMonth,COUNT(*)ASOrderCountFROMOrdersWHEREYEAR(OrderDate)='1996'GROUPBYOrderMonthHAVINGOrderCount>=25;