
- 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
MySQL query to display only 15 words from the left?
For this, use LEFT in MySQL. Let us first create a table −
mysql> create table DemoTable -> ( -> Title text -> ); Query OK, 0 rows affected (0.59 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('Java database connectivity to MySQL database'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Python with django framework'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('C with data structure and algorithm'); Query OK, 1 row affected (0.33 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----------------------------------------------+ | Title | +----------------------------------------------+ | Java database connectivity to MySQL database | | Python with django framework | | C with data structure and algorithm | +----------------------------------------------+ 3 rows in set (0.00 sec)
Following is the query to display only 15 words from the left in MySQL −
mysql> select left(Title,15) as Title from DemoTable;
This will produce the following output:
+-----------------+ | Title | +-----------------+ | Java database c | | Python with dja | | C with data str | +-----------------+ 3 rows in set (0.00 sec)
- Related Articles
- MySQL query to display records from a table filtered using LIKE with multiple words?
- MySQL query to display only the records that contains single word?
- MySQL query to display only the empty and NULL values together?
- Fetch some words from the left in MySQL
- MySQL query to compare and display only the rows with NULL values
- MySQL query to get only the minutes from datetime?
- MySQL query to check if a certain row has only two words?
- MySQL query to display only the column values with corresponding column having whitespace
- MySQL query to replace only the backslashes from folder path?
- MySQL query to replace only the NULL values from the table?
- MySQL query to delete last two words from every column value
- MongoDB query select and display only a specific field from the document?
- Display only date from timestamp value in MySQL
- MySQL query to get substrings (only the last three characters) from strings?
- A single MySQL query to search multiple words from different column values

Advertisements