SQL - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL Substring

SQL Substring

shape Description

SQL is a Structured Query Language and is utilized for dealing with the database. It is a non-procedural dialect. Client can compose SQL script to execute and SQL compiler consequently produces a method to get to database and convey the fancied output. SQL is a database coding, planned for the recuperation and organisation of data in social database. And SQL Substring function allow us to extract a character or set of characters  from a string. A SQL Substring is a query inside another SQL query and embedded inside the WHERE clause. A subquery is utilized to return information that will be utilized as a part of the primary query as a condition to assist limit the information to be recovered.

shape Conceptual figure

shape Syntax

The syntax for SQL Substring is as follows:
SUBSTRING(string, starting_position, length) string => String from where the character set has to be extracted. starting_position => The position to start extraction from. The first position in the string is always 1. length => Number of characters want to extract from the starting position.

shape Examples

The below example describes the Substring process: [c] sql>SELECT SUBSTRING('SPLessons.com', 1 , 5); Output of the above query SPLes [/c] [c] sql>SELECT SUBSTRING('SPLessons.com', 5 , 5); Output of the above query sons [/c]

Summary

shape Key Points

  • SQL Substring - Allows to extract a character or set of characters from a string.