﻿ AdventureWorks: List all the products that are red or blue

# AdventureWorks Database: List all the products that are red or blue

## SQL Query - AdventureWorks: Exercise-37 with Solution

37. From the following table write a query in SQL to list all the products that are Red or Blue in color. Return name, color and listprice.Sorts this result by the column listprice.

Sample table: Production.Product

Click to view Full table

Sample Solution:

``````SELECT Name, Color, ListPrice
FROM Production.Product
WHERE Color = 'Red'
UNION ALL
SELECT Name, Color, ListPrice
FROM Production.Product
WHERE Color = 'Blue'
ORDER BY ListPrice ASC;
``````

Sample Output:

```name                       |color|listprice|
---------------------------+-----+---------+
Sport-100 Helmet, Blue     |Blue |    34.99|
Sport-100 Helmet, Red      |Red  |    34.99|
Classic Vest, S            |Blue |     63.5|
Classic Vest, L            |Blue |     63.5|
Classic Vest, M            |Blue |     63.5|
LL Touring Frame - Blue, 54|Blue |   333.42|
LL Touring Frame - Blue, 50|Blue |   333.42|
LL Touring Frame - Blue, 44|Blue |   333.42|
LL Touring Frame - Blue, 62|Blue |   333.42|
LL Touring Frame - Blue, 58|Blue |   333.42|
LL Road Frame - Red, 58    |Red  |   337.22|
LL Road Frame - Red, 60    |Red  |   337.22|
LL Road Frame - Red, 62    |Red  |   337.22|
LL Road Frame - Red, 44    |Red  |   337.22|
LL Road Frame - Red, 48    |Red  |   337.22|
...
```

## Practice Online

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