Emp Table epdept 테이블 :
캘리 레이트 등급 테이블 Salgrading Question 요구 사항 : Oracle 데이터베이스 Scott 모드의 EMP 테이블 및 부서 테이블을 기반으로 다음 작업을 완료하십시오. .
(1)查询20号部门的所有员工信息。 select * from emp where deptno = 20; (2)查询所有工种为CLERK的员工的工号、员工名和部门名。 select empno,ename,deptno from emp where job like 'CLERK'; (3)查询奖金(COMM)高于工资(SAL)的员工信息。 select * from emp where comm > sal; (4)查询奖金高于工资的20%的员工信息。 select * from emp where comm > (sal*0.2); (5)查询10号部门中工种为MANAGER和20号部门中工种为CLERK的员工的信息。 select * from emp where (deptno = 10 and job like 'MANAGER') or (deptno = 20 and job like 'CLERK'); (6)查询所有工种不是MANAGER和CLERK,且工资大于或等于2000的员工的详细信息。 select * from emp where job not in ('MANAGER','CLERK') and sal >= 2000 ; (7)查询有奖金的员工的不同工种。 select distinct job from emp where comm is not null; (8)查询所有员工工资和奖金的和。 select ename,(sal+nvl(comm,0)) salcomm from emp; (9)查询没有奖金或奖金低于100的员工信息。 select * from emp where (comm is null or comm < 100) ; (10)查询各月倒数第2天入职的员工信息。 select * from emp where hiredate in (select (last_day(hiredate)-1) from emp); (11)查询员工工龄大于或等于10年的员工信息。 select * from emp where (sysdate - hiredate)/365 >= 10 ; (12)查询员工信息,要求以首字母大写的方式显示所有员工的姓名。 select upper(substr(ename,1,1)) || lower(substr(ename,2,length(ename)-1)) from emp; (13)查询员工名正好为6个字符的员工的信息。 select * from emp where length(ename)= 6 ; (14)查询员工名字中不包含字母“S”员工。 select * from emp where ename not in (select ename from emp where ename like '%S%') ; select * from emp where ename not like ‘%S%’; (15)查询员工姓名的第2个字母为“M”的员工信息。 select * from emp where ename like '_M%'; (16)查询所有员工姓名的前3个字符。 select substr(ename,1,3) from emp ; (17)查询所有员工的姓名,如果包含字母“s”,则用“S”替换。 select replace(ename,'s','S') from emp ; (18)查询员工的姓名和入职日期,并按入职日期从先到后进行排列。 select ename,hiredate from emp order by hiredate asc ; (19)显示所有的姓名、工种、工资和奖金,按工种降序排列,若工种相同则按工资升序排列。 select ename,job,sal,comm from emp order by job desc,sal asc ; (20)显示所有员工的姓名、入职的年份和月份,若入职日期所在的月份排序,若月份相同则按入职的年份排序。 select ename,to_char(hiredate,'yyyy')||'-'||to_char(hiredate,'mm') from emp order by to_char(hiredate,'mm'),to_char(hiredate,'yyyy'); (21)查询在2月份入职的所有员工信息。 select * from emp where to_char(hiredate,'mm') = 2 ; (22)查询所有员工入职以来的工作期限,用“**年**月**日”的形式表示。 select ename,floor((sysdate-hiredate)/365)||'年'||floor(mod((sysdate-hiredate),365)/30)||'月'||cell(mod(mod((sysdate-hiredate),365),30))||'天' from emp ; (23)查询至少有一个员工的部门信息。 select * from dept where deptno in (select distinct deptno from emp where mgr is not null) ; (24)查询工资比SMITH员工工资高的所有员工信息。 select * from emp where sal > (select sal from emp where ename like 'SMITH') ; (25)查询所有员工的姓名及其直接上级的姓名。 select staname,ename supname from (select ename staname,mgr from emp) t join emp on t.mgr=emp.empno ; (26)查询入职日期早于其直接上级领导的所有员工信息。 select * from emp where empno in (select staempno from (select empno staempno,hiredate stahiredate,mgr from emp) t join emp on t.mgr=emp.empno and stahiredate < hiredate) ; (27)查询所有部门及其员工信息,包括那些没有员工的部门。 select * from dept left join emp on emp.deptno=dept.deptno order by dept.deptno ; (28)查询所有员工及其部门信息,包括那些还不属于任何部门的员工。 (29)查询所有工种为CLERK的员工的姓名及其部门名称。 select ename,dname from emp join dept on job like 'CLERK' and emp.deptno=dept.deptno ; (30)查询最低工资大于2500的各种工作。 select job from (select min(sal) min_sal,job from emp group by job) where min_sal > 2500 ; (31)查询最低工资低于2000的部门及其员工信息。 select * from emp where deptno in (select deptno from (select min(sal) min_sal,deptno from emp group by deptno) where min_sal < '2000') ; (32)查询在SALES部门工作的员工的姓名信息。 select ename from emp where deptno = (select deptno from dept where dname like 'SALES'); (33)查询工资高于公司平均工资的所有员工信息。 select * from emp where sal > (select avg(sal) from emp) ; (34)查询与SMITH员工从事相同工作的所有员工信息。 select * from emp where job in (select job from emp where ename like 'SMITH') and ename not like 'SMITH' ; (35)列出工资等于30号部门中某个员工工资的所有员工的姓名和工资。 select ename,sal from emp where sal =any (select sal from emp where deptno = 30) ; (36)查询工资高于30号部门中工作的所有员工的工资的员工姓名和工资。 select ename,sal from emp where sal >all (select sal from emp where deptno = 30) ; (37)查询每个部门中的员工数量、平均工资和平均工作年限。 select dname,count,avg_sal,avg_date from dept join (select count(*) count,avg(sal) avg_sal,avg((sysdate-hiredate)/365) avg_date,deptno from emp group by deptno) t on dept.deptno = t.deptno ; (38)查询从事同一种工作但不属于同一部门的员工信息。 select distinct t1.empno,t1.ename,t1.deptno from emp t1 join emp t2 on t1.job like t2.job and t1.deptno <> t2.deptno ; (39)查询各个部门的详细信息以及部门人数、部门平均工资。 Select dept.*,person_num,avg_sal from dept,(select count(*) person_num,avg(sal) avg_sal,deptno from emp group by deptno) t where dept.deptno = t.deptno ; (40)查询各种工作的最低工资。 select job,min(sal) from emp group by job ; (41)查询各个部门中的不同工种的最高工资。 select max(sal),job,deptno from emp group by deptno,job order by deptno,job ; (42)查询10号部门员工以及领导的信息。 select * from emp where empno in (select mgr from emp where deptno=10) or deptno = 10 ; (43)查询各个部门的人数及平均工资。 select deptno,count(*),avg(sal) from emp group by deptno ; (44)查询工资为某个部门平均工资的员工信息。 select * from emp where sal in (select avg(sal) avg_sal from emp group by deptno) ; (45)查询工资高于本部门平均工资的员工的信息。 select emp.* from emp join (select deptno,avg(sal) avg_sal from emp group by deptno) t on emp.deptno=t.deptno and sal>avg_sal ; (46)查询工资高于本部门平均工资的员工的信息及其部门的平均工资。 select emp.*, from emp join (select deptno,avg(sal) avg_sal from emp group by deptno) t on emp.deptno=t.deptno and sal>avg_sal ; (47)查询工资高于20号部门某个员工工资的员工的信息。 select * from emp where sal >any(select sal from emp where deptno=20); (48)统计各个工种的人数与平均工资。 select job,count(*),avg(sal) from emp group by job ; (49)统计每个部门中各个工种的人数与平均工资。 select deptno,job,count(*),avg(sal) from emp group by deptno,job order by deptno,job; (50)查询工资、奖金与10 号部门某个员工工资、奖金都相同的员工的信息。 select emp.* from emp join (select sal,comm from emp where deptno = 10) t on emp.sal=t.sal and nvl(emp.comm,0)=nvl(t.comm,0) and emp.deptno != 10; (51)查询部门人数大于5的部门的员工的信息。 select * from emp where deptno in (select deptno from emp group by deptno having count(*)>5); (52)查询所有员工工资都大于1000的部门的信息。 select * from dept where deptno in (select distinct deptno from emp where deptno not in (select distinct deptno from emp where sal < 1000)) ; (53)查询所有员工工资都大于1000的部门的信息及其员工信息。 select * from emp join dept on dept.deptno in (select distinct deptno from emp where deptno not in (select distinct deptno from emp where sal < 1000)) and dept.deptno=emp.deptno; (54)查询所有员工工资都在900~3000之间的部门的信息。 select * from dept where deptno in (select distinct deptno from emp where deptno not in (select distinct deptno from emp where sal not between 900 and 3000)) ; (55)查询所有工资都在900~3000之间的员工所在部门的员工信息。 select * from emp where deptno in (select distinct deptno from emp where deptno not in (select distinct deptno from emp where sal not between 900 and 3000)) ; (56)查询每个员工的领导所在部门的信息。 select * from (select e1.empno,e1.ename,e1.mgr mno,e2.ename mname,e2.deptno from emp e1 join emp e2 on e1.mgr=e2.empno) t join dept on t.deptno=dept.deptno ; (57)查询人数最多的部门信息。 select * from dept where deptno in (select deptno from (select count(*) count,deptno from emp group by deptno) where count in (select max(count) from (select count(*) count,deptno from emp group by deptno))); (58)查询30号部门中工资排序前3名的员工信息。 select * from emp where empno in (select empno from (select empno,sal from emp where deptno=30 order by sal desc) where rownum < 4) ; (59)查询所有员工中工资排在5~10名之间的员工信息。 select * from emp where empno in (select empno from (select empno,rownum num from (select empno,sal from emp order by sal desc)) where num between 5 and 10 ) ; select empno from (select empno,sal from emp order by sal desc) where rownum <= 10 minus select empno from (select empno,sal from emp order by sal desc) where rownum < 5 ; (60)向emp表中插入一条记录,员工号为1357,员工名字为oracle,工资为2050元,部门号为20,入职日期为2002年5月10日。 insertinto emp(empno,ename,sal,deptno,hiredate) values (1357,'oracle',2050,20,to_date('2002年5月10日','yyyy"年"mm"月"dd"日"')) ; (61)向emp表中插入一条记录,员工名字为FAN,员工号为8000,其他信息与SMITH员工的信息相同。 (62)将各部门员工的工资修改为该员工所在部门平均工资加1000。 update emp t1 set sal = (select new_sal from (select avg(sal)+1000 new_sal,deptno from emp group by deptno) t2 wher e t1.deptno = t2.deptno ) ; 1、查询82年员工 select e.* from emp e where to_char(e.hiredate, 'yy') like '82'; select e.* from emp e where to_char(e.hiredate,'yyyy')='1982'; 2、查询32年工龄的人员 select round(sysdate-e.hiredate)/365, e.ename,e.hiredate from emp e where round((sysdate-e.hiredate)/365)=32; 3、显示员工雇佣期 6 个月后下一个星期一的日期 select next_day(add_months(e.hiredate,6),2) from emp e ; 4、找没有上级的员工,把mgr的字段信息输出为 "boss" select decode(e.mgr,null,'boss','中国好声音') from emp e; 5、为所有人长工资,标准是:10部门长10%;20部门长15%;30部门长20%其他部门长18% select decode(e.deptno,10,e.sal*1.1,20,e.sal*1.15, e.sal*1.18) 涨工资 ,e.deptno, e.sal from emp e ; Oracle_练习与答案 1.求部门中薪水最高的人 select ename,sal,emp.deptno from emp join (select deptno,max(sal) max_sal from emp group by deptno) t on (emp.deptno = t.deptno and emp.sal = t.max_sal); select ename, sal, deptno from emp where sal in (select max(sal) from emp group by deptno); 2.求部门平均薪水的等级 select deptno, avg_sal, grade from (select deptno,avg(sal) avg_sal from emp group by deptno) t join salgrade on (t.avg_sal between salgrade.losal and salgrade.hisal); 3. 求部门平均的薪水等级 select deptno, avg(grade) avg_sal_grade from (select deptno, grade from emp join salgrade on emp.sal between salgrade.losal and salgrade.hisal) group by deptno; 4. 雇员中有哪些人是经理人 select distinct e2.ename manager from emp e1 join emp e2 on e1.mgr = e2.empno; select ename from emp where empno in (select mgr from emp); 5. 不准用组函数,求薪水的最高值 select distinct sal max_sal from emp where sal not in (select e1.sal e1_sal from emp e1 join emp e2 on e1.sal < e2.sal); select * from (select * from emp order by sal desc) t where rownum <2 6. 求平均薪水最高的部门的部门编号 select deptno, avg_sal from (select deptno, avg(sal) avg_sal from emp group by deptno) where avg_sal = (select max(avg_sal) from (select avg(sal) avg_sal from emp group by deptno) ); 组函数嵌套写法(对多可以嵌套一次,group by 只对内层函数有效) select deptno, avg_sal from (select deptno, avg(sal) avg_sal from emp group by deptno) where avg_sal = (select max(avg(sal)) from emp group by deptno); 7. 求平均薪水最高的部门的部门名称 select t1.deptno, dname, avg_sal from (select deptno,avg(sal) avg_sal from emp group by deptno) t1 join dept on t1.deptno = dept.deptno where avg_sal = (select max(avg_sal) from (select deptno,avg(sal) avg_sal from emp group by deptno) ); select dname from dept where deptno = (select deptno from (select deptno,avg(sal) avg_sal from emp group by deptno) where avg_sal = (select max(avg_sal) from (select deptno,avg(sal) avg_sal from emp group by deptno) ) ); 8. 求平均薪水的等级最低的部门的部门名称 select dname from dept join (select deptno, grade from (select deptno, avg(sal) avg_sal from emp group by deptno) t join salgrade on (t.avg_sal between salgrade.losal and salgrade.hisal) ) t on dept.deptno = t.deptno where t.grade = (select min(grade) from (select avg(sal) avg_sal from emp group by deptno) t join salgrade on (t.avg_sal between salgrade.losal and salgrade.hisal) ); 9.求部门经理人中平均薪水最低的部门名称 select dname from (select deptno, avg(sal) avg_sal from emp where empno in (select mgr from emp)group by deptno)t join dept on t.deptno = dept.deptno where avg_sal = (select min(avg_sal) from (select avg(sal) avg_sal from emp where empno in (select mgr from emp) group by deptno) t ); 10. 求比普通员工的最高薪水还要高的经理人名称(not in) select ename from emp where empno in (select mgr from emp) and sal > (select max(sal) from (select e2.sal from emp e1 right join emp e2 on e1.mgr = e2.empno where e1.ename is null) t ); select ename from emp where empno in (select mgr from emp) and sal > (select max(sal) from emp where empno not in (select distinct mgr from emp where mgr is not null) ); //NOT IN遇到NULL则返回NULL,必须排除NULL值 11. 求薪水最高的前5名雇员 select empno,ename from (select * from emp order by sal desc) where rownum<=5; 12. 求薪水最高的第6到第10名雇(!important) select ename,sal from (select t.*,rownum r from (select * from emp order by sal desc) t ) where r>=6 and r<=10; 13. 求最后入职的5名员工 select ename, to_char(hiredate,'YYYY"年"MM"月"DD"日"') hiredate from (select t.*,rownum r from (select * from emp order by hiredate desc)t ) where r<=5; select ename, to_char(hiredate,'YYYY"年"MM"月"DD""') hiredate from (select t.*,rownum r from (select * from emp order by hiredate)t )where r>(select count(*)-5 from emp);
[주제 추천] :
위 내용은 오라클 면접에서 자주 묻는 질문의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

