🙏 We need your help! SQLtest.online has no ads and lives only on donations. Even a small amount helps. Donate now →
SQL code copied to buffer
Task 35:

Bike Colors: Road vs Mountain

SQL Server 2022
Marketing compares the color range of road and mountain bikes. For every color that occurs in at least one of the categories Road Bikes and Mountain Bikes (ProductCategory.Name), count the products of each category in the Product table.
Output the columns color, road_bikes and mountain_bikes (0 when the category has no bikes of that color), sorted by color.
Expected result Columns: 3 · Rows: 4
color road_bikes mountain_bikes

Write your query below and click "Check it!". Tables are described in the right pane.

Tutorial

By checking a query, you agree that it is stored without your account details and may be included in anonymized datasets, including for AI training. Learn more

The query result will appear here. Ctrl+Enter - Run query