SQL - SCALER FUNCTIONS

 

The following are the most commonly used SQL aggregate functions:

  • UCASE () - Converts a field to upper case

  • LCASE () - Converts a field to lower case

  • MID () - Extract characters from a text field

  • LEN () - Returns the length of a text field

  • ROUND () - Rounds a numeric field to the number of decimals specified

  • NOW () - Returns the current system date and time

  • FORMAT () - Formats how a field is to be displayed

UCASE ()

The UCASE () function converts the value of a field to uppercase.

SYNTAX

SYNTAX FOR SQL Server

EXAMPLE 

Let’s consider a demo database and table SALARYINFO

Figure 49.1. SALARYINFO TABLE

QUERY

OUTPUT

LCASE ()

The LCASE () function converts the value of a field to uppercase.

SYNTAX

SYNTAX FOR SQL Server

EXAMPLE

Let’s consider a demo database and table SALARYINFO

Figure 1Figure 49.2. SALARYINFO TABLE

QUERY

OUTPUT

 
 

MID ()

The MID () function is used to extract characters from a text field.

SYNTAX

SYNTAX FOR SQL Server

LEN ()

THE LEN() function returns the length of the value in a text field.

SYNTAX

SYNTAX FOR SQL Server

EXAMPLE

Let’s consider a demo database and table SALARYINFO

Figure 49.3. SALARYINFO TABLE

QUERY

 

OUTPUT

ROUND ()

The ROUND () function is used to round a numeric field to the number of decimals specified.

SYNTAX

 

NOW ()

The NOW() function returns the current system date and time.

SYNTAX

 

FORMAT ()

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

SYNTAX

 

©2020 by Pavan Lalwani. 

  • Udemy
  • Facebook
  • Twitter
  • YouTube
  • Linkedin