By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 5
CREATE TABLE
INSERT 0 1
| brand_group | a_ct | c_ct | s_ct | v_ct |
|---|---|---|---|---|
| Base | 1 | 1 | 0 | 0 |
| Deluxe | 0 | 0 | 1 | 1 |
| Premium | 0 | 2 | 1 | 0 |
SELECT 3
| brand_group | base | count |
|---|---|---|
| Base | Accuracy of bill | 1 |
| Base | Cleanliness | 1 |
| Base | Service | 0 |
| Base | Value | 0 |
| Deluxe | Accuracy of bill | 0 |
| Deluxe | Cleanliness | 0 |
| Deluxe | Service | 1 |
| Deluxe | Value | 1 |
| Premium | Accuracy of bill | 0 |
| Premium | Cleanliness | 2 |
| Premium | Service | 1 |
| Premium | Value | 0 |
SELECT 12