PDA

View Full Version : MYSQL Keys


red_rose
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

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

like

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