Unlike MySQL, GUID (Globally Unique Identifier) in SQL is a special column data type.
In MySQL you would simply use a char(36) or an binary(16) field that could be easily queried like that:
SELECT * FROM table WHERE char_guid_field = "85eaddd7-2582-480f-b057-e7230da3601b"
/* or */
SELECT * FROM table WHERE binary_guid_field = 0x85eaddd72582480fb057e7230da3601b
/* or */
SELECT * FROM table WHERE binary_guid_field = X'85eaddd72582480fb057e7230da3601b'
Attention: The binary notations “0x” and “X’…’” are case sensitive.
In SQL you have to do an explicit type cast of input strings to uniqueidentifier to achieve the same:
CAST(guid_field as uniqueidentifier) = CAST('85eaddd7-2582-480f-b057-e7230da3601b' as uniqueidentifier)
Further information about GUID’s in SQL:
- What is a GUID: https://www.sqlshack.com/understanding-the-guid-data-type-in-sql-server/
- Different unique id types in SQL: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/comparing-guid-and-uniqueidentifier-values
- Online GUID generator:https://www.uuidgenerator.net/guid
- GUID Converter: https://toolslick.com/conversion/data/guid
- Data type uniqueidentifier: https://learn.microsoft.com/en-us/sql/t-sql/data-types/uniqueidentifier-transact-sql?view=sql-server-ver16