If I have two tables. table 1 and table 2. table 1 is the "input table" that allows user to input values. table 2 is the "output table" that generate answers based on the input in table 1.
table 1:
user ID | Number
1 | 1
2 | 2
3 | 3
lets say table 2 takes values in table 1 and multiply by 2. so table 2 should be
user ID | Number
1 | 2
2 | 4
3 | 6
now, if I update table 1, and it becomes
table 1:
user ID | Number
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 6
How can I get an automatic update in table 2 in MySQL?
my desired table 2 outcome:
table 2:
user ID | Number
1 | 2
2 | 4
3 | 6
4 | 8
5 | 10
6 | 12
lets say if Table 2 is already existed, Is there a way to use trigger to drop the current table 2 and create a new table 2 when the table 1 is updated?