Find closest numbers approximately I have a table like this; all columns are numeric:

TableTest

Col1  Col2  Col3  Col4
  5    6     7     8
 12    6     5     6
  2    3.5   6     1


And I want to find the closest row with these values: 4, 5.75, 7.2, 6. A human can find it (row 1 is answer), but how can I write a query for a computer to find it?

I'm using SQL Server but I think it's relevant to machine learning.
This problem can be implemented as a query that minimizes "loss" from the inputs. If "mean square error" loss is used, loss calculation will look like :

select col1, col2, (col1 - inp1)^2 + (col2 - inp2)^2 as mse_loss, 
from table 


Now, you can find the row with least value of mse_loss