I have a query that I am building, that I am having a tough time getting a handle on. What I have are tables like the following:
CREATE TABLE fv (
vectorid INT UNSIGNED NOT NULL AUTO_INCREMENT,
dimension INT UNSIGNED NOT NULL,
value FLOAT NOT NULL,
PRIMARY KEY(dimension, vectorid)
);
CREATE TABLE centers (
centerid INT UNSIGNED NOT NULL AUTO_INCREMENT,
dimension INT UNSIGNED NOT NULL,
value FLOAT NOT NULL,
PRIMARY KEY(dimension, centerid)
);
CREATE TABLE selected (
selectid INT UNSIGNED NOT NULL AUTO_INCREMENT,
centerid INT UNSIGNED NOT NULL,
PRIMARY KEY (centerid, selectid)
);
I want to select records out of the centers table based on the centerid values in the selected table for a specific selectid value. Then I want to join the fv table to the centers table using dimension and a specific number of random vectorid values. To make things a little more difficult, the query should return a single centerid associated with a single vectorid. What would be the best method of attack? I am using Python for the application logic.