x

SQL – FORMAT()

Prev     Next

SQL FORMAT() function is used to format a field/column value that how it should be displayed in the output. Syntax for SQL FORMAT() function is given below.


SQL Syntax for FORMAT() function:

Syntax for FORMAT() function in SQL SELECT FORMAT(column_name, format) FROM table_name;

Where,

  • Column_name – It is the column name that needs to be formatted. It’s a mandatory field.
  • Start – It specifies the format. It’s a mandatory field.

Please consider the following table with few records as given below.

Table name (for example): student
Column names in this table: Student_ID, Student_name, City and Marks
Available records: 4 rows