mysql怎么插入记录文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
1、插入指定列,如果没有列出这个列,自动给null赋值。如果不插入列,设置非空约束,会报错。文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
2、插入所有列,如果哪个列不想插入值,就需要赋值为null。文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
实例文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
insertinto表名values(值,值....); eg: insertintoproductvalues(null,'苹果电脑',18000.0,10); insertintoproductvalues(null,'华为5G手机',30000,20); insertintoproductvalues(null,'小米手机',1800,30); insertintoproductvalues(null,'iPhonex',8000,10); insertintoproductvalues(null,'iPhone7',6000,200); insertintoproductvalues(null,'iPhone6s',4000,1000); insertintoproductvalues(null,'iPhone6',3500,100); insertintoproductvalues(null,'iPhone5s',3000,100); insertintoproductvalues(null,'方便面',4.5,1000); insertintoproductvalues(null,'咖啡',11,200); insertintoproductvalues(null,'矿泉水',3,500);
以上就是mysql插入记录的两种方式,希望对大家有所帮助。文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
文章源自飞鸟学习网-https://www.pk88.net/2022-0301-26.html
全站资源源于网络整合,仅供学习研究,不可商用,不提供技术指导,如有侵权请告知删除,可以投稿,广告合作联系V: pk88net

我的微信
微信扫一扫
评论