There are 163 tables, and I want to add two columns in all. And columns should be added from the front. Please tell me how to do it on postgreSQL
This is a table with two columns to add.
col1 | col2
-----+-----
0 | 0
0 | 0
And there are a lot of tables...
[TableA]
colA1 | colA2
------+-----
a | a
a | a
[TableB]
colB1 | colB2
------+-----
b | b
b | b
.
.
.
And this is what I want finally.
[NewTableA]
col1 | col2 | colA1 | colA2
-----+------+-------+-------
0 | 0 | a | a
0 | 0 | a | a
[NewTableB]
col1 | col2 | colB1 | colB2
-----+------+-------+-------
0 | 0 | b | b
0 | 0 | b | b
.
.
.
And it should only be applied to tables that begin with 'M'. I don't want to combine 163 times... Please help me