One line solution - LENGTH() vs CHAR_LENGTH() || SQL Gotcha
Using LENGTH() instead of CHAR_LENGTH() is incorrect when trying to get the number of characters in the string\n\n# Definitions: \n\n- LENGTH(): returns the len
Using ``LENGTH()`` instead of ```CHAR_LENGTH()``` is incorrect when trying to get the ```number of characters in the string```\n\n# Definitions: \n\n- LENGTH(): returns the length of a string _(in bytes)_.\n- CHAR_LENGTH(): return the length of a string _(in characters)_.\n\n# Code\n```\n# Write your MySQL query statement below\nSELECT tweet_id FROM Tweets \nWHERE CHAR_LENGTH(content) > 15;\n```\n# Important Note: \n\nUsing Length() indeed passes all the test cases in this example. But it fails in case of UTF8 where different characters take up different number of bytes. \n\nFor example: Each Chinese character is represented by 3 bytes.\n\n```\n-- Creating a table with a string containing a multibyte character\nCREATE TABLE Example (\n    id INT,\n    content VARCHAR(50)\n);\n\nINSERT INTO Example VALUES\n(1, \'Hello, \u4F60\u597D\'); --> (\'Hello\' -> 3 + \', \' -> 4 + \'\u4F60\u597D\' -> 6 = 13)\n\n\nSELECT LENGTH(content) AS Char_Length FROM Example;\n```\n\nOutput: \n\n```\n+------------+\n| Char_Length |\n+------------+\n| 13         |\n+------------+\n```\n\n**Correct** length of the string is **9** but using Length() here gives out **13** as the answer.
['MySQL']