How to Use the Trim Function
When running more complex queries, such as concatenating strings, often times you may need to trim whitespace from the values.
Let’s look at an example of this. Remember the query we ran for concatenating:
SELECT CONCAT (productName, ” , ” , price) FROM products;
As it is the output would be XBOX , $399
Let’s say we wanted to trim the whitespace between XBOX and the comma.
Here’s the query:
SELECT CONCAT (RTRIM(productName) ” , ” , price) FROM products;
In this case we used rtrim because we wanted to trim to the right or immediately following the value. If we wanted to trim space before the value we would use the LTRIM, and if we wanted to trim from both sides, we would simply use trim.
Filter Data Using the Having ClauseHow to Concantenate Strings















