Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:22:38+00:00 2026-06-10T21:22:38+00:00

I want to create an acronym column in a table. I want to be

  • 0

I want to create an acronym column in a table. I want to be grab the first letter of each word from a ‘name’ column, capitalize it, then concatenate all into an ‘acronym’ column.

Any easy way to grab first letters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:22:39+00:00Added an answer on June 10, 2026 at 9:22 pm

    Here is an “improved” function, allowing to filter only wanted characters thanks to a regular expression.

    • function initials does the actual job, you have to specify the regular expression
    • function acronym does the job keeping Alpha-numeric characters only

    (Use upper, lower or ucase functions on the output if necessary)
    .

    delimiter $$
    drop function if exists `initials`$$
    CREATE FUNCTION `initials`(str text, expr text) RETURNS text CHARSET utf8
    begin
        declare result text default '';
        declare buffer text default '';
        declare i int default 1;
        if(str is null) then
            return null;
        end if;
        set buffer = trim(str);
        while i <= length(buffer) do
            if substr(buffer, i, 1) regexp expr then
                set result = concat( result, substr( buffer, i, 1 ));
                set i = i + 1;
                while i <= length( buffer ) and substr(buffer, i, 1) regexp expr do
                    set i = i + 1;
                end while;
                while i <= length( buffer ) and substr(buffer, i, 1) not regexp expr do
                    set i = i + 1;
                end while;
            else
                set i = i + 1;
            end if;
        end while;
        return result;
    end$$
    
    drop function if exists `acronym`$$
    CREATE FUNCTION `acronym`(str text) RETURNS text CHARSET utf8
    begin
        declare result text default '';
        set result = initials( str, '[[:alnum:]]' );
        return result;
    end$$
    delimiter ;
    

    Example1:

    select acronym('Come Again? That Cant Help!');
    

    Outputs:

    CATCH

    Example2:

    select initials('Come Again? That Cant Help!', '[aeiou]');
    

    Outputs:

    oeAaaae

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create Word document from another Word document, but I need replace some
i want create multiple search where statement $where_search is a multiple condition from post
i want create a custom json data from the mssql 2008 results so that
I want to create a new field (or two) in my table that is
I want to create a Silverlight app to extract and manipulate data from an
I want create a ModelForm class where model is a parameter passed from the
In C# code, I want create a log file for each each method in
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
I want create one form from another. But the Form class has no the
I want create object from Canvas3D class(in java) but my Compiler doesn't have this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.