在SQLite中是否有与PRAGMA table_info('mytable')等价的SELECT语句?本质上,我想获得与PRAGMA返回相同的结果集:cid、name、type、notnull、dflt_value和pk。虽然我知道可以通过C函数sqlite3_table_column_metadata获取此信息的其他替代方法,但我更愿意使用SELECT语句。
sqlite> SELECT * FROM PRAGMA table_info(results);
returns error:
Error: near "(": syntax error
- Katiesqlite> SELECT * FROM pragma_table_info('results');
这个命令应该可以运行,注意 pragma_table_info
的拼写(有下划线),表名需要用引号括起来。 - cuda12