简体   繁体   English

Postgresql中子字符串的区别

[英]Difference between substring in Postgresql

I was checking the PostgreSQL Manual the last days and I have noticed that substring() is explained there with substring('string' FROM [int] FOR [int]) .最近几天我正在查看 PostgreSQL 手册,我注意到substring()在那里用substring('string' FROM [int] FOR [int])

I normally just use substring('string', [int], [int]) because I learned it that way from MySQL my simple question is now if this two have any differences is the first one maybe the better choice to use in PostgreSQL or does do the same and these are just 2 different kinds of doing the same thing?我通常只使用substring('string', [int], [int])因为我是从 MySQL 中学到的,我的简单问题是,如果这两个有任何区别,第一个可能是在 PostgreSQL 中使用的更好选择,或者做同样的事情,这些只是两种不同的做同样的事情吗?

SUBSTRING(char_exp FROM start_position [FOR length]) syntax is part of SQL-92 standard and you are encouraged to use it. SUBSTRING(char_exp FROM start_position [FOR length])语法是SQL-92 标准的一部分,鼓励您使用它。

This syntax also works in MySQL .此语法也适用于 MySQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM