Spaces:
Running
Running
File size: 1,649 Bytes
15917f6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
---
id: "duckdb-table-info"
title: "Table Info"
slug: "duckdb-table-info-query"
description: "Get detailed information about a table's structure"
code: |
-- Returns detailed information about a table's structure
-- Use this to get the column names, types, and other details
PRAGMA table_info('table_name');
---
# DuckDB Table Info Query
This snippet demonstrates how to use the `PRAGMA table_info` function in DuckDB to get detailedinformation about a specific table's structure.
Try out this query [here](https://huggingface.co/datasets/NousResearch/hermes-function-calling-v1?sql_console=true&sql=pragma+table_info%28%27func_calling_singleturn%27%29)
```sql
-- Returns detailed information about a table's structure
-- Use this to get the column names, types, and other details
PRAGMA table_info('table_name');
```
# Example Output
| cid | name | type | notnull | dflt_value | pk |
|-----|---------------|------------------------------------------|---------|------------|-------|
| 0 | id | VARCHAR | false | null | false |
| 1 | conversations | STRUCT("from" VARCHAR, "value" VARCHAR)[] | false | null | false |
| 2 | category | VARCHAR | false | null | false |
| 3 | subcategory | VARCHAR | false | null | false |
| 4 | task | VARCHAR | false | null | false |
You can read more about this [here](https://duckdb.org/docs/configuration/pragmas.html#table-information).
|