0
0
MySQLquery~10 mins

LENGTH and CHAR_LENGTH in MySQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the byte length of the string 'hello'.

MySQL
SELECT [1]('hello') AS length_bytes;
Drag options to blanks, or click blank then click option'
ACHAR_LENGTH
BLENGTH
CLEN
DSIZE
Attempts:
3 left
💡 Hint
Common Mistakes
Using CHAR_LENGTH instead of LENGTH for byte count.
Using LEN which is not a MySQL function.
2fill in blank
medium

Complete the code to get the number of characters in the string 'café'.

MySQL
SELECT [1]('café') AS char_count;
Drag options to blanks, or click blank then click option'
ALEN
BLENGTH
CSIZE
DCHAR_LENGTH
Attempts:
3 left
💡 Hint
Common Mistakes
Using LENGTH which counts bytes, not characters.
Using LEN which is not valid in MySQL.
3fill in blank
hard

Fix the error in the code to correctly get the character count of 'naïve'.

MySQL
SELECT [1]('naïve') AS char_count;
Drag options to blanks, or click blank then click option'
ACHAR_LENGTH
BLENGTH
CLEN
DSIZE
Attempts:
3 left
💡 Hint
Common Mistakes
Using LENGTH which counts bytes, leading to incorrect count.
Using LEN which causes syntax error.
4fill in blank
hard

Fill both blanks to get the byte length and character length of 'résumé'.

MySQL
SELECT [1]('résumé') AS bytes, [2]('résumé') AS chars;
Drag options to blanks, or click blank then click option'
ALENGTH
BCHAR_LENGTH
CLEN
DSIZE
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping LENGTH and CHAR_LENGTH.
Using LEN or SIZE which are invalid.
5fill in blank
hard

Fill all three blanks to get the byte length, character length, and compare if they are equal for 'touché'.

MySQL
SELECT [1]('touché') AS bytes, [2]('touché') AS chars, ([1]('touché') [3] [2]('touché')) AS equal_lengths;
Drag options to blanks, or click blank then click option'
ALENGTH
BCHAR_LENGTH
C=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using == which is invalid in SQL.
Mixing up LENGTH and CHAR_LENGTH.