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

Goodness... working with OLD tools... alright.

How about removing all vowels from the string and checking how many characters you lost?

 

select user_name,

     length( user_name) -

     length (replace (

        replace (

        replace (

        replace (

        replace (upper(user_name)

            , 'A', '')

            , 'E', '')

            , 'I', '')

            , 'U', '')

            , 'O', '')

            ) vowel_count_stoneage,

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

from public.users;

 

 

Not as fancy, but does it's job.

 

- 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>