delete_list
DELETE List
DELETE로 List 데이터를 삭제
DELETE로 List 데이터를 삭제합니다.
테스트 데이터 입력
Example
명령> | rpush mylist1 value10 value30 value50 value20 value40 |
결과> | 5 |
명령> | rpush mylist2 110 120 130 140 150 |
결과> | 5 |
명령> | rpush mylist3 AAA BBB CCC DDD EEE |
결과> | 5 |
Key로 삭제
DELETE FROM LIST.MYLIST1
키 하나를 지정하거나 '*'를 사용해서 여러 개 키를 삭제할 수 있습니다.
Example
명령> | select * from list.mylist*; |
결과> |
0) key|value 1) mylist1|value10 2) mylist1|value30 3) mylist1|value50 4) mylist1|value20 5) mylist1|value40 6) mylist2|110 7) mylist2|120 8) mylist2|130 9) mylist2|140 10) mylist2|150 11) mylist3|AAA 12) mylist3|BBB 13) mylist3|CCC 14) mylist3|DDD 15) mylist3|EEE |
명령> | delete from list.mylist1; opcode |
결과> | 1 keys deleted |
명령> | delete from list.mylist*; opcode |
결과> | 2 keys deleted |
WHERE 조건
비교: =, <, <=, >, >=, !=, <>
Where 조건으로 키를 삭제할 수 있습니다.
삭제 명령은 키가 지워지므로 필요한 키를 다시 넣고 시작하세요.
주의할 점은 where 조건에 value를 사용할 경우에도 키가 삭제됩니다.
Value만 삭제할 경우 레디스 원래 명령을 사용하세요.
Example
BETWEEN, NOT BETWEEN
Example
명령> | delete from list.* where key between 'mylist1' and 'mylist2'; opcode |
결과> | 2 keys deleted |
명령> | delete from list.* where key not between 'mylist1' and 'mylist2'; opcode |
결과> | 1 keys deleted |
데이터 입력 | |
명령> | delete from list.* where value between 120 and 140; opcode |
결과> | 1 keys deleted |
명령> | delete from list.* where value between 'BBB' and 'value30'; opcode |
결과> | 2 keys deleted |
IN, NOT IN
Example
GLOB, NOT GLOB
*(별표), ?(물음표)
대소문자를 구분한다.
Example
LIKE, NOT LIKE
%(퍼센트), _(밑줄)
대소문자를 구분하지 않는다.
Example
OPCODE
delete from list.mylist1;
delete from list.mylist*;
delete from list.* where key > 'mylist2';
delete from list.* where value = 'value10';
delete from list.* where value <= 'BBB';
delete from list.* where key between 'mylist1' and 'mylist2';
delete from list.* where key not between 'mylist1' and 'mylist2';
delete from list.* where value between 120 and 140;
delete from list.* where value between 'BBB' and 'value30';
delete from list.* where key in ('mylist1','mylist2')
delete from list.* where value in ('value10','CCC');
delete from list.* where value not in ('value10');
delete from list.* where value glob 'value*';
delete from list.* where value glob 'a*';
delete from list.* where value not glob 'a*';
delete from list.* where value like 'value%';
delete from list.* where value like 'A%';
delete from list.* where value not like 'value%';
<< Delete String | Delete List | Delete Set >> |
---|
Email
返事がかかってなれば、メールでお知らせします。