oracle---synonym, sequence,view
introduce the synonym, sequence and view in oracle[@more@]同义词 synonym create synonym synonym for schema.object 隐藏对象的名称和所有者:select count(*) from hr.employees;create synonym emp for hr.employees; --默认属于donny用户,是donny的私有对象privateselect count(*) from emp; 为分布式数据库的远程对象提供了位置透明性:访问其他数据库时,要首先建立数据库连结:create database link test_link连接名字,利用该名字就可以直接上数据库) connect to username(连接远程数据库时的用户名) identified
Java基础之关键字
1, which of the following are keywords or reserved words in java? a) if b)then c)goto d)while e)case f)sizeof 2, which of the following are java key words? a)double b)Switch c)then d)instanceof 3, which of these are key words in java? a) default b)NULL c)String d)throws e)long f)true[@more@]答案来了 1,acde 2,ad 3,adef 解释来了 1,then和sizeof都不是java的关键字 2,所有的关键字都是小写的,所以Switch不是关键字。instanceof看上去像方法名,但其实是关键字; 3,大写的NULL不是java语言的
oracle sql 语法之 over (partitioin by ...)
select * from test 数据: A B C 1 1 1 1 2 2 1 3 3 2 2 5 3 4 6 ---将B栏位值相同的对应的C 栏位值加总 select a,b,c, SUM(C) OVER (PARTITION BY B) C_Sum from test A B C C_SUM 1 1 1 1 1 2 2 7 2 2 5 7 1 3 3 3 3 4 6 6 The GROUP BY solution results into one row per group, but the SUM over (partitioin by ...) solution returns the summary value for each detail row. Thus, you have both detail and summary data available at the same time, making it easy to compare each re
选用 IN 还是 EXISTS,哪个性能更好
有时候会将一列和一系列值相比较。最简单的办法就是在where子句中使用子查询。在where子句中可以使用两种格式的子查询。第一种格式是使用IN操作符:... where column in(select * from ... where ...); 第二种格式是使用EXIST操作符:... where exists (select 'X' from ...where ...); [@more@] 我相信绝大多数人会使用第一种格式,因为它比较容易编写,而实际上第二种格式要远比第一种格式的效率高。可以几乎将所有的IN操作符子查询改写为使用EXISTS的子查询。第 二种格式中,子查询以‘select 'X'开始。运用EXISTS子句不管子查询从
随机取表中数据
在pl/sql中有张1000条记录的表。如果想随机抽取其中50条记录该如何操作呢?[@more@]利用select *from (select *from t order by dbms_random.value) where rownum<10;for example:SQL> select count(*) from all_objects; COUNT(*)---------- 23910SQL> create table seaman_t as select * from all_objects where rownum <=2000;Table created.SQL> select object_name, object_id from ( select object_name, object_id from seaman_t where object_name like '%%' order by dbms_random.random ) where rownum &
Oracle/PLSQL: Foreign key with cascade delete
Source:http://www.techonthenet.com/oracle/foreign_keys/foreign_delete.phpWhat is a foreign key?A foreign key means that values in one table must also appear in another table.The referenced table is called the parent table while the table with the foreign key is called child table. The foreign key in the child table will generally references a primary key in the parent table. [@more@]A foreign key with cascade delete means that if a record in the parent table is deleted, then the corresponding r
Linux / Unix Command: bc
bc is an arbitrary precision calculator language.[@more@]If you need to deal with Big Numbers, the unix bc is the tool. It can perform math operations as large as the ram and swap space can hold.