OracleOffersAcorMeRensiveSuiteOfProductsandServicesIncludingDatabasEmanagement, CloudComputing, EnterprisesOftware, AndHardWaresolutions.1) OracledAtabaseSupportSvariousDatamodelswithiciantmanagementFeatures.2) ORACLECLOUDINFRASTRUCH (OCILECLOUDINFRASTROC) 제공

데이터베이스에서 클라우드 컴퓨팅에 이르기까지 Oracle 소프트웨어의 개발 기록에는 다음이 포함됩니다. 1. 1977 년에 시작하여 처음에는 RDBMS (Relational Database Management System)에 중점을 두 었으며 엔터프라이즈 수준의 응용 프로그램의 첫 번째 선택이되었습니다. 2. 미들웨어, 개발 도구 및 ERP 시스템으로 확장하여 완전한 엔터프라이즈 솔루션 세트를 형성합니다. 3. Oracle Database는 SQL을 지원하여 소규모에서 대형 엔터프라이즈 시스템에 적합한 고성능 및 확장 성을 제공합니다. 4. 클라우드 컴퓨팅 서비스의 상승은 Oracle의 제품 라인을 더욱 확장하여 필요한 엔터프라이즈의 모든 측면을 충족시킵니다.

MySQL 및 Oracle 선택은 비용, 성능, 복잡성 및 기능 요구 사항을 기반으로해야합니다. 1. MySQL은 예산이 한정된 프로젝트에 적합하며 설치가 간단하며 중소형 응용 프로그램에 적합합니다. 2. Oracle은 대기업에 적합하며 대규모 데이터 및 높은 동시 요청을 처리하는 데있어 훌륭하게 수행하지만 구성에서는 비용이 많이 들고 복잡합니다.

