![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
zqq3436
努力不平庸
展开
-
informix重建主键索引(修改主键)
alter table tableName drop constraint pk_name;alter table tableName add constraint primary key(id) constraint pk_name;原创 2018-06-26 16:28:01 · 4187 阅读 · 0 评论 -
Hibernate批量更新(实时插入数据库,不通过缓存)
代码如下:StringBuffer quyHql = new StringBuffer(); quyHql.append(" from User where userId=? and status=?"); // 使用无状态的session实现实时操作数据库 StatelessSession session = getSessionFactory().openStat...原创 2018-06-28 17:07:30 · 3897 阅读 · 0 评论 -
informix分组查询,并取出每个分组中的一条记录
select a.doc_title,a.sub_content_id from (select doc_title,sub_content_id,ROW_NUMBER() over(partition by sub_content_id order by doc_title) as new_index from inform) a where a.new_index=1解释:in...原创 2018-08-10 13:01:10 · 3058 阅读 · 1 评论 -
informix更新一张表的字段为另一张表对应的某个字段
update tableA set file_no = (select b.doc_title from tableB b where b.doc_no=tableA.doc_no) where doc_no=''注:informix的update操作不支持表别名,所以要更新的表,不能添加别名。 ...原创 2018-08-14 21:32:59 · 4183 阅读 · 0 评论 -
Oracle在left join中使用子查询( ORA-01799: 列不能外部联接到子查询)
informix改oracle遇到一个问题。注意:left join的第二张表,有多条数据,只取符合条件的一条(本例中取出actn_numb最大的一条记录)。 基础数据准备:create table A( id number primary key, act varchar2(100));create table B( id number, ...原创 2018-12-18 13:32:30 · 11492 阅读 · 1 评论 -
Oracle创建表空间、新增用户
--查询表空间SELECT tablespace_name,file_id,file_name,round(bytes / (1024 * 1024), 0) total_spaceFROM dba_data_filesORDER BY tablespace_name;--创建表空间"newTabSpace"CREATE TABLESPACE "newTabSpace" ...原创 2018-12-18 13:39:58 · 339 阅读 · 0 评论