In this guide, we will explain how to use the MySQL CONNECTION_ID function with syntax and examples.
Description
The MySQL CONNECTION_ID function returns the connection ID for the current connection, which is a unique ID among the currently connected clients.
Syntax
The syntax for the CONNECTION_ID function is:
CONNECTION_ID( )
Parameters or Arguments
There are no parameters or arguments for the CONNECTION_ID function.
Note
- Each connection in the MySQL database has a connection ID that is unique among the currently connected clients.
Applies To
The CONNECTION_ID function can be used in the following versions :
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23.14
Example
Let’s look at some CONNECTION_ID function examples and explore how to use the CONNECTION_ID function.
For example:
mysql> SELECT CONNECTION_ID();
Since the CONNECTION_ID function returns the unique ID for the current connection, t might display something like this:
mysql> SELECT CONNECTION_ID(); Result: 57
In this case, the unique ID for the connection is 57.
Next Topic : Click Here
Pingback: MySQL: COALESCE Function | Adglob Infosystem Pvt Ltd