2009. 5. 29. 10:28 Programming

mysql index


1. 만들기
CREATE INDEX <인덱스명> ON <테이블명> ( 칼럼명1, 칼럼명2, ... );

create unique index index_name  using btree  on table_name ( name(10)  ) ;
create index index_name  on  table_name ( id(10), name(30) );

2. 테이블 생성시 만들기
create table index_sample (
product_code char(10) not null,
product_name char(20) not null,
product_detail char(100) not null,
index (product_code)   <---- product_code에만 인덱스 걸기
);

3. 테이블 생성시 2개 만들기
create table index_sample (
product_code char(10) not null,
product_name char(20) not null,
product_detail char(100) not null,
index (product_code, product_name)  <---- product_code, product_name 두개에 인덱스 걸기
);                                                             and 조건으로 검색시에만 인덱스 활용

4. 인덱스 보기
show index from index_sample;

5. 인덱스 제거
drop index index_name on table_name

'Programming' 카테고리의 다른 글

FLEX 관련  (0) 2009.08.18
Posted by 한효정

블로그 이미지
착하게 살자.
한효정

카테고리

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

최근에 올라온 글

최근에 달린 댓글

글 보관함