ID EN
Miscellaneous Functions

NAME_CONST(name,value)

MySQL 8.4 🇮🇩 Bahasa Indonesia

Mengembalikan nilai yang diberikan. Ketika digunakan untuk menghasilkan kolom kumpulan hasil, NAME_CONST() menyebabkan kolom tersebut memiliki nama tertentu. Argumennya harus konstan.

Syntax

MYSQL
SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
|     14 |
+--------+

Contoh

Example

This function is for internal use only. The server uses it when writing statements from stored programs that contain references to local program variables, as described in Section 27.7, “Stored Program Binary Logging”. You might see this function in the output from mysqlbinlog.

MYSQL
SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
|     14 |
+--------+
Example 2

For your applications, you can obtain exactly the same result as in the example just shown by using simple aliasing, like this:

MYSQL
SELECT 14 AS myname;
+--------+
| myname |
+--------+
|     14 |
+--------+
1 row in set (0.00 sec)