ALTER TABLE tblname ADD INDEX indexname (index_columns);
ALTER TABLE tblname ADD PRIMARY KEY indexname (index_columns);
ALTER TABLE tblname ADD UNIQUE indexname (index_columns);
인덱스의 추가(CREATE INDEX)
CREATE INDEX indexname ON tblname (index_columns);
CREATE UNIQUE INDEX indexname ON tblname (index_columns);
인덱스의 추가(CREATE TABLE)
CREATE TABLE tblname
(
i INT NOT NULL PRIMARY KEY,
sz CHAR(10) NOUT NULL UNIQUE
);
인덱스의 삭제
DROP INDEX indexname ON tblname;
DROP INDEX 'PRIMARY' ON tblname; (PRIMARY KEY 삭제)
ALTER TABLE tblname DROP INDEX indexname;
ALTER TABLE tblname DROP PRIMARY KEY;
댓글 없음:
댓글 쓰기