Home arrow BrainDump arrow Page 4 - All About SQL Functions

Scalar Functions - BrainDump

In the last tutorial we left off with the SUM(column) function. In this article we will cover the remaining Aggregate Functions and the Scalar Functions. We might even make some fat jokes, some mama jokes, and as always, some nerd jokes.

TABLE OF CONTENTS:
  1. All About SQL Functions
  2. More Aggregate Functions
  3. STDEV
  4. Scalar Functions
  5. Mid(c,start[,end]
  6. Round(c,decimals)
By: James Payne
Rating: starstarstarstarstar / 8
December 17, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Scalar functions work against one value and return one value based on the input. Aggregate functions work on a bunch of data and return one result. I understand if you fell asleep during that; I did just writing it.

Here is a table of scalar functions.

 

Function Name

What it does

UCASE(c)

Changes a field to Uppercase

LCASE(c)

Changes a field to lowercase

MID(c,start[,end])

Extracts characters from a text field

LEN(c)

Returns the length of a text field

INSTR(c,char)

Returns the position of a character in a field

LEFT(c,number_of_char)

Returns the left part of text

RIGHT(c,number_of_char)

Returns the right part of text

ROUND(c,decimals)

Rounds a numeric field to a number of decimals

MOD(x,y)

Gives the remainder in division

NOW()

Returns the present system date

FORMAT(c,format)

Formats a field

DATEDIFF(d,date1,date2)

For date calculation

UCASE(c)

If you want make all the characters of a selected item uppercase, you can use the UCASE function, like so:


Select UCASE('darth ladel') from Employees;

This will return the following: DARTH LADEL

LCASE(c)

Likewise, you may also wish to force all of the characters to be lowercase.


Select LCASE('Darth Brooks') from Employees;



 
 
>>> More BrainDump Articles          >>> More By James Payne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

BRAINDUMP ARTICLES

- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: