
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What MySQL returns if we pass column name, containing a NULL value, as one of the arguments of CONCAT() function?
As we know that CONCAT() function will return NULL if any of the argument of it is NULL. It means MySQL will return NULL if we pass column name, containing a NULL value, as one of the arguments of CONCAT() function. Following is an example of ‘Student’ table to explain it.
Example
In this example, we are concatenating the values of two strings and at 5th row one, the value is NULL hence the concatenation result is also NULL.
mysql> Select Name, Address, CONCAT(Name,' Resident of ',Address)AS 'Detail of Student' from Student; +---------+---------+---------------------------+ | Name | Address | Detail of Student | +---------+---------+---------------------------+ | Gaurav | Delhi | Gaurav Resident of Delhi | | Aarav | Mumbai | Aarav Resident of Mumbai | | Harshit | Delhi | Harshit Resident of Delhi | | Gaurav | Jaipur | Gaurav Resident of Jaipur | | Yashraj | NULL | NULL | +---------+---------+---------------------------+ 5 rows in set (0.00 sec)
- Related Articles
- What MySQL returns if we use NULL, as both the arguments, as one of the argument and as a separator, in CONCAT_WS() function?
- What MySQL CONCAT() function returns by passing the numeric arguments?
- How can we overcome the property of CONCAT() function that it returns NULL if any one of the argument is NULL, especially when we want to concatenate the values from the column and any of the columns have NULL as its value?
- What MySQL COALESCE() function returns if all the arguments provided to it are NULL?
- What happens if I pass only one argument to the MySQL CONCAT() function?
- What MySQL returns if the argument of QUOTE() function is NULL?
- What MySQL returns if the list of strings, provided as argument in FIELD() function, are NULL?
- What MySQL EXPORT_SET() function returns if any of the argument is NULL?
- What MySQL returns if the first argument of INTERVAL() function is NULL?
- What would be the result if we perform any kind of arithmetic calculations in MySQL having one of the arguments as NULL?
- What MySQL returns if we provide value larger than 255 as argument to MySQL CHAR() function?
- When MySQL LOCATE() function returns NULL as the output?
- When MySQL FIND_IN_SET() function returns NULL as output?
- What is the advantage of CONCAT_WS() function over CONCAT() function when we want to concatenate the values from the column and any of the columns have NULL as its value?
- What MySQL COUNT() function returns if there are some NULL values stored in a column also?

Advertisements