Skip to main content
SQL • LESSON 136

LENGTH

How can we measure character count in text columns?

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