SQL Server SQL学习笔记五去重,给新加字段赋值的方法
2022-11-12 09:47:23
内容摘要
这篇文章主要为大家详细介绍了SQL Server SQL学习笔记五去重,给新加字段赋值的方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc笔记做的技术笔记!去掉数
文章正文
这篇文章主要为大家详细介绍了SQL Server SQL学习笔记五去重,给新加字段赋值的方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc笔记做的技术笔记!
去掉数据重复增加两个字段alter TABLE T_Employee Add FSubCompany VARchar(20);ALTER TABLE T_Employee ADD FDepartment VARCHAR(20);给新加的字段赋值UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Development' where FNumber='DEV001';UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='Development' where FNumber='DEV002';UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='HumanResource' where FNumber='HR001';UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='HumanResource' where FNumber='HR002';UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='InfoTech' where FNumber='IT001';UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='InfoTech' where FNumber='IT002';UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Sales' where FNumber='SALES001';UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Sales' where FNumber='SALES002';UPDATE T_Employee SET FSubCompany='ShenZhen',FDepartment='Sales' where FNumber='SALES003';查询并去重select distinct FDepartment from T_Employeeselect distinct FDepartment,FSubCompany from T_Employee注:关于SQL Server SQL学习笔记五去重,给新加字段赋值的方法的内容就先介绍到这里,更多相关文章的可以留意
代码注释