使用mysql命令行insert时,如何直接获取到自增id

无论是nodejs还是golang,都是支持insert后返回自增id的

那请问为什么我在mysql命令行insert后,没有id返回?


mysql
go
node.js
2022-12-13 13:37:56
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
自封的不算
2

可以请使用​​LAST_INSERT_ID()​​函数​​​

With no argument, LAST_INSERT_ID() returns a BIGINT UNSIGNED (64-bit) value representing the first automatically generated value successfully inserted for an AUTO_INCREMENT column as a result of the most recently executed INSERT statement. The value of LAST_INSERT_ID() remains unchanged if no rows are successfully inserted.

分享
微博
QQ
微信
回复
2022-12-13 14:53:05
相关问题
MySQL 命令行如何导出 DDL?
1394浏览 • 1回复 待解决
mysql 字段如何重设?
788浏览 • 1回复 待解决
新手提问:hi3861怎么启动命令行呢?
6329浏览 • 2回复 待解决
SQL插入一个数据如何获取ID?
848浏览 • 2回复 待解决
请问如何获取到鸿蒙的根布局
4336浏览 • 1回复 待解决
关于如何获取时钟的id的问题
3705浏览 • 1回复 待解决
如何动态根据资源名获取资源id
6087浏览 • 1回复 已解决
鸿蒙资源id哪里获取
3774浏览 • 1回复 待解决
富鸿蒙开发如何获取设备唯一Id
11224浏览 • 1回复 待解决
openharmony上如何获取类似android_id的值
2193浏览 • 1回复 待解决