Date date Ex date hiredate insert into empempname

  • Slides: 16
Download presentation

 • Date 타입 – 년, 월, 일, 시, 분, 초까지 입력됨 – 두

• Date 타입 – 년, 월, 일, 시, 분, 초까지 입력됨 – 두 date 타입을 ‘=‘ 비교했을때 원하지 않 는 결과가 나올 수 있으므로 주의 Ex) date hiredate //선언 insert into emp(emp_name, newdate) values(‘노성섭’, sysdate); insert into emp(emp_name, newdate) values(‘홍길동’, ’ 15 -oct-01’); //입력 Select *from emp where newdate=’ 15 -oct-01’; //추출 출력 홍길동 15 -oct-01

인덱스와 부분범위처리 • Order by의 대체 기존 sql: select emp_no from employee where emp_no

인덱스와 부분범위처리 • Order by의 대체 기존 sql: select emp_no from employee where emp_no < 4 order by emp_no; 개선 sql: select emp_no from employee where emp_no < 4; index table result 1 99 1 2 3 . . . 100 3 98 99 100 98 3 2 . . . default Create index 인덱스 이름 on 테이블이름(컬럼이름 asc)

 • 인덱스를 이용한 부분범위처리 문제: 가장 최근데이터 한건 가져오기 기존 sql : select

• 인덱스를 이용한 부분범위처리 문제: 가장 최근데이터 한건 가져오기 기존 sql : select *from employee order by emp_no; 프로그램으로 해결 개선 sql : select *from employee fetch first 1 row only; index table result 100 99 1 98 . . . 100 3 2 1 98 3 2 . . . Create index 인덱스 이름 on 테이블이름(컬럼이름 desc)

결합인덱스와 인덱스 merge • 인덱스 merge Select *from employee where col 1=‘abc’ and col

결합인덱스와 인덱스 merge • 인덱스 merge Select *from employee where col 1=‘abc’ and col 2=123; 1 3 5 7 rowid 10 15 26 32 53 55 67 27 56 col 1 AAA AAB ABC ABC ABC BCA. . Index(col 1) col 2 1 2 4 6 rowid. . 100 123 123 29 5 7 9 32 35 46 67. . Index(col 2)