oneuptime/Clickhouse/Docs/ClickhouseOps.md

43 lines
613 B
Markdown
Raw Normal View History

2023-10-20 13:26:01 +00:00
# Some basic commands for Clickhouse
## Show tables in the database
```sql
show tables from oneuptime
```
## Show table structure
```sql
desc table_name from oneuptime
```
## Show table data
```sql
select * from table_name
```
## Delete table data
```sql
truncate table_name
```
## Delete table
```sql
drop table oneuptime.table_name
```
2023-10-20 16:43:50 +00:00
## Insert for nested data
```sql
INSERT INTO opentelemetry_spans (trace_id, span_id, attributes.key, attributes.value) VALUES
('trace1', 'span1', ['key1', 'key2'], ['value1', 'value2']),
('trace2', 'span2', ['keyA', 'keyB'], ['valueA', 'valueB']);
```