SQL function


SQL has many built-in functions that can be used for counting and calculating.


SQL Aggregate function


The SQL Aggregate function calculates the value obtained from the column and returns a single value.

Useful Aggregate function:

  • AVG() - Returns an average
  • COUNT() - Returns the number of rows
  • FIRST() - Returns the value of the first record
  • LAST() - Returns the value of the last record
  • MAX() - Returns the maximum value
  • MIN() - Returns the minimum value
  • SUM() - Returns the sum

SQL Scalar function


The SQL Scalar function returns a single value based on the input value.

Useful Scalar function:

  • UCASE() - Converts a field to capital
  • LCASE() - Converts a field to lesscase
  • MID() - Extract characters from a text field
  • LEN() - Returns the length of a text field
  • ROUND() - Rounds a numeric field by specifying the scale
  • NOW() - Returns the current system date and time
  • FORMAT() - Format how a field is displayed

Tip: In the following sections, we'll cover the Aggregate and Scalar functions in more detail.


Chapter test


Now, take a look at how well you know sql functions with the following topics!

SQL Functions: In this section of the quiz, you'll practice using SQL functions.

Click here to test

Note: The above tests are paid tests and premium VIP is free of charge