相关疑难解决方法(0)

使用Python INSERT进入MySQL数据库后如何获得"id"?

我执行INSERT INTO语句

cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height))
Run Code Online (Sandbox Code Playgroud)

我想获得主键.

我的表有2列:

id      primary, auto increment
height  this is the other column.
Run Code Online (Sandbox Code Playgroud)

在我刚插入之后如何获得"id"?

python mysql database

169
推荐指数
4
解决办法
13万
查看次数

标签 统计

database ×1

mysql ×1

python ×1