oracle 필기시험 문제

4684 단어 면접시험
1) A    100   .

  Select * FROM A Where A.COLUMN1 = A.COLUMN1

   ? ( , 1 :)

  (2) Create SEQUENCE PEAK_NO

  Select PEAK_NO.NEXTVAL FROM DUAL --> 1

  10 ,


  Select PEAK_NO.NEXTVAL FROM DUAL --> ?

  (3) SQL> connect sys as sysdba

  Connected.


  SQL> insert into dual values ( 'Y');

     1 row created.

  SQL> commit;

     Commit complete.

  SQL> select count(*) from dual;

     COUNT(*)

     ----------

     2

  SQL> delete from dual;

     commit;

     -->DUAL ?

  JUST TRY IT
SQL

null null,


, ( :not in/not exists+null)
SQL> select * from usertable;
USERID USERNAME
----------- ----------------
1 user1
2 null
3 user3
4 null
5 user5
6 user6

SQL> select * from usergrade;
USERID USERNAME GRADE
---------- ---------------- ----------
1 user1 90
2 null 80
7 user7 80
8 user8 90


select count(*) from usergrade where username not in (select username from usertable);

select count(*) from usergrade g where not exists
(select null from usertable t where t.userid=g.userid and t.username=g.username);

: 1( 0 ) 2 ( 3 )

A: 0 B:1 C:2 D:3 E:NULL


2

, ( :in/exists+rownum)
SQL> select * from usertable;
USERID USERNAME
----------- ----------------
1 user1
2 user2
3 user3
4 user4
5 user5

SQL> select * from usergrade;
USERNAME GRADE
---------------- ----------
user9 90
user8 80
user7 80
user2 90
user1 100
user1 80


Select count(*) from usertable t1 where username in
(select username from usergrade t2 where rownum <=1);

Select count(*) from usertable t1 where exists
(select 'x' from usergrade t2 where t1.username=t2.username and rownum <=1);

:( ) ( )
A: 0 B: 1 C: 2 D: 3

, , T1 ;
select * from emp;
EMPNO DEPTNO SALARY
----- ------ ------
100 1 55
101 1 50

select * from dept;
DEPTNO SUM_OF_SALARY
------ -------------
1 105
2

, 2 , null, ,
( ) ( ) , :

time session 1 session2
----------- ------------------------------- -----------------------------------
T1 insert into emp
values(102,2,60)

T2 update emp set deptno =2
where empno=100

T3 update dept set sum_of_salary =
(select sum(salary) from emp
where emp.deptno=dept.deptno)
where dept.deptno in(1,2);

T4 update dept set sum_of_salary =
(select sum(salary) from emp
where emp.deptno=dept.deptno)
where dept.deptno in(1,2);

T5 commit;

T6 select sum(salary) from emp group by deptno;
: 2 :
T7 commit;
======= , , ========

T8 select sum(salary) from emp group by deptno;


T9 select * from dept;


( ) ( ) ( )

A: B:
---------------- ----------------
1 50 1 50
2 60 2 55

C: D:
---------------- ----------------
1 50 1 115
2 115 2 50

E: F:
---------------- ----------------
1 105 1 110
2 60 2 55


, ( : )
select id,grade from student_grade
ID GRADE
-------- -----------
1 50
2 40
3 70
4 80
5 30
6 90


select id,grade from student_makeup
ID GRADE
-------- -----------
1 60
2 80
5 60

dba , :
update student_grade s set s.grade =
(select t.grade from student_makeup t
where s.id=t.id);
commit;

select GRADE from student_grade where id = 3; :

A: 0 B: 70 C: null D:


, ,
T1
session1 session2
-------------------------------------- ----------------------------------------
T1 select count(*) from t;
-- (1000)

T2 delete from t where rownum <=100;

T3 begin
delete from t where rownum <=100;
commit;
end;
/

T4 truncate table t;

T5 select count(*) from t;
--

A: 1000 B: 900 C: 800 D: 0

좋은 웹페이지 즐겨찾기