SQLite Forum

How to select columns that have name beginning with same prefix?
Login
It's easy enough to get the SQL using

select 'select ' || group_concat(name) || ' from mytable' from pragma_table_info('mytable') where substr(name,1,7)='PREFIX_'

but I think you'd need the eval function to execute the SQL which takes you into load extension territory

https://sqlite.org/c3ref/load_extension.html

I'm not sure if eval is automatically loaded into the CLI and I don't have access to it at the moment and to be honest I'm not sure if eval can return multiple rows. You might need a user defined function to execute the SQL.

https://sqlite.org/c3ref/create_function.html