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.
Here we will concatenate ‘speciality’ column with ‘hospital’ column.
SELECT CONCAT(SPECIALITY,' ', HOSPITAL)
FROM DOCTORS
You can also use ‘+’ sign to concatenate
SELECT SPECIALITY + ‘Care’
FROM DOCTORS
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;
UPPER()
The UPPER() function is used to convert string into upper-case.
SYNTAX:
SELECT UPPER(string)
EXAMPLE:
SELECT UPPER(SPECIALITY)
FROM DOCTORS ;
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
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