随笔分类 - SQL
摘要:select A.key from A LEFT JOIN B ON A.KEY=B.KEY WHERE B.FIELD IS NULL;
阅读全文
摘要:1. LOOP - END LOOP - EXIT declare v_rlt number(8):=3; begin v_rlt:=1; loop dbms_output.put_line('loop'||v_rlt); v_rlt := v_rlt + 1; EXIT WHEN v_rlt >3; end loop; end; /
阅读全文
摘要:UPDATE table1 t1 SET (name, desc) = (SELECT t2.name, t2.desc FROM table2 t2 WHERE t1.id = t2.id) WHERE EXISTS ( SELECT 1 FROM table2 t2 ...
阅读全文
摘要:SELECT * FROM my_table WHERE UPPER(some_field) != some_field
阅读全文
摘要:【唯一】DISTINCT与UNIQUE的“区别” 今天一个朋友在Oracle中偶然发现UNIQUE也可以得到唯一的数据结果,问到DISTINCT与UNIQUE的区别。答案是:他们没有区别! distinct这个关键字来过滤掉多余的重复记录只保留一条,但往往只用 它来返回不重复记录的条数,而不是用它来
阅读全文
摘要:This is an Oracle-specific notation for an outer join. It means that it will include all rows from t1, and use NULLS in the t0 columns if there is no
阅读全文
摘要:notFound = 1403L; .dupKey = -1L; openCloseErr = -2117L; cursorNotOpenErr = -1002L; .nullCursor = -1405L; noMatchVal = 99L; multRowsOnSelect = -2112L;
阅读全文
摘要:The operation cannot be rolled back. DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command. Therefore DELETE operations can be rolled ba
阅读全文
摘要:select * from nls_database_parameters where parameter ='NLS_CHARACTERSET'; PARAMETER VALUE NLS_CHARACTERSET AL32UTF8 select * from nls_instance_parame
阅读全文
摘要:create table OFFLINE_CONTORL2 as select * from OFFLINE_CONTROL where 1=2;
阅读全文
摘要:select * FROM all_constraints where CONSTRAINT_NAME='SYS_xxx'
阅读全文
摘要:http://www.cnblogs.com/ztf2008/archive/2009/05/16/1458432.html Blob是指二进制大对象也就是英文Binary Large Object的所写;Clob是指大字符对象也就是英文Character Large Object的所写。因此这两个
阅读全文
摘要:http://www.cnblogs.com/8765h/archive/2011/11/25/2374167.html delete 语句是数据库操作语言(dml) drop、truncate都是DDL语句(数据定义语言),执行后会自动提交。
阅读全文
摘要:Sql语言被分为四大类:数据查询语言(DQL),数据操纵语言(DML),数据定义语言(DDL),数据控制语言(DCL)。 1. 数据查询语言(DQL) 数据查询语言基本结构由select子句,from子句,where子句组成的查询块: select [字段名] from [表或视图名] where
阅读全文
摘要:例1:建立一个名为xhkdb的数据库 mysql> create database xhkdb; 例2:显示数据库 命令:show databases (注意:最后有个s)mysql> show databases; 例3:删除数据库 例如:删除名为 xhkdb的数据库mysql> drop dat
阅读全文