I have a sqlite3 database with many tables which have same columns. It's a dictionary database, and each table name is starting word letter.

I would like to list single column from all tables in database, but couldn't find a way to do so.

From sqlite3 CLI client, something like:

sqlite3 -line my_db.db 'select my_column from *'

Of course the above does not work.


You're looking for UNION and UNION ALL.

select my_column from table1
union all
select my_column from table2
union all
select my_column from ...

But needing to select one column from every table is likely the sign of a significant design error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.