package com.util; import java.text.DateFormat; import java.util.Calendar; import java.util.Date; public class Test { public void getTimeByDate(){ Date date = new Date(); DateFormat df1 = DateFormat.getDateInstance();//日期格式,精确到日 System.out.println(df1
表中一定要有主键 : select :id,此处的id位置处必须是主键 insert into table_name(id, name, password) select :id, :name, :password from dual where not exists ( select * from table_name where id = :id )
我们知道通过insert into 表名(列名) values(值)是向表中插入一条语句,可是当我们需要向数据库插入多条语句时,应该怎么做呢? 可以通过如下格式的sql 语句来实现一次向数据库插入多行语句: insert into 表名(列名) select 值1 union all select 值2 union all select 值3 例如: insert into int_browermark (id,mark)select 1,'test7' union allselect 1,'t