SQL学习笔记五去重,给新加字段赋值的方法

2023年 4月 17日 59.6k 0

去掉数据重复 增加两个字段 alter TABLE T_Employee Add FSubCompany VARchar(20); ALTER TABLE T_Employee ADD FDepartment VARCHAR(20); 给新加的字段赋值 UPDATE T_Employee SET FSubCompany='Beijing',FDepartment='Development' whe

去掉数据重复 增加两个字段 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

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论