Re: alter table for foreign key

2014-11-17 Thread thufir
On Mon, 17 Nov 2014 10:59:15 +0100, Martijn Tonies (Upscene Productions) wrote: > In general, an "index" is used for performance, while a "constraint" is > used for logical concepts, like uniqueness. Most often, the DBMS uses an > index to implement these logical concepts, but it's better to unde

Re: alter table for foreign key

2014-11-17 Thread Martijn Tonies (Upscene Productions)
On 14-11-17 01:42 AM, thufir wrote: Looking at the docs: http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html how do I alter the child table, links, so that it has a foreign key with the parent table, feeds? The workbench GUI came up with: ALTER TABLE `rome_aggregator`.`link

Re: alter table for foreign key

2014-11-17 Thread thufir
On 14-11-17 01:42 AM, thufir wrote: Looking at the docs: http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html how do I alter the child table, links, so that it has a foreign key with the parent table, feeds? The workbench GUI came up with: ALTER TABLE `rome_aggregator`.`link

Re: alter table for foreign key

2014-11-17 Thread Martijn Tonies (Upscene Productions)
Hi, This is an example: ALTER TABLE cart ADD CONSTRAINT fk_cart_customers FOREIGN KEY (custid) REFERENCES customers (custid) ON DELETE CASCADE ON UPDATE NO ACTION; (take from the GUI tool Database Workbench, avoids having to know the syntax ;) ) With regards, Martijn Tonies Upscene Prod

alter table for foreign key

2014-11-17 Thread thufir
Looking at the docs: http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html how do I alter the child table, links, so that it has a foreign key with the parent table, feeds? The feed_id field in links should, in fact, be constrained by the foreign key of feeds with a RESTRICT re