查询第一条数据select * from tableName where rownum <= 1修改列名:ALTER TABLE BD_PRI RENAME COLUMN EU_PRIMD TO CODE修改列类型:ALTER TABLE TableName MODIFY(CODE VARCHAR(...
分类:
数据库 时间:
2015-08-04 18:42:23
阅读次数:
124
UserMapper.xml文件
select * from user where id=#{id}
select * from user where us...
分类:
数据库 时间:
2015-08-04 17:14:59
阅读次数:
150
Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print t...
分类:
其他好文 时间:
2015-08-04 15:46:28
阅读次数:
112
BEGIN TRY -- Generate a constraint violation error. DELETE FROM Production.Product WHERE ProductID = 980;END TRYBEGIN CATCH SELECT ...
分类:
数据库 时间:
2015-08-04 15:25:02
阅读次数:
138
SQL: select * from table where id IN (3,6,9,1,2,5,8,7); 这样的情况取出来后,其实,id还是按1,2,3,4,5,6,7,8,9,排序的,但如果我们真要按IN里面的顺序排序怎么办?sql: select * from table where id...
分类:
数据库 时间:
2015-08-04 14:58:00
阅读次数:
155
处理百万级以上的数据提高查询速度的方法:1.应尽量避免在where子句中使用!=或操作符,否则将引擎放弃使用索引而进行全表扫描。2.对查询进行优化,应尽量避免全表扫描,首先应考虑在where及orderby涉及的列上建立索引。3.应尽量避免在where子句中对字段进行null值判断,否则将导致引擎放...
分类:
数据库 时间:
2015-08-04 14:54:13
阅读次数:
127
Alias(别名) ????eg(使用表名称别名):? ?????????select po.orderid,p.lastname,p.firstname from persons as p,product_orders as po where p.lastname=‘adams‘ and p.firstname=‘john‘(使用别...
分类:
数据库 时间:
2015-08-04 13:45:29
阅读次数:
192
--查询重复数据--SELECT XYH,COUNT(*) FROM BGJL GROUP BY XYH having(count(*)>1) --删掉重复数据--DELETE from BGJL WHERE (XYH) IN ( SELECT XYH FROM BGJL GROUP BY XYH ...
分类:
数据库 时间:
2015-08-04 13:19:40
阅读次数:
132
oracle之sql语句优化 sql语句的优化 1.在where子句中使用 is null 或 is not null 时,oracle优化器就不能使用索引了. 2.对于有连接的列,即使最有一个是静态的值,优化器也不会使用索引 比如: select * from employss whe...
分类:
数据库 时间:
2015-08-04 13:12:36
阅读次数:
175
update hr_user u set u.is_approve=(case when u.curr_org_id in (select t.org_id from hr_organization t ...
分类:
数据库 时间:
2015-08-04 12:58:26
阅读次数:
104