Skip to content
Advertisement

How to represent X and Y axis data in an SQL table

I have a table of data in excel that looks like this:

a busy cat

I need to get this data imported into an SQL table.

Eventually I need to be able to query the table by saying something like:

Select the value where x-axis equals 762 and y-axis equals 889 - this should return 30.60.

What is the best way to represent this data in an SQL table to make it easy to query?

Advertisement

Answer

What is the best way to represent this data in an SQL table to make it easy to query?

The answer quite lies in your pseudo code. The most relevant way to store your data is in a table with three columns: x and y, and value, and a unique constraint on the first two columns.

the dataset provided in your example would translate as follows:

Select the value where x-axis equals 762 and y-axis equals 889 – this should return 30.60.

With this table structure, that’s a simple query now:

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