PostgreSQL如何区分全角

时间:2018-11-16 08:34:14

标签: postgresql

我的数据集中的数据如下所示,即varchar数据类型。

123456789X
123456789x
123456789x
123456789X

请告知如何使用较低的从低到高于4的比值?谢谢。

我发现了如何通过以下方式解决此问题:

SELECT DISTINCT(TRANSLATE(LOWER(telephone),
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'))

2 个答案:

答案 0 :(得分:1)

这是解决方案:

SELECT DISTINCT(TRANSLATE(LOWER(telephone),
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'))

答案 1 :(得分:0)

我将删除空格(使用#include<iostream> using namespace std; class triangle{ //data and method given by question private: float value1,value2; public: triangle(float h, float b); float getHeight(); float getWidth(); float calculateArea(); }; triangle::triangle(float h, float b){ value1=h; value2=b; } float triangle::getHeight(){ return value1; } float triangle::getWidth(){ return value2; } float triangle::calculateArea(){ float area; area=(1/2)*value1*value2; return area; } int main(){ triangle sample; cout<<"Enter height: "; cin>>h; cout<<"Enter width: "; cin>>b ; sample.triangle(h,b); sample.getHeight(); sample.getWidth(); sample.calculateArea(); cout<<"The area is "<<sample.calculateArea(); return 0; } ),然后应用replace

distinct