DELETE String


DELETE로 String 데이터를 삭제

SQL DELETE로 String 데이터를 삭제합니다.

테스트 데이터 입력

Example

명령>mset mycity01 Seoul mycity02 Incheon mycity03 Chuncheon mycity04 Daejeon mycity05 Jeonju
결과>OK
명령>mset mycity06 Daegu mycity07 Gwangju mycity08 Busan mycity09 Jeju
결과>OK

Key로 삭제

DELETE FROM STRING.MYCITY09

키 하나를 지정하거나 '*'를 사용해서 여러 개 키를 삭제할 수 있습니다.

Example

명령>select * from string.*;
결과> 0) key|value 1) mycity01|Seoul
2) mycity02|Incheon
3) mycity03|Chuncheon
4) mycity04|Daejeon
5) mycity05|Jeonju
6) mycity06|Daegu
7) mycity07|Gwangju
8) mycity08|Busan
9) mycity09|Jeju
명령>delete from string.mycity09;  opcode
결과> 1 keys deleted
명령>delete from string.mycity*;  opcode
결과> 8 keys deleted

WHERE

비교: =, <, <=, >, >=, !=

Where 조건으로 키를 삭제할 수 있습니다.
삭제 명령은 키가 지워지므로 필요한 키를 다시 넣고 시작하세요.

Example

명령> select * from string.* order by value;
결과> 0) key|value
1) mycity08|Busan
2) mycity03|Chuncheon
3) mycity06|Daegu
4) mycity04|Daejeon
5) mycity07|Gwangju
6) mycity02|Incheon
7) mycity05|Jeonju
8) mycity01|Seoul
명령>delete from string.mycity* where value = 'Daejeon';   opcode
결과> 1 keys deleted
명령>delete from string.mycity* where value < 'Daejeon';   opcode
결과> 3 keys deleted
명령>delete from string.mycity* where value >= 'Jeonju';   opcode
결과> 2 keys deleted
명령> select * from string.* order by value;
결과> 0) key|value
1) mycity07|Gwangju
2) mycity02|Incheon
3) mycity05|Jeonju

BETWEEN

Example

명령>delete from string.mycity* where key BETWEEN 'mycity03' and 'mycity05';   opcode
결과> 3 keys deleted
명령>delete from string.mycity* where key NOT BETWEEN 'mycity03' and 'mycity05';   opcode
결과> 6 keys deleted
데이터 입력
명령>delete from string.mycity* where value BETWEEN 'Daejeon' and 'Jeju';   opcode
결과> 4 keys deleted
명령>delete from string.mycity* where value NOT BETWEEN 'Daejeon' and 'Jeju';   opcode
결과> 5 keys deleted

IN

Example

명령>delete from string.mycity* where key IN ('mycity03','mycity05') ;   opcode
결과> 2 keys deleted
명령>delete from string.mycity* where key NOT IN ('mycity03','mycity05');   opcode
결과> 7 keys deleted
데이터 입력
명령>delete from string.mycity* where value IN ('Daejeon','Jeju') ;   opcode
결과> 2 keys deleted
명령>delete from string.mycity* where value NOT IN ('Daejeon','Jeju') ;   opcode
결과> 7 keys deleted

GLOB

Glob는 *(별표), ?(물음표)를 사용하고, 대소문자를 구분합니다.

Example

명령>delete from string.mycity* where value GLOB 'Dae*';   opcode
결과> 2 keys deleted
명령>delete from string.mycity* where value GLOB 'Je??';   opcode
결과> 1 keys deleted
명령>delete from string.mycity* where value NOT GLOB 'Je??';   opcode
결과> 6 keys deleted

LIKE

Like는 %(퍼센트), _(밑줄)을 사용하고, 대소문자를 구분하지 않습니다.

Example

명령>delete from string.mycity* where value LIKE 'dae%';   opcode
결과> 2 keys deleted
명령>delete from string.mycity* where value LIKE '%ju';   opcode
결과> 3 keys deleted
명령>delete from string.mycity* where value NOT LIKE '%ju';   opcode
결과> 4 keys deleted

OPCODE


delete from string.mycity09;

delete from string.mycity*;

delete from string.mycity* where value = 'Daejeon';

delete from string.mycity* where value < 'Daejeon';

delete from string.mycity* where value >= 'Jeonju';

delete from string.mycity* where key BETWEEN 'mycity03' and 'mycity05';

delete from string.mycity* where key NOT BETWEEN 'mycity03' and 'mycity05';

delete from string.mycity* where value BETWEEN 'Daejeon' and 'Jeju';

delete from string.mycity* where value NOT BETWEEN 'Daejeon' and 'Jeju';

delete from string.mycity* where key IN ('mycity03','mycity05') ;

delete from string.mycity* where key NOT IN ('mycity03','mycity05');

delete from string.mycity* where value IN ('Daejeon','Jeju') ;

delete from string.mycity* where value NOT IN ('Daejeon','Jeju') ;

delete from string.mycity* where value GLOB 'Dae*';

delete from string.mycity* where value GLOB 'Je??';

delete from string.mycity* where value NOT GLOB 'Je??';

delete from string.mycity* where value LIKE 'dae%';

delete from string.mycity* where value LIKE '%ju';

delete from string.mycity* where value NOT LIKE '%ju';


<< Delete Intro Delete String Delete List >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.