Fungsi Conversion MySQL
Fungsi untuk konversi tipe data. Temukan semua 24 fungsi conversion di MySQL lengkap dengan syntax, contoh, dan penjelasan bahasa Indonesia.
24 fungsi conversion di MySQL
← Semua fungsi MySQLBIN
Converts a decimal number to its binary string representation. This is shorthand for CONV(num, 10, 2).
VARCHARBINARY
Mengkonversi ekspresi ke tipe BINARY string. Membuat perbandingan string menjadi case-sensitive dan byte-by-byte.
BINARYBIN_TO_UUID
Converts a BINARY(16) UUID back to its string representation. The inverse of UUID_TO_BIN().
VARCHAR(36)CAST
Mengkonversi nilai ke tipe data tertentu. Standar SQL untuk type casting.
Specified typeCONNECTION_ID
Returns the connection ID (thread ID) for the current connection.
BIGINT UNSIGNEDCONV
Converts a number from one base to another. Supports bases from 2 to 36.
VARCHARCONVERT
Mengkonversi nilai ke tipe data atau charset tertentu. Alternatif untuk CAST dengan sintaks berbeda.
Specified typeDATABASE
Returns the name of the currently active (selected) database.
VARCHARFORMAT
Formats a number with thousands separators and a specified number of decimal places. Useful for displaying numbers in a human-readable format.
VARCHARFROM_UNIXTIME
Converts a Unix timestamp to a DATETIME value or a formatted string. The inverse of UNIX_TIMESTAMP().
DATETIME | VARCHARINET6_ATON
Converts an IPv4 or IPv6 address string to binary format. Supports both IP address formats.
VARBINARY(16)INET6_NTOA
Converts a binary IP address to string format. This is the reverse of INET6_ATON().
VARCHARINET_ATON
Converts an IPv4 address string to an unsigned integer. Useful for efficient storage and range-based IP queries.
BIGINT UNSIGNEDINET_NTOA
Converts an unsigned integer to an IPv4 address string. The inverse of INET_ATON().
VARCHAR(15)LAST_INSERT_ID
Returns the last AUTO_INCREMENT value generated for a column in the current connection.
BIGINT UNSIGNEDOCT
Converts a decimal number to its octal string representation. Shorthand for CONV(num, 10, 8).
VARCHARSTR_TO_DATE
Converts a string to a DATE, DATETIME, or TIME value based on the provided format string. The inverse of DATE_FORMAT.
DATE | DATETIME | TIMETIME_FORMAT
Formats a TIME value into a string according to the specified format. Similar to DATE_FORMAT but designed specifically for time values.
VARCHARUNIX_TIMESTAMP
Returns the Unix timestamp (seconds since 1970-01-01 00:00:00 UTC). When called with no argument, returns the current Unix timestamp.
BIGINTUSER
Returns the username and hostname of the current MySQL connection.
VARCHARUUID
Generates a version 1 Universal Unique Identifier (UUID). The returned value follows the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
VARCHAR(36)UUID_SHORT
Generates a unique 64-bit unsigned integer. Faster and more compact than UUID().
BIGINT UNSIGNEDUUID_TO_BIN
Converts a UUID string to BINARY(16) format for more efficient storage.
BINARY(16)VERSION
Returns a string indicating the MySQL server version.
VARCHAR