1.时间:
①数据库中时间为字符串格式:进行有开始日期、结束日期的查询 select * from user_oper_log where oper_date<'20170101' and oper_date>'20120202';
比对方式是按照Ascii码从前到后比对大小,要注意有时面对字段下数据格式不规范时 此方法不可用
2.表结构相同的进行平移表、建表
①将一张表的内容平移到另一张——表结构相同
表1 cif 拥有字段 id name
表2 person 拥有 id name
要求:将表2 的所有(或满足条件)的内容移入 表1
sql语句: insert into cif select * from person where 1=1;(后面可以写条件语句)
总结: insert into 表名1 select * from 表名2 where 条件(可略)
② 创建已有表相同的 表结构的表
表1 cif 拥有字段 id name
要求:新建一张表( second) 同表1 cif 拥有相同的表结构,但是无数据
sql语句:create table second as select * from cif where 1=2;
总结: create table 表名2 as select * from 已有表 where1=2;