i want to make a database which have two tables like this;
customers(customerid, name, address, city)
orders(orderid, customerid, amount, date)
you see i want to make customerid in customers and orderid in orders primary keys for those tables. i can do it.
and i want customerid in orders to be foreign key. but i can't do it. how can make it as a foreign key?
thank all in advance
foreign key
Moderator: General Moderators
it may be the main reason. because i found a command which ends InnoDB(... FOREIGN KEY (customer_id)Hornet83 wrote:As far as I know, foreign keys are not supported in non-InnoDB storage engines. As long as you are careful to join on the required keys in your SQLs, there is no need to define the customerid attribute as foreign in the orders entity.[/i]
REFERENCES customer(id)) ENGINE=INNODB;) . but i did not understand why i don't need foreign key, as i have understood from the book i studied (php and mysql laura thomson, luke welling) it is necessary. and the other, in phpmyadmin there is button to make something to primary key, but non to make it foreign key. may be it relates with innodb engine again
thanks all in advance