Foreign key,local key?
- by user198729
CREATE TABLE products (
     id integer unsigned auto_increment primary key
) ENGINE=INNODB;
CREATE TABLE orders (
     id integer PRIMARY KEY auto_increment,
     product_id integer unsigned,
     quantity integer,
     INDEX product_id_idx (product_id),
     FOREIGN KEY (product_id) REFERENCES products (id)
) ENGINE=INNODB;
Here the products and orders obviously have some kind of relation--foreign key relation.
Also a coin has two sides,so I'm doubting how do we say which table is the foreign key side or local key side?