Oracle은 비즈니스가 제품 및 서비스를 통해 디지털 혁신 및 데이터 관리를 달성 할 수 있도록 도와줍니다. 1) Oracle은 데이터베이스 관리 시스템, ERP 및 CRM 시스템을 포함한 포괄적 인 제품 포트폴리오를 제공하여 기업이 비즈니스 프로세스를 자동화하고 최적화 할 수 있도록 도와줍니다. 2) E-BusinessSuite 및 FusionApplications와 같은 Oracle의 ERP 시스템은 엔드 투 엔드 비즈니스 프로세스 자동화를 실현하고 효율성을 높이며 비용을 절감하지만 높은 구현 및 유지 보수 비용이 있습니다. 3) Oracledatabase는 높은 동시성 및 고 가용성 데이터 처리를 제공하지만 라이센스 비용이 높습니다. 4) 성능 최적화 및 모범 사례에는 인덱싱 및 분할 기술의 합리적인 사용, 정기 데이터베이스 유지 보수 및 코딩 사양 준수가 포함됩니다.

Oracle이 라이브러리를 작성하지 못한 후 실패한 데이터베이스를 삭제하는 단계 : Sys 사용자 이름을 사용하여 대상 인스턴스에 연결하십시오. 드롭 데이터베이스를 사용하여 데이터베이스를 삭제하십시오. 쿼리 v $ 데이터베이스는 데이터베이스가 삭제되었는지 확인합니다.

Oracle에서 FOR 루프 루프는 커서를 동적으로 생성 할 수 있습니다. 단계는 다음과 같습니다. 1. 커서 유형을 정의합니다. 2. 루프를 만듭니다. 3. 커서를 동적으로 만듭니다. 4. 커서를 실행하십시오. 5. 커서를 닫습니다. 예 : 커서는 상위 10 명의 직원의 이름과 급여를 표시하기 위해주기별로 만들 수 있습니다.

Oracle View는 Expitility : Oracle 데이터베이스에 로그인하여 내보낼 수 있습니다. 뷰 이름 및 내보내기 디렉토리를 지정하여 EXP 유틸리티를 시작하십시오. 대상 모드, 파일 형식 및 테이블 스페이스를 포함한 내보내기 매개 변수를 입력하십시오. 내보내기를 시작하십시오. IMPDP 유틸리티를 사용하여 내보내기를 확인하십시오.

Oracle 데이터베이스를 중지하려면 다음 단계를 수행하십시오. 1. 데이터베이스에 연결하십시오. 2. 즉시 종료; 3. 셧다운은 완전히 중단됩니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

DVWA
DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

드림위버 CS6
시각적 웹 개발 도구

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.
