Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 메터리얼
- 알림바
- Query
- condensed
- 머터리얼
- soundcontroller
- 역슬레시
- 볼륨조절어플
- 디자인패턴
- insertion
- 파이썬
- 안드로이드
- 안드로이드 스튜디오
- 안드로이드앱
- Android
- crashlytics
- mariaDB
- Python
- MySQL
- Auto_increment
- last_insert_id
- android studio
- auto_increment 값
- id 얻기
- 볼륨조절앱
- mysql_insert_id
- insert_id
- 데이터베이스
- escape_string
- db
Archives
- Today
- Total
장삼의 착한코딩
[데이터베이스] 다음 auto_increment 값 받아오기 본문
query를 사용하다보면 insert시 다음 auto_increment 값이 필요할 때가 있다.
select LAST_INSERT_ID() 를 사용할 수도 있지만, LAST_INSERT_ID()는 table을 선택할 수 없다.
그래서 아래의 query를 사용하면 다음 auto_increment의 값을 얻을 수 있다.
SELECT AUTO_INCREMENT
FROM information_schema.tables
WHERE table_name = 'table name'
AND table_schema = DATABASE( ) ;
'데이터베이스' 카테고리의 다른 글
[php/데이터베이스] 방금 insert한 컬럼의 id 얻기 (0) | 2016.01.29 |
---|---|
[데이터베이스] mysql에서 primary key 수정하기 (1) | 2016.01.18 |
[데이터베이스] mysql에서 timestamp 사용하기 (0) | 2016.01.18 |
[SQL] auto_increment 가장 큰 값 받아오는 방법 (0) | 2016.01.11 |
[데이터베이스] mysql에서 full outer join 사용하기 (0) | 2015.09.22 |
Comments