By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table users (
id int,
name varchar(255)
);
insert into users (id, name)
values
(1, 'bar'),
(2, 'bar ');
2 rows affected
select * from users where name = 'bar ';
id | name |
---|---|
1 | bar |
2 | bar |
select * from users where name = 'BAR';
id | name |
---|---|
1 | bar |
2 | bar |
select * from users where name = 'bàz';
id | name |
---|
select * from users where (name collate Latin1_General_BIN2) in ('bàr', 'BAR', 'bar ');
id | name |
---|---|
1 | bar |
2 | bar |
select * from users where (name collate Latin1_General_CS_AS) in
('bàr' collate Latin1_General_CS_AS,
'BAR' collate Latin1_General_CS_AS,
'bar ' collate Latin1_General_CS_AS);
id | name |
---|---|
1 | bar |
2 | bar |
select * from users where cast(name as binary) = 'bar';
id | name |
---|
select * from users where cast(name as binary) = cast('bar' as binary);
id | name |
---|---|
1 | bar |
select * from users where cast(name as binary) in
(cast('bàr' as binary),
cast('BAR' as binary),
cast('bar ' as binary));
id | name |
---|