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
|
2023-10-20 18:51:23 +00:00
|
|
|
DESCRIBE TABLE oneuptime.Span
|
2023-10-20 13:26:01 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## 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']);
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|