去掉数据重复增加两个字段alterTABLET_EmployeeAddFSubCompanyVARchar(20);ALTERTABLET_EmployeeADDFDepartmentVARCHAR(20);给新加的字段赋值UPDATET_EmployeeSETFSubCompany='Beijing',FDepartment='Development'whereFNumber='DEV001';UPDATET_EmployeeSETFSubCompany='ShenZhen'
去掉数据重复
增加两个字段
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_Employee
select distinct FDepartment,FSubCompany from T_Employee
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!