I have a Item
and Vector
table:
CREATE TABLE Item (
itemID INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(256)
);
CREATE TABLE Vector (
itemID INT REFERENCES Item(itemID),
dim INT,
value FLOAT
);
So for instance, if item 3 has vector <4,2,5>
we have (3, 0, 4), (3,1,2), (3,2,5)
in Vector
table. (In reality, it is not 3 dimensional, can be really big)
Now given specific vector V=<v_1, v_2, v_3>
, I want to SELECT
10 Item
s with smallest cosine distance to vector V
.
I am struggling to find the way to send the vector V
to the SQL Server.
Please help me!
I am using MySQL on Ubuntu