Here are 25 MSSQL questions using W3Schools' data tables (Customers, Orders,
Products, Suppliers, etc.):
Basic Queries
1. Retrieve all records from the Customers table.
2. Select only the CustomerName and City from the Customers table.
3. Find customers located in "London".
4. Retrieve the distinct cities from the Customers table.
5. Count the number of customers in the Customers table.
Filtering and Conditions
6. List customers whose Country is either "Germany" or "France".
7. Find orders placed after "2022-01-01" in the Orders table.
8. Retrieve products with prices between 10 and 50 from the Products table.
9. Show customers whose names start with the letter "A".
10.Retrieve products with no SupplierID (NULL values).
Sorting and Aggregation
11.List all products sorted by Price in descending order.
12.Find the maximum price of products in the Products table.
13.Calculate the average price of products in the Products table.
14.Retrieve the total number of orders in the Orders table.
15.Group customers by Country and count how many customers are in each country.
Joins
16.Write a query to join the Orders and Customers tables and display the OrderID,
OrderDate, and CustomerName.
17.Join the Products and Suppliers tables to get the ProductName and
SupplierName.
18.Find all orders where the CustomerName is "Alfreds Futterkiste".
19.List all products along with their supplier information.
20.Display all customers who have not placed any orders.
Subqueries
21.Find the product with the highest price using a subquery.
22.Retrieve customers who placed orders worth more than 1000 using a subquery.
23.List suppliers who provide products with a price above the average product price.
24.Find customers who are located in the same city as any supplier.
25.Retrieve the names of products ordered by customers from "USA"