Practice Filtering
Practice applying filtering patterns in SQL to generate daily sales reports, identify customers with only late deliveries, detect duplicate orders on the same day, and find products containing consecutive vowels. This lesson strengthens your ability to write accurate and optimized queries for real-world data analysis scenarios.
Filtering patterns questions
Let’s practice writing queries to strengthen your grasp of filtering patterns.
Generate a 30-day sales chart
Given the following structure of the Orders table:
Field | Type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where OrderID is the primary key and CustomerID is the foreign key from the Customers table referring to the customer who placed the order. The table contains information about the orders placed.
Write an SQL query that generates a 30-day daily sales report starting from March 1, 2025. Include:
ReportDateTotalSales: Total order value for that dayEnsure all days are shown, even those with no orders (show
0in such cases). ...