Introduction
Basic CTEs
Summary
16. Exercise 2

Instruction

Excellent. You should now be ready to solve the more difficult question.

Exercise

Among successful projects, those that raised 100% to 150% of the minimum amount are good projects, whereas those that raised more than 150% are great projects. Show the number of projects (name the column Count) along with a string representing how good the project is (good projects or great projects). Name that column Tag.

The result should look similar to this:

Count Tag
16 Good projects
7 Great projects

Stuck? Here's a hint!

You will need two CTEs: one for those projects which raised 100-150% and another one for those which raised more than 150%. Use HAVING clauses to check the conditions. Use UNION ALL to show the results from both queries.

To create the Tag column use:

N'Good projects' AS Tag

and

N'Great projects' AS Tag

Mind the N – the column should be nvarchar type.