count characters in sql code example

Example 1: mysql string length

-- Relevant for MySQL only

-- syntax
LENGTH(<your-string>)

-- example
LENGTH('CountCharacters') -- OUTPUT: 15
        123456789012345

-- example with query 
SELECT 'CountCharacters',LENGTH('CountCharacters')
FROM DUAL;

-- OUTPUT: CountCharacters, 15

Example 2: check character count in sql

SELECT LEN('W3Schools.com');

Example 3: sql string length

-- Relevant for SQL-Oracle only

-- syntax
LENGTH(<your-string>)

-- example
LENGTH('CountCharacters') -- OUTPUT: 15
        123456789012345

-- example with query 
SELECT 'CountCharacters',LENGTH('CountCharacters')
FROM DUAL;

-- OUTPUT: CountCharacters, 15

Example 4: sql length

-- Relevant for MS SQL (SQL Server)
LEN('string')

Tags:

Sql Example