You can use LEFT() from MySQL to display some character from the entire value in MySQL. Following is the syntax:
select left(yourColumnName ,200 ) AS anyAliasName from yourTableName;
Let us first create a table:
mysql> create table DemoTable (Paragraph longtext); Query OK, 0 rows affected (0.71 sec)
Following is the query to insert records in the table using insert command:
mysql> insert into DemoTable values('Introduction to Java,Introduction to C,Introduction to C++,Introduction to Spring,Introduction to Hibernate,Introduction to Python,Introduction to MySQL,Introduction to MongoDB,Introduction to SQL Server,Introduction to ASP.net,Introduction to JSF'); Query OK, 1 row affected (0.13 sec)
Following is the query to display records from the table using select command:
mysql> select *from DemoTable;
This will produce the following output:
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Paragraph | +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Introduction to Java,Introduction to C,Introduction to C++,Introduction to Spring,Introduction to Hibernate,Introduction to Python,Introduction to MySQL,Introduction to MongoDB,Introduction to SQL Server,Introduction to ASP.net,Introduction to JSF | +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
Following is the query to display only 200 characters from the total value:
mysql> select left(Paragraph ,200) AS `200Characters` from DemoTable;
This will produce the following output displaying only the first 200 characters:
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 200Characters | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Introduction to Java,Introduction to C,Introduction to C++,Introduction to Spring,Introduction to Hibernate,Introduction to Python,Introduction to MySQL,Introduction to MongoDB,Introduction to SQL Ser | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)