54. 如何知道数据裤中某个表所在的tablespace? select tablespace_name from user_tables where table_name='TEST'; select * from user_tables中有个字段TABLESPACE_NAME,(oracle); select * from dba_segments where …; desc user_tables; select tablespace_name from user_tables wher
基本涵盖了oracle的各个方面: oracle day3 笔记 外连接: 查找每个员工的经理ID select e.first_name "Employee",m.first_name "Manager" from s_emp e,s_emp m where e.manager_id=m.id(+); 一、组函数 group 组 group by 分组子句,按指定的分组规则分组 . group by子句也会出发排序操作,会按分组字段排序。 select [组函数或分组的字段名] ,... f
**多表查询 *笛卡尔积(m*n) +select e.LAST_NAME,d.NAME from s_emp e,s_dept d *笛卡尔积+连接条件 + select e.LAST_NAME,d.NAME from s_emp e,s_dept d where e.DEPT_ID = d.ID; *内连接 (... inner join ... on ...) +等值连接 -select e.LAST_NAME,d.NAME from s_emp e inner join s_dept
rem rem $Header: summit2.sql 27-jun-2000.12:30:22 slari Exp $ rem rem Copyright (c) 1991, 2000 Oracle Corporation. All rights reserved. rem rem NAME rem summit2.sql - rem DEscr iptION rem rem RETURNS rem rem FUNCTION rem Create and populate tables
1:找出公司里收入最高的前三名员工: SQL> select rownum, last_name, salary 2 from (select last_name, salary 3 from s_emp 4 order by salary desc) 5 where rownum select rownum, last_name, salary 2 from s_emp 3 where rownum<=3 4 or der by salary desc; ROWNUM LAST_
最经典的Oracle练习题,查看员工的id,last_name,salary,部门名字,区域名字,这些员工有如下条件: 薪资大于chang所在区域的平均工资或者跟chang员工不在同个部门(24) select e.id,e.last_name,e.salary,d.name,r.name from s_emp e,s_dept d,s_region r where e.dept_id=d.id and d.region_id=r.id and(e.salary > (select av