Monday, February 8, 2010

SQL SUBSTRING - Introduction and syntax

Explain the SQL SUBSTRING statement. Write SQL syntax for the SQL SUBSTRING statement along with an example.

SQL SUBSTRING: The Substring function in SQL is used to capture a portion of the stored data

Syntax:
SUBSTR(str,pos,len): Starting with the th character in string and select the next characters.

Example:
SELECT SUBSTR(company_name, 3) FROM Company WHERE company_name = ‘tata’;

No comments:

Post a Comment