![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 11365 Articles
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
1K+ Views
Let us first create a table −mysql> create table DemoTable(Value int); Query OK, 0 rows affected (1.79 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(50); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(20); Query OK, 1 row affected (0.68 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
162 Views
For this, use the TRIM() function. Let us first create a table −mysql> create table DemoTable826( FirstName varchar(100), Age int ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using the insert command. Here, we have set the FirstName as whitespace for some of ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
748 Views
Use the OPTIMIZE TABLE command to optimize a MySQL table −optimize table yourTableName;Let us first create a table −mysql> create table DemoTable( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(100) ); Query OK, 0 rows affected (1.38 sec)Insert some records in the table using insert command −mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
194 Views
Let us first create a table −mysql> create table DemoTable(Name varchar(100)); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.11 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
105 Views
To update the last entry of a particular ID in MySQL, use ORDER BY DESC LIMIT 1. This would allow you to update the last entry i.e. row records.Let us first create a table −mysql> create table DemoTable824( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(100), ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
3K+ Views
For this, you can use aggregate function MIN() and MAX(). Let us first create a table −mysql> create table DemoTable(AdmissionDate date); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-21'); Query OK, 1 row affected (0.11 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
301 Views
To order by specific field value first in MySQL, use ORDER BY FIELD(). Let us first create a table −mysql> create table DemoTable849(Color varchar(100)); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable849 values('RED'); Query OK, 1 row affected (0.33 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
974 Views
For this, use the RIGHT() method to fetch records with a specific last digit. Let us first create a table −mysql> create table DemoTable823(Value varchar(100)); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable823 values('9847826'); Query OK, 1 row affected ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
316 Views
Let us first create a table −mysql> create table DemoTable848( ProductId int, ProductPrice int ); Query OK, 0 rows affected (1.20 sec)Insert some records in the table using insert command −mysql> insert into DemoTable848 values(100, 30); Query OK, 1 row affected (0.57 sec) mysql> insert into DemoTable848 values(101, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
371 Views
For this, use ORDER BY INSTR(). Let us first create a table −mysql> create table DemoTable822(Word text); Query OK, 0 rows affected (1.11 sec)Insert some records in the table using insert command −mysql> insert into DemoTable822 values('Forever'); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable822 values('ever'); Query ... Read More