这是刚开始建的表(名叫:stuinfo)
1.查询出所有女生的名字
select * from stuInfo where stuSex='女';
2.将学生星星的名字修改为月亮
update stuinfo set stuName='月亮' where stuName='星星';
3.向表中插入一个学生编号:123
给id增加默认增长值:
alter table stuinfo modify stuid int(11) unsigned auto_increment;
给name增加默认值:
alter table stuinfo alter column stuname set default 'null';
插入编号:
insert into stuinfo (stuid) values(123);
4.将学号为123的学生的名字修改为'孙大圣',性别为'男'
update stuinfo set stuName='孙大圣' where stuId=123;
update stuinfo set stuSex='男' where stuId=123;
5.删除学生名字是aa的学生信息
delete from stuinfo where stuName='aa';
6.向表中新添加一列学生的电话号码,将电话号码都给定不同的值
alter table stuinfo add column phonenum varchar(20) unique key;
经过以上操作后,表变化成: