📣新登場!TiDB Cloud BYOC、TiDB Cloud Filesystem、PostgreSQL-compatible TiDB Cloud Starter がパブリックプレビュー中。このページは自動翻訳されたものです。原文はこちらからご覧ください。

SHOW SEQUENCES



作成されたシーケンスの一覧を返します。

構文

SHOW SEQUENCES [ LIKE '<pattern>' | WHERE <expr> ]
パラメータ説明
LIKE大文字と小文字を区別するパターンマッチングを使用して、名前で結果を絞り込みます。
WHEREWHERE 句の式を使用して結果を絞り込みます。name、start、interval、current、created_on、updated_on、comment など、結果セット内の任意のカラムに基づいてフィルタできます。例: WHERE start > 0 または WHERE name LIKE 's%'。

例

-- Create a sequence CREATE SEQUENCE seq; -- Show all sequences SHOW SEQUENCES; ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ name │ start │ interval │ current │ created_on │ updated_on │ comment │ ├────────┼────────┼──────────┼─────────┼────────────────────────────┼────────────────────────────┼──────────────────┤ │ seq │ 1 │ 1 │ 1 │ 2025-05-20 02:48:49.749338 │ 2025-05-20 02:48:49.749338 │ NULL │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -- Use the sequence in an INSERT statement CREATE TABLE tmp(a int, b uint64, c int); INSERT INTO tmp select 10,nextval(seq),20 from numbers(3); -- Show sequences after usage SHOW SEQUENCES; ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ name │ start │ interval │ current │ created_on │ updated_on │ comment │ ├────────┼────────┼──────────┼─────────┼────────────────────────────┼────────────────────────────┼──────────────────┤ │ seq │ 1 │ 1 │ 4 │ 2025-05-20 02:48:49.749338 │ 2025-05-20 02:49:14.302917 │ NULL │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -- Filter sequences using WHERE clause SHOW SEQUENCES WHERE start > 0; ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ name │ start │ interval │ current │ created_on │ updated_on │ comment │ ├────────┼────────┼──────────┼─────────┼────────────────────────────┼────────────────────────────┼──────────────────┤ │ seq │ 1 │ 1 │ 4 │ 2025-05-20 02:48:49.749338 │ 2025-05-20 02:49:14.302917 │ NULL │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -- Filter sequences by name pattern SHOW SEQUENCES LIKE 's%'; ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ name │ start │ interval │ current │ created_on │ updated_on │ comment │ ├────────┼────────┼──────────┼─────────┼────────────────────────────┼────────────────────────────┼──────────────────┤ │ seq │ 1 │ 1 │ 4 │ 2025-05-20 02:48:49.749338 │ 2025-05-20 02:49:14.302917 │ NULL │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

このページは役に立ちましたか?