SQL Functions

By   Tewodros   Date Posted: Sep. 21, 2021  Hits: 741   Category:  Database   Total Comment: 0             A+ A-


side

 

These are libraries that we can use to do some calculations.

example: sum, avg, min, max

Example:

Select the total deposits 

select sum(depositAmount) as TotalDeposit

from Account

Select the minimum deposit

select min(depositAmount) as MinDeposit

from Account

select maximum deposit

select max(depositAmount) as MaxDeposit

from Account

 

select average deposit

select avg(depositAmount) as AverageDeposit

from Account

 

There are also other functions that are used to transform a single data item like making it upppercase

 

  1. UCASE() 
  2. LCASE() 
  3. MID() 
  4. LEN() – to count number of characters of a string

example:

select upppercase(firstname)

from Employee


Tags



Back to Top



Related Blogs






Please fill all fields that are required and click Add Comment button.

Name:*
Email:*
Comment:*
(Only 2000 char allowed)


Security Code:* mrzqpi

Back to Top