I have huge tables (3 millions records) that must have a joined column. This value will not change.
How can I add a column based on a join? There will be some other queries. If I use join, it will be a slower process.
Ex:
Main Table:
add_cod | name
1 | alfa
2 | beta
1 | zeta
Addon Table:
cod | col_ext
1 | jam
2 | bam
The result should be the main table, but with col_ext column:
add_cod | name | col_ext
1 | alfa | jam
2 | beta | bam
1 | zeta | jam
This is a simple
JOIN.You don’t have to worry about performance if you have properly implemented index on your tables.
SQLFiddle Demo