Clickhouse Commands

cd /tmp
wget 'https://builds.clickhouse.com/master/macos/clickhouse'
chmod a+x ./clickhouse


./clickhouse server


http://127.0.0.1:8123/play




SHOW databases

CREATE DATABASE IF NOT EXISTS helloworld

CREATE TABLE helloworld.my_first_table
(
    user_id UInt32,
    message String,
    timestamp DateTime,
    metric Float32
)
ENGINE = MergeTree()
PRIMARY KEY (user_id, timestamp)


INSERT INTO helloworld.my_first_table (user_id, message, timestamp, metric) VALUES
    (101, 'Hello, ClickHouse!',                                 now(),       -1.0    ),
    (102, 'Insert a lot of rows per batch',                     yesterday(), 1.41421 ),
    (102, 'Sort your data based on your commonly-used queries', today(),     2.718   ),
    (101, 'Granules are the smallest chunks of data read',      now() + 5,   3.14159 )


SELECT * FROM helloworld.my_first_table


./clickhouse client


SELECT * 
FROM helloworld.my_first_table 
ORDER BY timestamp


SELECT * 
FROM helloworld.my_first_table 
ORDER BY timestamp 
FORMAT TabSeparated

exit

https://clickhouse.com/#quick-start

https://clickhouse.com/docs/en/quick-start

Last updated

Was this helpful?