CREATE TABLE IF NOT EXISTS `huge`.`notes` ( `note_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `note_text` text NOT NULL, `user_id` int(11) unsigned NOT NULL, `note_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`note_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='user notes'; -- Foreign key constraint ALTER TABLE `notes` ADD CONSTRAINT `notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;