SQL Scalar Functions

tutorial and example
tutorial and example

TEACHER Table

LCASE() Function

The LCASE() function is used to return lower case values of specified column.

Syntax:

Select Lcase(column_name)

from table_name;

Example:

Select Lcase(teacher_name)

from teacher;

Syntax:

Select Lcase(column_name)

from table_name

[where condition];

Example:

Select Lcase(teacher_name)

from teacher

where teacher_id=1;

UCASE() Function

The UCASE() function is used to return values in upper case of specified column.

Syntax:

Select Ucase(column_name)

from table_name;

Example:

Select Ucase(teacher_name)

from teacher;

 Syntax:

Select Ucase(column_name)

from table_name

[where condition];

Example:

Select Ucase(teacher_name)

from teacher

where teacher_id=2;

MID() Function

The MID() function is used to return the substring. In syntax we have passed three parameters first is column name or string, second is position from where user want to start substring, and third specifies the length of substring.

Syntax:

Select Mid(column_name/’string’, position, length)

From teacher;

Example:

Select teacher_name,Mid(teacher_name,2,6)

From teacher;

Syntax:

Select Mid(column_name/’string’, position, length)

From teacher

Where condition;

Example:

Select Mid(teacher_name,2,6)

From teacher

Where teacher_id=7;

Example:

Select Mid(‘JAVA_T_POINT’,3,6);

;;

 

ROUND() Function

The Round() function is used to return the round number values.

Syntax:

Select Round(column_name)

from table_name;

Example:

Select Round(salary)

from teacher;

Syntax:

Select Round (column_name)

from table_name

[where condition];

Example:

Select Round (salary)

from teacher

where teacher_name=’monu vasu’;