From 2264b6172769a67d757c44f0dc4442e596cd7ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 15 Jan 2025 08:22:43 +0100 Subject: [PATCH] Update docs for LAST_INSERT_ID() (#19831) --- functions-and-operators/information-functions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions-and-operators/information-functions.md b/functions-and-operators/information-functions.md index eb9484cce28cc..d29da8330dd16 100644 --- a/functions-and-operators/information-functions.md +++ b/functions-and-operators/information-functions.md @@ -219,6 +219,8 @@ TABLE t1; > > - In the preceding example, IDs increase by 2 while MySQL would generate IDs incrementing by 1 in the same scenario. For more compatibility information, see [Auto-increment ID](/mysql-compatibility.md#auto-increment-id). +The `LAST_INSERT_ID(expr)` function can accept an expression as an argument, storing the value for the next call to `LAST_INSERT_ID()`. You can use it as a MySQL-compatible method for generating sequences. Note that TiDB also supports proper [sequence functions](/functions-and-operators/sequence-functions.md). + ### ROW_COUNT() The `ROW_COUNT()` function returns the number of affected rows.