Hi everyone I created this table for a database
CREATE TABLE IF NOT EXISTS compositions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
id_product INTEGER REFERENCES products(id),
id_receipt INTEGER REFERENCES receipt(id),
quantity INTEGER NOT NULL,
price FLOAT NOT NULL,
id_user VARCHAR REFERENCES users(id),
CONSTRAINT CHK_price_quantity CHECK (price > 0 AND quantity > 0)
);
I would like to insert a constraint that, for a given id_receipt, the id_user must be always the same but I don't know how to implement it. Could someone give a help?
Thank you in advance.