Quantcast
Channel: SCN: Message List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 8968

Re: SQL program to count the number of vowels

$
0
0

One way to approach such a problem is what I just did:

 

  1. Google "sql vowel" and find http://stackoverflow.com/questions/13753498/select-vowels-from-a-varchar-oracle-pl-sql
  2. Look up REGEX functions in the SAP HANA documentation and find OCCURRENCES_REGEXPR - SAP HANA SQL and System Views Reference - SAP Library
  3. Fiddle a bit with it to come up with a query that counts vowels for one column

 

 

select user_name,

     OCCURRENCES_REGEXPR ( '[aeiou]' FLAG 'i'  in user_name) as VOWEL_COUNT

from public.users;

 

USER_NAME      VOWEL_COUNT
SYS            0         
SYSTEM        1         
_SYS_STATISTICS3         
_SYS_EPM      1         
_SYS_REPO      2         
_SYS_AFL      1         
DEVDUDE        3         
ADMIN          2         
PUBLICJOE      4         
DEDUDE        3         
JDBCDUDE      2         
OZDUDE        3         
_SYS_TASK      1         
_SYS_XB        0         

 

From here it's trivial to come to a combined firstname/lastname vowel count.

 

- Lars


Viewing all articles
Browse latest Browse all 8968

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>