update test4_07
set sex=replace(sex,' ','')
8. 将pub用户下的Student_42及数据复制到主用户的表test4_08中,对表中的数据进
行整理,修复那些不规范的数据:
对班级列进行规范(需要先确定哪些班级不规范)。
create table test4_08 as select* from pub.student_42
update test4_08
set class=replace(class,'级','')
update test4_08
set class=replace(class,' ','')
9. 将pub用户下的Student_42及数据复制到主用户的表test4_09中,对表中的数据进
行整理,修复那些不规范的数据:
年龄为空值的根据出生日期设置学生年龄(年龄=2012-出生年份),年龄不为空值的不要改变。
create table test4_09 as select* from pub.student_42
update test4_09
set age=2012-extract(year from birthday)
where age is null
10. 将pub用户下的Student_42及数据复制到主用户的表test4_10中,对表中的数据
进行整理,修复那些不规范的数据:
(1) 剔除姓名列中的所有空格;
(2) 剔除院系名称列中的所有空格;
(3) 对性别列进行规范(需要先确定哪些性别数据不规范,也就是那些和大多数
不一样的就是不规范的);
(4) 对班级列进行规范(需要先确定哪些班级不规范)。
(5) 年龄为空值的根据出生日期设置学生年龄(年龄=2012-出生年份),年龄不为
空值的不要改变。
select *from pub.student_42
drop table test4_06
create table test4_10 as select* from pub.student_42
update test4_10
set name=replace(name,' ','')
update test4_10
set dname=replace(dname,' ','')
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库山东大学 数据库 实验四 复制表(5)在线全文阅读。
相关推荐: