为表中的字段添加数据:
INSERT INTO 表名(字段名1,字段名2,……)VALUES(值1,值2,……);
create database chapter3;
use chapter3;
create table student(
id int(4),
name varchar(20) not null,
grade float
);
//全字段
insert into student(id,name,grade)
value(1,'zhangsan',98.5);
select *from student;
//不指定字段
insert into student values(1,'l李四',95.5);
insert into student(id,name)
//指定字段(没添加值的字段为NULL)
values(4,'zhaoliu');
select *from student;
//同时添加多条记录
insert into student values
(5,'zhangsan',98.5),
(6,'zhangsan',98.5),
(7,'zhangsan',98.5);