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

Mid

Example

Retrieve characters from a string, starting at the third position.

SELECT Mid(“SQL Tutorial”3AS ExtractString;

Definition and Usage

The Mid() function retrieves a specified number of characters from a string, starting from any position within the string.

Syntax

Mid(stringstartlength)

Parameter Values

Parameter

Description

string

Required. Specifies the string from which characters will be extracted.

start

Required. Specifies the starting position from which to begin extracting characters from the string.

length

Optional. Specifies the number of characters to extract from the string. If omitted, the function returns all characters from the start position to the end of the string.

Technical Details

Works in:

 From Access 2000

More Examples

Example

Extract characters from the text in a column, starting at the fourth position and extracting a total of six characters.

SELECT Mid(CustomerName, 46AS ExtractString
FROM Customers;