语法
INSERT INTO table_name ( field1, field2,...fieldN )
VALUES
( value1, value2,...valueN );
例子
//结构
CREATE TABLE `user` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(10) NOT NULL,
`sex` tinyint(4) NOT NULL,
`tel` char(11) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
//插入单条数据
INSERT INTO `user` ( name, sex, tel )
VALUE
( '张三', 1, '13800138000' )
//插入多条数据
INSERT INTO `user` ( name, sex, tel )
VALUE
( '张四', 1, '13800138001' ),
( '王五', 0, '13800138002' ),
( '赵六', 0, '13800138003' )
网友评论