Although rarely, it could happen that you end up with fully capitalized strings in SQL. Whilst there's often nothing wrong with the data quality, it's not very appealing to be showing the users of your analyses data in capital letters. Personally, I always get the feeling of being shouted at when I see fully capitalized … Continue reading How do I change the case of a string with SQL?→

It's quite simple if you're using MySQL or PostgreSQL - the function you need in both is simply - length() There are a couple of points you'd better keep in mind if you're using SQL Server, however. 1. The function in that environment is called len() 2. Unlike length in the other two database systems, … Continue reading How do I determine the length of a string with SQL?→

Depending on the database you're using, the function will be called differently and may have different syntax. MySQL, vertica instr(full string, string to search) PosgreSQL position(string to search in full string) SQL Server charindex(string to search, full string, {starting position}) As you might have noticed, the function in SQL Server has an additional argument, allowing … Continue reading How do I find the first position of a string within a string with SQL?→

Remember when we previously talked about extracting part of a string with SQL? As SQL Server and PostgreSQL would not support a "mid" function, getting a string that was placed in the middle of another could be a bit tricky.... We then solved it by applying a double right() and left() functions. There is, however, another … Continue reading How do I get part of a string with SQL? (part 2)→