The following query sorts a binary column in BigQuery:
with tbl as (
select B'123' as col union all select B'234'
) select * from tbl order by col;
----------------------------------
Row col f0_
1 MTIz false
2 MjM0 false
Is there a convention for how a Binary column is sorted? The above example is tested against BigQuery.
The BINARY
type is similar to CHAR, except that it stores binary strings rather than nonbinary strings. That is, it stores byte strings rather than character strings.
This means they have the binary character set and collation, and comparison and sorting are based on the numeric values of the bytes in the values .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.