Insert Data – Auto incremental handling

When you insert a record, if column “id” has been set “auto_increment” and you don’t want to calculate the next “id” by yourself. You can set the value of “id” 0 so that MySql will create a new “id” automatically. Here is the example:

INSERT INTO `project_plans` (`id`, `project_id`, `project_subcategory_id`, `plan_id`, `sort_order`, `title`, `content`, `created_time`, `updated_time`) VALUES (0, 1, 2, 3, 4, ‘title’, ‘content’, ‘2010-1-1’, ‘2010-1-1’)