
- 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
How to select record except the lower value record against a specific value in MySQL?
For this, you need to use the WHERE clause. Following is the syntax −
select *from yourTableName where yourColumnName > yourValue;
Let us create a table −
mysql> create table demo27 −> ( −> id int not null auto_increment primary key, −> value int −> ); Query OK, 0 rows affected (3.14 sec)
Insert some records into the table with the help of insert command −
mysql> insert into demo27(value) values(50); Query OK, 1 row affected (0.12 sec) mysql> insert into demo27(value) values(500); Query OK, 1 row affected (0.20 sec) mysql> insert into demo27(value) values(100); Query OK, 1 row affected (0.17 sec) mysql> insert into demo27(value) values(400); Query OK, 1 row affected (0.14 sec) mysql> insert into demo27(value) values(100); Query OK, 1 row affected (0.11 sec) mysql> insert into demo27(value) values(800); Query OK, 1 row affected (0.10 sec) mysql> insert into demo27(value) values(600); Query OK, 1 row affected (0.15 sec)
Display records from the table using select statement −
mysql> select *from demo27;
This will produce the following output −
+----+-------+ | id | value | +----+-------+ | 1 | 50 | | 2 | 500 | | 3 | 100 | | 4 | 400 | | 5 | 100 | | 6 | 800 | | 7 | 600 | +----+-------+ 7 rows in set (0.00 sec)
Following is the query to select record except the lower value record against a value in MySQL −
mysql> select *from demo27 where value > 500;
This will produce the following output −
+----+-------+ | id | value | +----+-------+ | 6 | 800 | | 7 | 600 | +----+-------+ 2 rows in set (0.00 sec)
- Related Articles
- MySQL CONCAT a specific column value with the corresponding record
- MySQL query to decrease the value of a specific record to zero?
- Replace a specific duplicate record with a new value in MySQL
- How to get a specific column record from SELECT query in MySQL?
- Search record with a specific value in MySQL using LIKE or REGEXP?
- Delete a record with tablename.columnname= value in MySQL
- How to select a specific record from MySQL if date is in VARCHAR format?
- How to remove Duplicate Records except a single record in MySQL?
- Insert record using MySQL SELECT?
- How do I exclude a specific record in MySQL?
- How to select a random record from a MySQL database?
- Display only a specific duplicate record in MySQL
- Implement specific record ordering with MySQL
- MySQL query to place a specific record on the top
- Index minimum value Record in Python

Advertisements