
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to select all the characters after the first 20 characters from a column in MySQL?
Let us first create a table −
mysql> create table DemoTable ( Title text ); Query OK, 0 rows affected (0.86 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('C is a good programming language to start'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Java is good with data structure and algorithm'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('Coding is very important'); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------------------------------------------------+ | Title | +------------------------------------------------+ | C is a good programming language to start | | Java is good with data structure and algorithm | | Coding is very important | +------------------------------------------------+ 3 rows in set (0.00 sec)
Following is the query to select all the characters after the first 20 characters −
mysql> select substring(Title from 20) from DemoTable;
This will produce the following output −
+-----------------------------+ | substring(Title from 20) | +-----------------------------+ | ming language to start | | ata structure and algorithm | | rtant | +-----------------------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to get first N characters from a MySQL column?
- MySQL query to split a column after specific characters?
- Return only the first 15 characters from a column with string values in MySQL
- MySQL query to keep only first 2 characters in column value and delete rest of the characters?
- Remove first two characters of all fields in MySQL?
- MySQL Query to remove all characters after last comma in string?
- How to remove all non-alphanumeric characters from a string in MySQL?
- MySQL select statement to fetch 5 characters from the left of the string
- MySQL query to remove special characters from column values?
- MySQL query to replace special characters from column value
- Remove all characters of first string from second JavaScript
- How to extract the first n characters from a string using Java?
- How to remove unconvertable characters to ASCII with SELECT in MySQL?
- How to extract first two characters from a string in R?
- How to count all characters in all rows of a field in MySQL?

Advertisements