常用SQL语句
select * from dba_users; 查看数据库里面所有用户,前提是你是有dba权限的帐号,如sys,system
select * from all_users; 查看你能管理的所有用户!
select * from user_users; 查看当前用户信息 !
select * from TRANS_ORGANIZATIONINFO where addtime > to_date('2021-1-1' ,'YYYY-MM-DD') hh24:mi:ss
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
UPDATE table_name SET FILEPATH=REPLACE(FILEPATH,'原子符','新字符'')
select seqname.currval from dual 查询序列当前值
select seqname.nextval from dual 查询序列下一值
with m as (select * from table_name ) select * from m order by id desc
select rownum r,e.* from person e where rownum <=10----查询前十行
SELECT COUNT(EMPBH),DEPTNAME FROM b_person GROUP BY DEPTNAME ---查询每个部门下有多少个员工
select rownum r,e.* from person e where rownum <=10----查询前十行
SELECT COUNT(EMPBH),DEPTNAME FROM b_person GROUP BY DEPTNAME ---查询每个部门下有多少个员工
select 某列,count(某列) from 表名 group by 某列 having count(某列)>1 ---查询某列是否有重复数据
trunc(to_number((TO_DATE(ADDTIME, 'YYYY-MM-DD HH24:mi:ss') - TO_DATE('1970-01-01 08:00:00','YYYY-MM-DD HH24:mi:ss')) * 86400)) * 1000----日期转换为时间戳
case 字段 when '1' then '2' else '3' end ---if else语句
TRUNCATE table TABLENAME cascade; --清空有大量数据的表
----分组和聚合函数
select wm_Concat(unitbh) idStr from (SELECT to_number(REGEXP_SUBSTR(val, '[^,]+', 1, LEVEL) )-15000000 as unitbh
FROM fexchange.FILETEMPLCONTENT where filetemplateid=541 and id=1645
CONNECT BY LEVEL <= REGEXP_COUNT(val, '[^,]+')
AND ROWID = PRIOR ROWID
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL)