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 reference option. mysql> mysql> show tables; +---------------------------+ | Tables_in_rome_aggregator | +---------------------------+ | feeds | | links | | pages | +---------------------------+ 3 rows in set (0.00 sec) mysql> mysql> describe feeds; +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | created | datetime | NO | | NULL | | | accessed | varchar(45) | NO | | NULL | | | url | varchar(767) | NO | UNI | NULL | | | status | int(11) | NO | | 0 | | +----------+--------------+------+-----+---------+----------------+ 5 rows in set (0.05 sec) mysql> mysql> describe links; +---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | created | datetime | NO | | NULL | | | feed_id | int(11) | NO | | 0 | | | link | varchar(767) | NO | UNI | NULL | | | status | int(11) | NO | | 0 | | +---------+--------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec) mysql> While I know that I should alter the table, I don't know the syntax to establish the foreign key constraint. thanks, Thufir -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql