--修改
--语法
--update 表名 set 字段1=值1,字段2=值2 where 条件
--工资条,每人加薪1000元
update People set PeopleSalary=PeopleSalary+1000
--将员工编号为7的人加薪500
update People set PeopleSalary=PeopleSalary+500 where PeopleId=7
--将软件部门的员工(编号1)工资少于15000的调成15000
update People set PeopleSalary=15000
where DepartmentId=2 and PeopleSalary<=15000
--修改翠红的工资为原来的两倍并将地址改为北京
update People set PeopleSalary=PeopleSalary*2,PeopleAddress='北京' where PeopleName='翠红'
--删除数据
--语法
--delete from 表名 where 条件
--删除企划部(部门编号3)中工资高于8000的
delete from People where DepartmentId=3 and PeopleSalary>8000
--关于删除(drop ,truncate,delete)
--删除表对象(右键删除) drop table People
--删除数据(清空数据),表对象即表结构依然存在 truncate table People
--删除所有数据,表对象即表结构依然存在 delete from People
--truncate和delete的区别
--truncate清空所有数据,不能有条件;delete可以删除所有数据,也可以删除对应条件的数据
--自动编号:
--假设表中自动编号为1,2,3,4,5
--使用truncate清空数据后再添加数据,编号仍然是1,2,3,4,5
--使用delete删除数据后再添加数据,删除的自动编号将永远不存在了
--如果使用delete删除了所有数据之后再添加数据,编号就变成了6,7,8,9,10