죽어도  다시한번

sqlite 기본 쿼리문

Sqlite2011. 9. 22. 20:30
1. Select
- Select는 찾기 명령어
select 테이블명.필드명 from 테이블명 where 조건
- 조건문을 여러개 입력 가능. and나 or로 연결
- where 조건문 이후에 oreder by 필드명 asc를 입력하면 오름차순
- where 조건문 이후에 oreder by 필드명 dsc를 입력하면 내림차순
select from creature_template where name = '일리단 스톰레이지';
select creature_template.name, creature_template.entry from creature_template where name like '%일리단%;
select item_template.entry, item_template.name from item_template, npc_vendor where npc_vendor.entry = 300100 and npc_vendor.item = item_template.entry;

2. Update
- Update는 수정 명령어
update 테이블명 set 조건(변경할 내용) where 조건(수정할 데이터 선택)
- 데이터 선택시 조건문을 여러개 입력가능. and나 or로 연결
- 변경할 내용은 콤마로 연결
update creature_template set creature_template.name = 'Test' where creature_template.entry = 3;

3. Insert
- Insert는 추가 명령어
insert into 테이블명(필드1, 필드2, ·······) values (값1, 값2, ·······)
- 혹은 insert into 테이블명 values (값1, 값2, ·······)
- 테이블명만 쓸 경우는 모든 필드값을 다 입력 한 경우에만 사용가능
- 모든 필드값을 다 입력하지 않은 경우 나머지 필드에는 기본값 혹은 null값이 입력됨
insert into creature_template (entry, name, subname) values (99999, 'Test', 'GM');

4. Delete
- Delete는 삭제 명령어
delete from 테이블명 where 조건
- 조건문을 여러개 입력 가능. and나 or로 연결
delete from creature_template where entry = 99999;

'Sqlite' 카테고리의 다른 글

Creating SQL Database, Connecting, Inserting, Reading  (0) 2011.09.27
sqlite 기본 사용법  (0) 2011.09.22
sql 기본 사용법  (0) 2011.09.22
sqlite xcode에서 사용하기  (0) 2011.09.15
Sqlite 활용  (0) 2011.09.12