メインコンテンツまでスキップ
バージョン: 3.1

database

説明​

現在のデータベース名を返します。データベースが選択されていない場合は、空の値が返されます。

構文​

database()

パラメータ​

この関数はパラメータを必要としません。

戻り値​

現在のデータベース名を文字列として返します。

例​

-- 目的のデータベースを選択します。
use db_test

-- 現在のデータベース名をクエリします。
select database();
+------------+
| DATABASE() |
+------------+
| db_test |
+------------+

関連項目​

USE: 目的のデータベースに切り替えます。

Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.