:] desc t1
DESCRIBE TABLE t1
ββnameββ¬βtypeββββ¬βdefault_typeββ¬βdefault_expressionββ
β x β UInt32 β β β
β y β String β β β
ββββββββ΄βββββββββ΄βββββββββββββββ΄βββββββββββββββββββββ
β Progress: 2.00 rows, 86.00 B (1.14 thousand rows/s., 49.14 KB/s.)
2 rows in set. Elapsed: 0.002 sec.
:] desc t2
DESCRIBE TABLE t2
ββnameββ¬βtypeββββ¬βdefault_typeββ¬βdefault_expressionββ
β x β UInt32 β β β
β y β String β β β
ββββββββ΄βββββββββ΄βββββββββββββββ΄βββββββββββββββββββββ
β Progress: 2.00 rows, 86.00 B (1.17 thousand rows/s., 50.42 KB/s.)
2 rows in set. Elapsed: 0.002 sec.
:] desc t3
DESCRIBE TABLE t3
ββnameββ¬βtypeββββ¬βdefault_typeββ¬βdefault_expressionββ
β x β UInt32 β β β
β y β String β β β
ββββββββ΄βββββββββ΄βββββββββββββββ΄βββββββββββββββββββββ
β Progress: 2.00 rows, 86.00 B (1.21 thousand rows/s., 52.21 KB/s.)
2 rows in set. Elapsed: 0.002 sec.
:]
I can't use this SQL
select x,y from t1 any inner join t2 any inner join t3 using x;
so,how to join more tables?
You have to join tables pairwise. Also, this means you have to manually choose join order:
:) SELECT x, y1, y2, y3 FROM (SELECT x, y AS y3 FROM t3) ALL INNER JOIN (SELECT x, y1, y2 FROM (SELECT x, y AS y1 FROM t1) ALL INNER JOIN (SELECT x, y AS y2 FROM t2) USING (x)) USING (x)
SELECT
x,
y1,
y2,
y3
FROM
(
SELECT
x,
y AS y3
FROM t3
)
ALL INNER JOIN
(
SELECT
x,
y1,
y2
FROM
(
SELECT
x,
y AS y1
FROM t1
)
ALL INNER JOIN
(
SELECT
x,
y AS y2
FROM t2
) USING (x)
) USING (x)
ββxββ¬βy1ββ¬βy2ββ¬βy3ββ
β 1 β t1 β t2 β t3 β
βββββ΄βββββ΄βββββ΄βββββ
1 rows in set. Elapsed: 0.003 sec.
so,I will join table A,B,C,D,E.
select ... (select column from C any inner join (select columns from A any inner join B) using (ID) ) using (ID) ......
my god ,If i need A join B and A join C and A join D,
B Join C and B join D...
I can't write this SQL. is very trouble .
Indeed, joining many tables is currently not very convenient but there are plans to improve the join syntax.
Also note that if many joins are necessary because your schema is some variant of the star schema and you need to join dimension tables to the fact table, then in ClickHouse you should use the external dictionaries feature instead.
@ztlpn
how to delete table ,this release is not support DELETE ?
To drop table, run DROP TABLE db.table.
There is no possibility to delete individual records from table.
Except the possibility to delete whole partition, see ALTER TABLE ... DROP PARTITION.
I mean,How to delete some record
Table A is 10 rows, I just delete 1 row,keep 9 rows in ClickHouse.
Most helpful comment
You have to join tables pairwise. Also, this means you have to manually choose join order: