View Full Version : MYSQL Keys

12-11-2006, 03:34 PM
i would like to ask something on mysql. let say i want to create a table which consists of one foreign key, and this foreign key is the primary key of its original table. when i code it, do i have to put 'default NULL' or 'NOT NULL'. im a bit confused because primary key cannot be NULL but since i want to declare it as a foreign key in another table, what do i have to put there . thanks alot for your help

12-11-2006, 03:52 PM
post your DDL


CREATE TABLE `ticket` (
`ticket_id` int(11) NOT NULL default '0',
`data` int(11) default NULL,
PRIMARY KEY (`ticket_id`)