关于sql

oracle

  drop        table 表    删表,ddl,与表相关存储过程变为invalid

  truncate  table 表    清空表以及索引占用空间,ddl,不回滚

  delete from 表 where  字段 = ''

select COUNT(*) from SYS_LOG t WHERE trunc(t.create_date) = to_date(to_char(Sysdate,'yyyy-MM-dd'),'yyyy-MM-dd') AND operation = '用户登陆'
ORDER BY cast(SHEET_NO as int) asc
order by  case when t3.property_value is null then 1
else 0
end,
t2.PROPERTY_ROW_NUM asc


foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合。foreach元素的属性主要有item,index,collection,open,separator,close。item表示集合中每一个元素进行迭代时的别名,index指 定一个名字,用于表示在迭代过程中,每次迭代到的位置,open表示该语句以什么开始,separator表示在每次进行迭代之间以什么符号作为分隔 符,close表示以什么结束,在使用foreach的时候最关键的也是最容易出错的就是collection属性,该属性是必须指定的,但是在不同情况 下,该属性的值是不一样的,主要有一下3种情况: 
1. 如果传入的是单参数且参数类型是一个List的时候,collection属性值为list 
2. 如果传入的是单参数且参数类型是一个array数组的时候,collection的属性值为array 
3. 如果传入的参数是多个的时候,我们就需要把它们封装成一个Map了,当然单参数也可以封装成map,实际上如果你在传入参数的时候,在breast里面也 是会把它封装成一个Map的,map的key就是参数名,所以这个时候collection属性值就是传入的List或array对象在自己封装的map 里面的key

批量增加

<insert id="batchSaveUser">
        insert into t_user (user_name,sex) values
        <!-- 动态SQL之foreach的用法 -->
        <!-- collection="users" 用于指定循环集合的名称,如果接口中并未指定参数别名,那么默认就是list
         item="u" 用于指定每次循环后的对象的别名
         separator="," 用于指定每次循环后之间的分割符-->
        <foreach collection="users" item="u" separator=",">
            (#{u.userName},#{u.sex})
        </foreach>
    </insert>

 

批量删除

<delete id="batchDeleteUser">
        delete from t_user where id in (
        <foreach collection="ids" item="id" separator=",">
            #{id}
        </foreach>
        )  

 </delete>

<!-- 第二种批量删除的写法 -->

<!-- open表示该语句以什么开始,close表示以什么结束 -->

<delete id="batchDeleteUser">
        delete from t_user where id in 
        <foreach collection="ids" item="id" separator="," open="(" close=")">
            #{id}
        </foreach>

</delete>

nvarchar2   上限4000

 varchar2   上限4000

 

 

 

 

 

 

 

redis(非关系型数据库)

  五种数据类型:string(字符串),hash(哈希),list(列表),set(集合)及zset(sorted set:有序集合)

  TTL命令用于获取键到期的剩余时间,返回以毫秒为单位的整数值或负值

    返回-1,表示key没有到期超时

    返回-2,表示键不存在。  

  1. https://blog.csdn.net/li772030428/article/details/53693266
  2. https://www.jb51.net/article/141884.htm

posted on 2018-12-07 12:10  runoob!  阅读(211)  评论(0)    收藏  举报

导航