©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

MariaDB SYS_GUID SQL Function - GUID (Global Unique Identifier)

SYS_GUIDSyntax:SYS_GUID()
Return value:CHAR
Function type:Miscellaneous function
Function Description

The SYS_GUID() function returns a 16-byte GUID (Globally Unique Identifier) ​​as a hexadecimal value with 32 characters.

The function works similar to the UUID() function, but without the separator.


The feature was introduced in MariaDB from version 10.7 for Oracle compatibility. It doesn't exist in MySQL.

SQL Examples for the SYS_GUID function

 1
 2
 3

SELECT SYS_GUID();

sys_guid()
varchar(32) BINARY
36aac8ffd63211ed9a480800275588ea

Example of creating a replacement function for SYS_GUID() in MySQL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16

/* Use MULTI-QUERY-Option in myway SQL manager */

DROP FUNCTION IF EXISTS SYS_GUID;

CREATE FUNCTION SYS_GUID()
RETURNS varchar(32)

BEGIN

return replace(uuid(), '-''');
    
END;

SELECT SYS_GUID();

sys_guid()
varchar(32) BINARY
18acee4ade8e11eda01c80ee73e9b513
The examples were created with the MyWAY SQL manager: Download

How to use the SYS_GUID() function in MySQL and MariaDB databases

In MySQL and MariaDB databases the SYS_GUID() function is used to generate a new Globally Unique Identifier: GUID value. The function can be used directly in a SQL statement or within a SQL query, requires no arguments, and returns a string of hexadecimal characters representing a unique identifier that can be used as a primary key or for other identification purposes.

GUIDs are used as unique identifiers in distributed systems or when generating keys that must be globally unique. This can be used to generate unique primary keys for tables, especially in distributed environments or when data from multiple sources needs to be merged. In data synchronization and data replication, GUIDs are useful to ensure uniqueness and avoid conflicts when synchronizing or replicating data across multiple databases or systems.
SUBSTRING_INDEXSUBTIMESUMSYS_GUIDSYSDATESYSTEM_USERTAN

Further MySQL und MariaDB SQL Miscellaneous functions

BIN_TO_UUIDBIN_TO_UUID(Binary string [, Swap])
More about BIN_TO_UUID Function

GET_LOCKGET_LOCK()

INET6_ATONINET6_ATON(String)
More about INET6_ATON Function

INET6_NTOAINET6_NTOA(Binary string)
More about INET6_NTOA Function

INET_ATONINET_ATON(String)
More about INET_ATON Function

INET_NTOAINET_NTOA(Value)
More about INET_NTOA Function

IS_FREE_LOCKIS_FREE_LOCK()

IS_IPV4IS_IPV4(String)
More about IS_IPV4 Function

IS_IPV4_COMPATIS_IPV4_COMPAT(String)

IS_IPV4_MAPPEDIS_IPV4_MAPPED(String)

IS_IPV6IS_IPV6(String)
More about IS_IPV6 Function

IS_USED_LOCKIS_USED_LOCK()

IS_UUIDIS_UUID(String)
More about IS_UUID Function

MASTER_GTID_WAITMASTER_GTID_WAIT()

MASTER_POS_WAITMASTER_POS_WAIT()

NAME_CONSTNAME_CONST(Name, Value)
More about NAME_CONST Function

RELEASE_ALL_LOCKSRELEASE_ALL_LOCKS()

RELEASE_LOCKRELEASE_LOCK()

UUIDUUID()
More about UUID Function

UUID_SHORTUUID_SHORT()
More about UUID_SHORT Function

UUID_TO_BINUUID_TO_BIN(String [, Swap])
More about UUID_TO_BIN Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the SYS_GUID SQL function: mariadb.com
Updated: 2023-09-17ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer