下载后可任意编辑附录资料:不需要的可以自行删除年数据库-oracle-学习之路1.数据库基础2. 数据库主键生成Select Substr(To_char(dbms_random.value), 2, 22) || getUUID.NextvalFrom dual ;3. 数据库空间查询--表空间在哪些空间下select df.tablespace_name "表空间名",totalspace "总空间 M",freespace "剩余空间 M",round((1-freespace/totalspace)*100,2) "使用率%"from(select tablespace_name,round(sum(bytes)/1024/1024) totalspacefrom dba_data_filesgroup by tablespace_name) df,(select tablespace_name,round(sum(bytes)/1024/1024) freespacefrom dba_free_spacegroup by tablespace_name) fswhere df.tablespace_name=fs.tablespace_name;--查用户下所用空间SELECT owner, tablespace_name, ROUND (SUM (BYTES) / 1024 / 1024, 2) "USED(M)" FROM dba_segmentsGROUP BY owner, tablespace_nameORDER BY SUM (BYTES) DESC;--查用户下所有表所占空间select OWNER, t.segment_name, t.segment_type, sum(t.bytes / 1024 / 1024) mmm from dba_segments t where t.owner = 'JIANGSU' and t.segment_type='TABLE' group by OWNER, t.segment_name, t.segment_type下载后可任意编辑 order by mmm desc;4. oracle 之删除重复数据select a.rowid,a.* from 表名 a where a.rowid != (select max(b.rowid) from 表名 b where a.字段 1 = b.字段 1 and a.字段 2 = b.字段 2 )---删除delete from 表名 a where a.rowid != (select max(b.rowid) from 表名 b where a.字段 1 = b.字段 1 and a.字段 2 = b.字段 2 )5. oracle 之查询数据第一条记录select * from tab rownum<26. oracle 之存储过程/函数等书写规则7. oracle 之正则表达式函数:regexp_like、regexp_substr、regexp_instr、regexp_replace(http://blog.csdn.net/heicm/article/details/6336087)Oracle 使用正则表达式离不开这 4 个函数:1。regexp_like2。regexp_substr3。regexp_instr4。regexp_replace下载后可任意编辑看函数名称大概就能猜到有什么用了。regexp_like 只能用于条件表达式,和 like 类似,但是使用的正则表达式进行匹配,语法很简单:regexp_substr 函数,和 substr 类似,用于拾取合符正则表达式描述的...