I am a newbie to database and Yii framework. So I want to know that is it necessary to declare foreignkey constraint in the database or just by using codes to use as foreignkey is good?
CREATE TABLE IF NOT EXISTS `tbl_member` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`firstname` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`lastname` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`gender` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`membersince` datetime NOT NULL,
PRIMARY KEY (`id`),
----------------------------------
KEY `FK_member_group` (`group_id`)
----------------------------------
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=34 ;