Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

Right

Example

Extract the last 4 characters from a string.

SELECT Right(“SQL Tutorial is cool”4AS ExtractString;

Definition and Usage

The Right() function extracts a specified number of characters from the end of a string.

Note: See also the Left() function.

Syntax

Right(stringnumber_of_chars)

Parameter Values

Parameter

Description

string

Required. The string to extract characters from.

Number_of_char

Required. Specifies the number of characters to extract. If this number exceeds the length of the string, the function will return the entire string.

Technical Details

Works in:

 From Access 2000

More Examples

Example

Extract the last 5 characters from the text in the “CustomerName” column.

SELECT Right(CustomerName, 5AS ExtractString
FROM Customers;