SQLite
SQLite Data Types with Example
Data types in SQLite are different compared to other database management system. In SQLite, you...
Substring() is a function in SQL which allows the user to derive substring from any given string set as per user need. Substring() extracts a string with a specified length, starting from a given location in an input string. The purpose of Substring() in SQL is to return a specific portion of the string.
SUBSTRING(Expression, Starting Position, Total Length)
Here,
Below Diagram illustrate the use of SUBSTRING() function in SQL server.
Assumption: Assume that we have the table as 'gtupapers' with two columns and four rows as displayed below:
We will use 'gtupapers' table in further examples
Query 1: SUBSTRING() in SQL with length less than Total Maximum length of expression
SELECT Tutorial_name, SUBSTRING(Tutorial_name,1,2) As SUB from gtupapers;
Result: Below diagram display substring of 'Tutorial_name' column as 'SUB' column
Query 2: SUBSTRING() in SQL server with the length greater than Total Maximum length of expression.
SELECT Tutorial_name, SUBSTRING(Tutorial_name,2,8) As SUB from gtupapers;
Result: Below diagram display substring of 'Tutorial_name' column as 'SUB' column. Here in spite of
Substring length is greater than Total Maximum length of expression, and no error and query return full string returned.
Data types in SQLite are different compared to other database management system. In SQLite, you...
What are Decision-Making Statements? Decision making statements are those who will decide the...
What is Object Type in PL/SQL? Object-Oriented Programming is especially suited for building...
What is SQLite? SQLite is an open-source, embedded, relational database management system,...
What is MySQL 5.6 Certification? The new release of MySQL 5.6 is designed for professionals...
What is Record Type? A Record type is a complex data type which allows the programmer to create a...