Let us try concatenating the strings with a NULL value as one of its parameters in the Concat function. The execution of the above query statement gives the following output: For this, we will use the following query statement – SELECT CONCAT("EDUCBA", "IS A GREAT ", "PLATFORM ", "TO EXPAND ", "YOUR HORIZONS ", "OF LEARNING") AS "Final String" Now, we will concatenate the string values “EDUCBA”, “IS A GREAT “, “PLATFORM “, “TO EXPAND “, “YOUR HORIZONS” and “OF LEARNING” using the Concat function in MySQL. We can observe from the output that an error is raised, saying that an incorrect number of parameters were supplied to the Concat function. The execution of the above query statement gives the following output – ![]() We will execute the following query statement – SELECT CONCAT() Let us first try to execute the MySQL Concat function without passing any parameters and see the output which is arisen. Passing a NULL value to the Concat function in any of the parameters gives out the resultant value as NULL itself, irrespective of what other values are passed as parameters. The minimum one parameter is a must for using the Concat function. If the Concat function is used without specifying any parameter value, it will result in an error. ![]() The string expressions can be any of the constant or literal string values, variables having string values, columns that store the string values with datatype varchar, or any string value specified in single or double quotes. We can provide as many parameters as we want to concatenate using the Concat function. CONCAT(string_expression1,string_expression2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |