You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# ClickHouse
CREATE TABLE test (
a Nullable(String),
b Nullable(String)
) ENGINE = Memory;
INSERT INTO test VALUES (NULL, NULL);
INSERT INTO test VALUES ('a', NULL);
INSERT INTO test VALUES ('a', 'b');
SELECT a, b, count(*) FROM test GROUP BY a, b WITH ROLLUP HAVING a IS NOT NULL and b IS NOT NULL;
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 1 │
│ a │ ᴺᵁᴸᴸ │ 1 │
│ a │ b │ 1 │
└──────┴──────┴─────────┘
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 1 │
│ a │ ᴺᵁᴸᴸ │ 2 │
└──────┴──────┴─────────┘
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 3 │
└──────┴──────┴─────────┘
6 rows in set. Elapsed: 0.010 sec.
SELECT a, b, count(*) FROM test GROUP BY a, b WITH ROLLUP HAVING a IS NOT NULL;
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 1 │
│ a │ ᴺᵁᴸᴸ │ 1 │
│ a │ b │ 1 │
└──────┴──────┴─────────┘
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 1 │
│ a │ ᴺᵁᴸᴸ │ 2 │
└──────┴──────┴─────────┘
┌─a────┬─b────┬─count()─┐
│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 3 │
└──────┴──────┴─────────┘
6 rows in set. Elapsed: 0.008 sec
# Postgresql
CREATE TABLE test (
a TEXT,
b TEXT
);
INSERT INTO test VALUES (NULL, NULL);
INSERT INTO test VALUES ('a', NULL);
INSERT INTO test VALUES ('a', 'b');
SELECT a, b, count(*) FROM test GROUP BY ROLLUP(a, b) HAVING a IS NOT NULL and b IS NOT NULL;
a | b | count
---+---+-------
a | b | 1
(1 row)
SELECT a, b, count(*) FROM test GROUP BY ROLLUP(a, b) HAVING a IS NOT NULL;
a | b | count
---+---+-------
a | b | 1
a | | 1
a | | 2
(3 rows)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: