Monthly product statistics.
| Column | Type | Constraint | Description |
|---|---|---|---|
| shop | TEXT | PRIMARY KEY | Shop ID. (shop.username) |
| product_id | INTEGER | Product ID. (product.id) | |
| period | DATE |
Year and month values of this column represent period of monthly statistics. The statistics collected between the month to the next month. |
|
| view | INTEGER | NOT NULL | View count of the product on the month. |
| sold | INTEGER | NOT NULL | Sold count of the product on the month. |
CREATE TABLE product_statistics (
shop TEXT,
product_id INTEGER,
period DATE,
view INTEGER NOT NULL,
sold INTEGER NOT NULL,
PRIMARY KEY(shop, product_id, period));