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 8894851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:36:49+00:00 2026-06-14T23:36:49+00:00

I have often SQL statements of the kind SELECT LENGTH(col_name) FROM `table` WHERE *condition*

  • 0

I have often SQL statements of the kind

SELECT LENGTH(col_name) FROM `table` WHERE *condition*

to establish the size of the contents of a specific column in a given row of a mySQL table. However, it is not clear to me that there is a single SQL statement that would fetch the sum of the content lengths of ALL the columns in a given row. I should add that all the columns in question are VARCHARS.

Yes, I know I could do this by fetching the entire row as

SELECT * FROM `table` WHERE *condition*

collapsing the resulting row contents into a string and getting the length of that string but I was wondering if there isn’t a more efficient one liner to do the job. Any tips would be much appreciated.

  • 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-14T23:36:53+00:00Added an answer on June 14, 2026 at 11:36 pm

    Well, I prefer to use CHAR_LENGTH over LENGTH

    SELECT CHAR_LENGTH(CONCAT(col1,col2,col3)) 
    FROM tableName 
    WHERE...
    

    From the linked question

    LENGTH() returns the length of the string measured in bytes.

    CHAR_LENGTH() returns the length of the string measured in characters.

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

Sidebar

Related Questions

I'm using Squirrel SQL with Oracle. I often have to write quick queries for
I have often encountered an error such as cannot convert from 'method group' to
I have often seen the queries written in SQL in CAPITAL LETTERS . Though
I often have to 'Generate Scripts' for stored procedures on SQL Server Management Studio.
I have a statement that SELECTs distinct rows from a table with a two
For my job I often have to script out a table with all its
I have a table say T in SQL Server 2005 database and it has
I have a relatively small Table in a SQL database in my Android app
I often have to call the Value property when accessing my Linq to SQL
I have a large table in SQL; one field contains the user's name, which

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.