[cut]
It means what it says. You have defined table orders with a primary key of (id,order_code). This means that the combination of (id,order_code) must be unique.
yes, that was my thought, and in that context, i thought it could be correct in order to have uniqueness for creating foreign keys
So - these could all exist at the same time: (1,1), (1,2), (2,1), (2,2) You could not then add another (1,2) combination.
yes, again, i thought that was the uniqueness i needed...
Since id and order_code are both just automatically-generated numbers in the orders table it doesn't add anything to make both of them part of a primary-key. I would delete the id column altogether and just have the order_code as the primary-key (since "order_code" carries more meaning to a human than "id"). This means your order_items table can then safely reference the order_code it wants to.
HTH
sure it did, thanks for your response, best regards, Gianluca Riccardi ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster