boolean
SQL Server 是 bit,并使用 1 代表 true,0 代表 false。
PostgreSQL 直接是 boolean,使用 true、false 赋值,大小写无所谓,因为它会被转换成小写。
numeric
可用来表示精确的小数。
text
可用来表示字符串。
字符串用单引号包起来。
字符串内的单引号,需替换为 2 个单引号。
字符串连接,使用 ||。
like 查询
update tbl set username='123' where id=1;
update tbl set username='1%3' where id=2;
update tbl set username='1_3' where id=3;
update tbl set username='1\3' where id=4;
select * from tbl where username like '1\%3';
select * from tbl where username like '1\_3';
select * from tbl where username like '1\\3';
% 和 _ 都是通配符,如果要将其按普通字符对待,加 \ 即可,C# 替换语句:
s = s.Replace(@"'", @"''").Replace(@"\", @"\\").Replace(@"_", @"\_").Replace(@"%", @"\%");