Your question is Second-Highest Sales by Region. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a query to find the second-highest sales amount in each region for Benjamin Moore.
Use the provided regional and sales data. Return only regions with at least two distinct non-null sales amounts.
region_name, second_highest_sales_amountregion_name| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Unique identifier for a sales region |
| region_name | VARCHAR(100) | Benjamin Moore sales region name |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique identifier for a sales transaction |
| region_id | INT | Region associated with the transaction |
| sales_amount | DECIMAL(12,2) | Amount recorded for the transaction |
| sale_date | DATE | Date of the sale |