SQL functions are used to perform mathematical, statistical, and logical operations.
CONCAT()
The CONCAT() function helps in adding two or more strings.
SYNTAX:
SELECT CONCAT(string_1, string_2) ;
EXAMPLE:
Here is the demo table that we will use:
Demo table name is DOCTORS.
![](https://techniti.org/wp-content/uploads/2023/09/11.png)
Here we will concatenate ‘speciality’ column with ‘hospital’ column.
SELECT CONCAT(SPECIALITY,' ', HOSPITAL)
FROM DOCTORS
![](https://techniti.org/wp-content/uploads/2023/09/22.png)
You can also use ‘+’ sign to concatenate
SELECT SPECIALITY + ‘Care’
FROM DOCTORS
![](https://techniti.org/wp-content/uploads/2023/09/66.png)
CONCAT_WS
This function helps in adding two or more strings together with a separator.
EXAMPLE:
SELECT CONCAT_WS(' dept. of ', SPECIALITY, HOSPITAL)
FROM DOCTORS;
![](https://techniti.org/wp-content/uploads/2023/09/33.png)
UPPER()
The UPPER() function is used to convert string into upper-case.
SYNTAX:
SELECT UPPER(string)
EXAMPLE:
SELECT UPPER(SPECIALITY)
FROM DOCTORS ;
![](https://techniti.org/wp-content/uploads/2023/09/44.png)
LOWER()
The LOWER() function is used to lower-case the string provided in the function argument.
SELECT LOWER(string)
EXAMPLE:
SELECT LOWER(SPECIALITY)
FROM DOCTORS
![](https://techniti.org/wp-content/uploads/2023/09/55.png)
THANKS FOR READING!
Resource: https://learn.microsoft.com/en-us/sql/t-sql/functions/upper-transact-sql?view=sql-server-ver16
LEARN MORE –
SQL Basics
SQL INSERT with EXAMPLES