Skip to main content
SQL โ€ข LESSON 136

LENGTH

How can we measure character count in text columns?

Advancedโฑ 3 Minutesโญ 1490 XP
๐Ÿค” THE QUESTION

How can we measure character count in text columns?

๐Ÿ’ก WHAT IS IT?

LENGTH() returns the number of characters in a string value.

๐ŸŽฏ WHAT IS IT USED FOR?

Data validation, checking password length, detecting truncation in ETL ingestion.

๐Ÿ’ป EXAMPLE
SELECT
name,
LENGTH(name) AS name_length
FROM employees;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for LENGTH.

  • โœ“ LENGTH() function
  • โœ“ Character count
  • โœ“ String validation
  • โœ“ Schema length auditing