Question: I'm new to SQL, so I've got some troubles with creating queries. 
My task is: To select a description of a product which was selling the most in 1989 with maximum discount.[Product Table](https://i.stack.imgur.com/e2xQ9.png). [Price table](https://i.stack.imgur.com/efIlh.png). What I tried to do is

1. Select maximum discount by subtracting list\_price - min\_price  

```
select max(list_price - min_price) from PRICE

```
2. Select description

```
select description from product 
join price on PRODUCT.product_id = PRICE.product_id 
where start_date = '1989'

```

The problem is that I can't make it in one query

Answer: 
```
#include <iostream>
using namespace std;

int main(){
    const auto n = 4;
    auto count = 0;
    for (auto i = 2; i <= n * 2; i += 2)
    {
        for (auto j = i; j > 0; j -= 2)
            std::cout << j << " ";
        std::cout << std::endl;
        for (auto j = 0; j < (i == 2 ? i : i + 2); j += 3)
            std::cout << count * 3 << " ";
        ++count;
        std::cout << std::endl;
    }

  return 0;
}

```

**Edit:** Corrected...

A little near to the answer  

2  

0 ==> true  

4 2  

0 3 ==> should be 3 3  

6 4 2  

0 3 6 ==> should be 6 6 6  

8 6 4 2  

0 3 6 ==> should be 9 9 9
Use this:

```
void print_sequence(unsigned long long const repeat = 4, unsigned long long const i = 0)
{
    for (auto j = (i + 1ull) * 2ull; j > 2ull; j -= 2ull)
        std::cout << j << " ";
    std::cout << (repeat > 0ull && repeat < -1ull ? "2\n" : "");
    for (auto j = 0ull; j < i; j++)
        std::cout << i * 3ull << " ";
    std::cout << (repeat > 0ull && repeat < -1ull ? std::to_string(i * 3ull) + "\n" : "");
    if (repeat < -1ull && i + 1ull < repeat)
        print_sequence(repeat, i + 1ull);
}

```

**Edit:** The shortest and strongest method I can think of...

And call it like this:

`print_sequence();`

If you don't want 4 times:

`print_sequence(10)`

It will repeat it as many times you want...

Kind regards,

Ruks.