SQL FORMAT Function


The FORMAT() function is used to format how a field is to be displayed.

Syntax

SELECT FORMAT(column_name,format) FROM table_name;
Parameter Description
column_name Required. The field to be formatted.
format Required. Specifies the format.

Example

student Table

stud_sidstud_namestud_fee
11211Ashwani200
11212Sachin400
11213Deepak600
11214Sanjay800
SELECT stud_name, stud_fee, FORMAT(Now(),'YYYY-MM-DD') AS date FROM student;
Output
stud_namestud_feedate
Ashwani200
Sachin400
Deepak600
Sanjay800

Share this article on