Returns the name of the currently active (selected) database.
VARCHARDiperbarui: 13 Jun 2026DATABASE()Fungsi ini tidak memerlukan parameter.
1 SELECT DATABASE() AS current_db;
Display the currently active database.
1 SELECT CASE 2 WHEN DATABASE() = 'production' THEN 'CAREFUL!' 3 ELSE 'Safe to test' 4 END AS environment;
Check the environment based on the database name.
1 INSERT INTO audit_log (db_name, action, created_at) 2 VALUES (DATABASE(), 'user_login', NOW());
Log entries enriched with the database name.
Sudah paham DATABASE? Latih langsung di browser
Latihan interaktif, langsung di browser.