本文主要是介绍MySQL数据操纵,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
插入数据
INSERT:
insert into stu (stuID,stuName,stuSex,stuBirth,stuSchool) values ('20160111001','张晓雯','女','1997-08-17','飞行技术学院');
遇到个问题解决一下:https://blog.csdn.net/yabingshi_tech/article/details/51010047
insert into stu values ('20160211011','李雪梅','女','1','1997-07-19','交通运输学院'),('20160310022','张志斌','男','1','1998-07-10','航空工程学院');
insert into stu set stuID='20160411033',stuName='王雪蕊',stuSex='女',stuBirth = '1997-05-17',stuSchool = '外国语学院';
select * from stu;
use student;create table xsxx(xh varchar(11),xb varchar(2));insert into xsxx select stuID,stuSex from stu;select * from xsxx;
REPLACE:
insert into stu values('20160111001','王小强','男','1','1997-08-17','飞行技术学院');
error;(竟然没报错。。。)
replace into stu values('20160111001','王小强','男','1','1997-08-17','飞行技术学院');
删除数据
delete:
delete from xsxx where xb='男';
delete from xsxx order by xh desc limit 2;
truncate:
truncate table xsxx;
修改数据:
update:
update stu set stuSex='女',stuBirth='1998-08-17' where stuID='20160111001';update stu set stuSchool='飞行技术学院' limit 3;update score set score=score-2 where courseID='E2201040' order by score desc limit 2;
update stu,score set stu.Stuschool = '计算机学院',score.score=score.score-5 where stu.stuID=score.stuID and stu.stuID='20160111001';
这篇关于MySQL数据操纵的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!