I was working with a 2D data in excel and wanted to store the data to use for my need in a MySQL Database. But I came to face a problem that might have a better solution which i might be missing. A sample example is given.
+-----+-----+-----+-----+
| | A | B | C |
|-----|-----|-----|-----|
| A | 1 | 2 | 3 |
|-----|-----|-----|-----|
| B | 4 | 5 | 6 |
|-----|-----|-----|-----|
| C | 7 | 8 | 9 |
+-----+-----+-----+-----+
So, what I need is a way to query and get my value based on 2 values. So if I need value of AB it's 2 same as BC=6 and AA=1. I have this data in my excel I stored them as below in MySQL DB.
table:
+-------+------+-------+
| v1 | v2 | sol |
|-------|------|-------|
| A | A | 1 |
|-------|------|-------|
| A | B | 2 |
|-------|------|-------|
| A | C | 3 |
+-------+------+-------+
| B | A | 4 |
|-------|------|-------|
| B | B | 5 |
|-------|------|-------|
| B | C | 6 |
+-------+------+-------+
| C | A | 7 |
|-------|------|-------|
| C | B | 8 |
|-------|------|-------|
| C | C | 9 |
+-------+------+-------+
This way I can query SELECT sol FROM table WHERE v1 = 'A' AND v2 = 'C'
and i will be getting the proper value AC = 3.
But my worry is this excel will keep growing both in column and rows and I will have to make ((NxN - current rowcount) if I add 'D' then (4*4)-9= 7 new rows) 'N' number of rows in the table each time.
That's why I was thinking if there was a better way and if there is a better database except MySQL for my problem. Both answers will be very much appreciated. Thanks.