If I use Sql BETWEEN operator with Hexa numbers as Strings, will i get the same result as converting the hexa in to numeric and then performing between operation.
Will the below two sql's get same results.
Product ID is stored in db as hexa string
SELECT product_name FROM Products WHERE product_id BETWEEN "24ab" AND "82df" ORDER BY product_id;
Product ID is converted from hexa to decimal (int) in DB.
SELECT product_name FROM Products WHERE product_id BETWEEN 9387 AND 33503 ORDER BY product_id;
My expectation is above two sql's will output same products.
Example of sql BETWEEN operation on strings can be found here.
hexa(24ab) = decimal(9837) and
hexa(82df) = decimal(33503)
Just curious - does string comparison use ascii value of each char to compare. I hope so.