随笔分类 -  Oracle

摘要:今天看群里在讨论数据库死锁的问题,也一起研究了下,查了些资料在这里总结下。 所谓死锁: 是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去。此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程。 由于资源占用是互斥的 阅读全文
posted @ 2017-05-23 17:40 Jachin 阅读(458) 评论(0) 推荐(0)
摘要:create table A( id number(2) primary key, temp date); commit; insert into A values (1,to_date('2016-1-1','yyyy-mm-dd')); commit; select * from A; drop 阅读全文
posted @ 2017-05-21 11:55 Jachin 阅读(175) 评论(0) 推荐(0)
摘要:往Oracle数据库中插入日期型数据(to_date的用法) INSERT INTO FLOOR VALUES ( to_date ( '2007-12-20 18:31:34' , 'YYYY-MM-DD HH24:MI:SS' ) ) ; 查询显示:2007-12-20 18:31:34.0 I 阅读全文
posted @ 2017-05-21 11:23 Jachin 阅读(328) 评论(0) 推荐(0)
摘要:create table temp as select * from testtable; 阅读全文
posted @ 2017-05-15 22:53 Jachin 阅读(385) 评论(0) 推荐(0)
摘要:3张表 两个多对多,所以最后是5张表。用户表:用户ID,用户名用户—角色表:ID,用户ID,角色ID角色表:角色ID,角色名角色—权限表:ID角色ID,权限ID权限表:权限ID,权限名 阅读全文
posted @ 2017-05-13 00:34 Jachin 阅读(668) 评论(0) 推荐(0)
摘要:统计函数 AVG --求平均值 COUNT --统计数目MAX --求最大值MIN --求最小值SUM --求和--AVGuse panguselect avg(e_wage) as dept_avgWagefrom employeegroup by dept_id--MAX--求工资最高的员工姓名 阅读全文
posted @ 2017-05-12 22:35 Jachin 阅读(10759) 评论(0) 推荐(0)
摘要:--oracleselect * from( select rownum r,t.* from (select * from testtable)t where rownum<80)where r>=50; --sqlserverselect * from ( select ROW_NUMBER() 阅读全文
posted @ 2017-04-24 22:36 Jachin 阅读(1373) 评论(0) 推荐(0)
摘要:create table testtable( Tname nvarchar2(10), Tage number(2));commit; insert into testtable values('哈哈',32);insert into testtable values('嘿嘿',12);inser 阅读全文
posted @ 2017-04-16 22:26 Jachin 阅读(175) 评论(0) 推荐(0)
摘要:--查看表空间 select tablespace_name from dba_tablespaces; --查看表空间存放位置 select name from v$datafile; --删除用户(cascade包含数据库的关联) drop user yang cascade; --删除表空间( 阅读全文
posted @ 2017-04-16 01:36 Jachin 阅读(278) 评论(0) 推荐(0)