By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
6 rows affected
| code | model | color | type | price |
|---|---|---|---|---|
| 1 | 1276 | n | Laser | 400.0000 |
| 2 | 1433 | y | Jet | 270.0000 |
| 3 | 1434 | y | Jet | 290.0000 |
| 4 | 1401 | n | Matrix | 150.0000 |
| 5 | 1408 | n | Matrix | 270.0000 |
| 6 | 1288 | n | Laser | 400.0000 |
| code | model | color | type | price | grp | is_new | avg_price | distinct_type_cnt |
|---|---|---|---|---|---|---|---|---|
| 1 | 1276 | n | Laser | 400.0000 | 1 | 1 | 320.0000 | 2 |
| 2 | 1433 | y | Jet | 270.0000 | 1 | 1 | 320.0000 | 2 |
| 3 | 1434 | y | Jet | 290.0000 | 1 | 0 | 320.0000 | 2 |
| 4 | 1401 | n | Matrix | 150.0000 | 2 | 1 | 150.0000 | 1 |
| 5 | 1408 | n | Matrix | 270.0000 | 3 | 1 | 270.0000 | 1 |
| 6 | 1288 | n | Laser | 400.0000 | 4 | 1 | 400.0000 | 1 |
Warning: Null value is eliminated by an aggregate or other SET operation.