Comparing strings in postgres using comparison operators?
<p>In many programming languages you can compare strings using operators like >, >=, &lt; etc...and the language will base the comparison on the position of the letter in the alphabet.</p>

<p>For example in PHP</p>

<pre><code>if ('a' &lt; 'b') {
    echo 'Yes';
} else {
    echo 'No';
}
&gt; Yes
</code></pre>

<p>However in postgres or mysql</p>

<pre><code>SELECT
CASE WHEN 'a' &lt; 'b' THEN 'yes' END
FROM table
Output: null
</code></pre>

<p>I have a table with strings that I need to compare against each other through SQL.</p>

<p>For example:
6.2(5a) 
6.2(5b) -- this would be greater than 6.2(5a)
Or 
6.2(15) -- this would be greater than 6.2(5a)</p>

<p>I thought of assigning a number to a letter using a regexp but then that would break the comparisons when there are no letter.</p>

<p>How would you go about this purely in SQL?</p>