https://stackoverflow.com/questions/947215/how-to-get-a-list-of-column-names-on-sqlite3-database
こちらのサイトを参考にしました。
データの確認にはDB Browser for SQLiteを使っていたのですが、DB Browser for SQLite上でSQLを実行するときと、Node.js上のSQLiteモジュールを通して実行したときとで実行できるものが違うようです。
DB Browser for SQLiteを使う場合
pragma table_info(tablename)
で指定したテーブルのカラム名の一覧が取得できます。
他のSELECTなどのクエリと一緒に使うことはできないようです。
Nodejsで使う場合
db.each("SELECT name FROM pragma_table_info('users')", function(err, args) {
console.log(args['name']);
});
でも取得できるようです。
pragma_table_info
はDB Browser for SQLiteでは動作しませんでした。