By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
version() |
---|
5.6.51 |
user_id | country | category | cat_cnt |
---|---|---|---|
123 | USA | business | 2 |
123 | USA | tourism | 3 |
124 | Ireland | business | 1 |
124 | Ireland | tourism | 1 |
user_id | country | COALESCE(s.category, '------') | cat_cnt |
---|---|---|---|
123 | USA | business | 2 |
123 | USA | tourism | 3 |
124 | Ireland | business | 1 |
124 | Ireland | tourism | 1 |
125 | Japan | ------ | 0 |
country | category | count(1) |
---|---|---|
Ireland | business | 1 |
Ireland | tourism | 1 |
USA | business | 2 |
USA | tourism | 3 |
country | category | count(country) |
---|---|---|
Ireland | business | 1 |
Ireland | tourism | 1 |
USA | business | 2 |
USA | tourism | 3 |
country | category | cat_cnt |
---|---|---|
Ireland | tourism | 1 |
Ireland | business | 1 |
Japan | ------ | 0 |
USA | tourism | 6 |
USA | business | 4 |