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

-- 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.