Select column from ALL tables

sqlite

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.

Best Answer

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.