insert into 表名(列名列表) values(值列表);
注意:
1)添加一条记录
2) 值列表的顺序和类型及个数 与列名列表对应的
3) 值列表中除了数值类型外,其他类型的值使用单引号引起来。
4) 给可空列赋值为空 4.1)列列表中不写此列 4.2)值写为null
5)给有默认值的列直接使用默认值时 5.1) 列列表中不写此列 5.2) 值写为default
6) 列名列表可以省略,注意值列表的顺序要与定义表时列的顺序一致 (不建议使用)
select * from studentInfo;
insert into studentInfo(studentId,stuName,sex,age,phone ,email,address) values(1,'张三','男',21,'32165498747','zhang@126.com','北京海淀');
insert into studentInfo(studentId,stuName,sex,age,phone ,email,address) values('张三',1,'男',21,'32165498747','zhang@126.com','北京海淀');--类型不一致错误
insert into studentInfo(studentId,stuName,sex,age,phone ,email,address) values(2,'张帅','女',21,'32165498745','zhang@126.com');--没有足够的值
insert into studentInfo(studentId,stuName,sex,age,phone ,email,address) values(2,'张帅','男',21,'32165498745','zhang@126.com','北京海淀','描述'); --值过多
insert into studentInfo(studentId,stuName,sex,age,phone ,email) values(2,'张帅','男',21,'32165498745','zhang@126.com');
insert into studentInfo(studentId,stuName,sex,age,phone ,email,address) values(9,'大山','男',22,null,'oracle@126.com',null);
insert into studentinfo(studentId,stuName,age,phone,address) values(10,'李林',21,'14785236956','北京西城');
insert into studentInfo(studentid,stuname,sex,age, phone,email,address) values(11,'蔡徐坤',default,20,'45632178954',default,null);
insert into studentinfo values(12,'邓伦',default,22,null,null,default);
commit;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。