- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to delete fields with values more than a particular value in MySQL?
Let us first create a table −
mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, PlayerName varchar(100), PlayerScore int ); Query OK, 0 rows affected (0.97 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(PlayerName,PlayerScore) values('Chris',780); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable(PlayerName,PlayerScore) values('Sam',1100); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable(PlayerName,PlayerScore) values('Mike',900); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(PlayerName,PlayerScore) values('Bob',890); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(PlayerName,PlayerScore) values('Carol',1000); 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 −
+----+------------+-------------+ | Id | PlayerName | PlayerScore | +----+------------+-------------+ | 1 | Chris | 780 | | 2 | Sam | 1100 | | 3 | Mike | 900 | | 4 | Bob | 890 | | 5 | Carol | 1000 | +----+------------+-------------+ 5 rows in set (0.00 sec)
Following is the query to delete fields with values more than a particular value in MySQL −
mysql> delete from DemoTable where PlayerScore > 900; Query OK, 2 rows affected (0.18 sec)
Let us check the table records once again.
mysql> select *from DemoTable;
This will produce the following output −
+----+------------+-------------+ | Id | PlayerName | PlayerScore | +----+------------+-------------+ | 1 | Chris | 780 | | 3 | Mike | 900 | | 4 | Bob | 890 | +----+------------+-------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to get a value more than a particular value from varchar column in MySQL?
- How to concatenate more than 2 fields with SQL?
- How to find the minimum values of two or more fields in MySQL?
- Biggest value from two or more fields in MySQL?
- Delete more than one rows from a table using id in MySQL?
- How can we add FOREIGN KEY constraints to more than one fields of a MySQL table?
- MySQL query to find a value appearing more than once?
- Delete a record with tablename.columnname= value in MySQL
- How to fetch fields with multiple values set using MySQL LIKE?
- MySQL Select where value exists more than once
- How to delete a single value from a MySQL table with duplicate records?
- In MySQL how to replace all NULL values in a particular field of a particular table?
- How to update a field with a particular value if it is null in MySQL?
- How to select particular range of values in a MySQL table?
- How to delete rows older than 14 days in MySQL?

Advertisements