- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to delete the duplicate values stored in reverse order from MySQL table?
To understand this concept, we are using the data from table ‘Details_city’ as follows −
mysql> Select * from details_city; +--------+--------+ | City1 | City2 | +--------+--------+ | Delhi | Nagpur | | Delhi | Mumbai | | Nagpur | Delhi | | Katak | Delhi | | Delhi | Katak | +--------+--------+ 5 rows in set (0.00 sec)
Now, the following query will delete the reverse duplicate values from details_city table −
mysql> Select a.city1,a.city2 from details_city a WHERE a.city1 <= a.city2; +-------+--------+ | city1 | city2 | +-------+--------+ | Delhi | Nagpur | | Delhi | Mumbai | | Delhi | Katak | +-------+--------+ 3 rows in set (0.06 sec)
- How can I create a stored procedure to delete values from a MySQL table?
- How to delete all the duplicate records in a MySQL table?
- How to delete a single value from a MySQL table with duplicate records?
- How to remove duplicate values from a MySQL table using LEFT JOIN?
- How to order return duplicate column values only once in MySQL?
- Selecting the top occurring entries in MySQL from a table with duplicate values?
- How can we delete a MySQL stored function from the database?
- How to repeat the values stored in a data column of MySQL table?
- Delete all the records from a MySQL table?
- How to delete a column from a table in MySQL?
- How do we find the duplicate values available in a MySQL table?
- Fetch specific rows from a MySQL table with duplicate column values (names)?
- How to write a MySQL stored function that updates the values in a table?
- Delete multiple entries from a MySQL table
- How can I create a MySQL stored procedure that returns multiple values from a MySQL table?