데이터베이스/MySQL
[MySQL] 테이블의 auto increment number 가져오기
jaee
2022. 3. 28. 07:25
고유키가 필요할 때 테이블의 auto increment를 활용하는 경우가 있다. 이럴 때 사용할 수 있는 쿼리.
SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = [db name] AND TABLE_NAME = [table name];
이외에 참고할 수 있는 쿼리를 정리한 링크 (상황에 따라 알맞은 것을 사용하면 될 것 같다)
https://thispointer.com/4-ways-to-get-last-inserted-id-of-a-mysql-table/#four
4 ways to get last inserted id of a MySQL table – thisPointer
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing
thispointer.com