Skip to content
Advertisement

How to find the row and column number of a specific cell in sql?

I have a table in SQL database and I want to find the location of a cell like a coordinate and vice versa. Here is an example:

When I ask for i, I want to get row=2 and column=3. When I ask for a cell of row=2 and column=3, I want to get i.

Advertisement

Answer

You need to store your matrix in table specifying the columns and rows like this

Then you insert your data like this

And then you can simply find what you need using two queries

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement