From the course: SQL for Non-Programmers

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Solution: Advanced commands solved

Solution: Advanced commands solved - SQL Tutorial

From the course: SQL for Non-Programmers

Solution: Advanced commands solved

How do you feel after completing the advanced command's challenge? This was not an easy endeavor. Let's see how you did. To kick it off, you are tasked with providing a sales report for a few of the top selling product lines offered by Two Trees Olive Oil. Both the total sales and price per item sold should be listed for each product line, and all other product lines should be excluded. The report should be ordered from largest to smallest sales so that we can easily see the ranking. Your query should look something like this. We can begin with SELECT CASE. We need to use a CASE statement to categorize the product lines. Onto the next line. WHEN product name LIKE lemon percent symbol, THEN lemon. We can list out each grouping here and use the wildcard percent symbol to partially match product names with their associated product line, which is always listed at the beginning of the product name. Onto the next line. WHEN product name LIKE rosemary percent, THEN rosemary. On the next…

Contents