product_similarity

Description

Similarity between two products.

Similarity measure is represented by floating number. Sum of similarities for one product is supposed to be 1. If no similarities are defined for one product, the summation will be 0.

Pair of product IDs are represented by id1 and id2. And id1 is less than id2.

Definition

Column Type Constraint Description
shop TEXT PRIMARY KEY Shop ID. (shop.username)
id1 INTEGER Product ID. (product.id)
id2 INTEGER Product ID. (product.id)
similarity REAL NOT NULL Similarity. Range is [0, 1.0].

Related tables

Query

CREATE TABLE product_similarity(
shop        TEXT,
id1         INTEGER,
id2         INTEGER,
similarity  REAL     NOT NULL,
PRIMARY KEY (shop, id1, id2)
);