I have a SQLITE database with 2 table. The tables have these structure:
TABLE1 (about 2000000 records)
id|name|number1|number2|...|...
1|aaa |12.23 |43.17 |...|...
2|bbb |54.145 |77.23 |...|...
3|ccc |65.2345|13.234 |...|...
TABLE2 (about 1500000 records)
id|name|number1|number2
1|ddd |100.121|12.32
2|bbb |76.223 |11.45
3|eee |55.23 |32.1
I need do this:
- for each record of TABLE1, find if there is a record of TABLE2 with the same name;
- if YES (for example "bbb" record) I need replace "number1" and "number2" of TABLE1 (54.145, 77.23) with value of TABLE2 (76.223, 11.45);
- if NO (for example "aaa" and "ccc" records) I need add a random number to "number1" and "number2" of TABLE1 (12.23, 43.17 and 65.2345, 13.234). The random number must be between 0.01 and 0.30;
What is the best and faster way to do it?
Can I use a SQLITE editor? Which?