Conversion
MySQL
CONNECTION_ID
Returns the connection ID (thread ID) for the current connection.
Tipe hasil:
BIGINT UNSIGNEDDiperbarui: 13 Jun 2026Syntax
SQL
CONNECTION_ID()Parameter
Fungsi ini tidak memerlukan parameter.
Contoh Penggunaan
Get Connection ID
SQL
1 SELECT CONNECTION_ID() AS my_conn_id;
Retrieve the current connection ID.
Hasil
my_conn_id: 1234567
Debug Log
SQL
1 INSERT INTO debug_log (connection_id, query, logged_at) 2 VALUES (CONNECTION_ID(), 'SELECT * FROM users', NOW());
Log entries with the connection ID for debugging.
Hasil
(inserted with connection ID)
Find Own Process
SQL
1 SELECT * FROM information_schema.PROCESSLIST 2 WHERE ID = CONNECTION_ID();
View information about the current connection process.
Hasil
(current connection info)
Pertanyaan Umum tentang CONNECTION_ID
Apa itu fungsi CONNECTION_ID di MySQL?
Returns the connection ID (thread ID) for the current connection. Di MySQL, fungsi CONNECTION_ID termasuk dalam kelompok fungsi yang sering digunakan untuk mengolah dan menganalisis data secara efisien.
Bagaimana cara menggunakan CONNECTION_ID di MySQL?
Gunakan sintaks berikut: CONNECTION_ID(). Pastikan argumen yang dimasukkan sudah sesuai dengan tipe data yang diharapkan.
Apa nilai yang dikembalikan oleh fungsi CONNECTION_ID?
Fungsi CONNECTION_ID mengembalikan nilai bertipe BIGINT UNSIGNED. Pastikan tipe data hasil sudah sesuai dengan kebutuhan query atau formula kamu. Jika input mengandung nilai NULL, perilaku fungsi dapat berbeda — selalu periksa dokumentasi untuk memastikan hasilnya sesuai ekspektasi.
Ngulik Langsung
Latihan Langsung →Sudah paham CONNECTION_ID? Latih langsung di browser
Latihan interaktif, langsung di browser.