
- 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 do I write not greater than in a MySQL query?
The not greater than in a query can be written simply like less than or equal to ( <=). The syntax is as follows −
select * from yourTableName where yourColumnName<=yourColumnName;
Let us first create a table −
mysql> create table DemoTable1480 -> ( -> StudentName varchar(40), -> StudentMarks int -> ); Query OK, 0 rows affected (0.50 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1480 values('Chris',78); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1480 values('Bob',45); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1480 values('John',67); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1480 values('Adam',56); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1480;
This will produce the following output −
+-------------+--------------+ | StudentName | StudentMarks | +-------------+--------------+ | Chris | 78 | | Bob | 45 | | John | 67 | | Adam | 56 | +-------------+--------------+ 4 rows in set (0.00 sec)
Following is the query to write not greater than in a MySQL query −
mysql> select * from DemoTable1480 where StudentMarks <=65;
This will produce the following output −
+-------------+--------------+ | StudentName | StudentMarks | +-------------+--------------+ | Bob | 45 | | Adam | 56 | +-------------+--------------+ 2 rows in set (0.00 sec)
- Related Articles
- How do I split a numerical query result in MySQL?
- MySQL query to order rows with value greater than zero?
- How do I get a value array (instead a json array) greater than 50 in MongoDB?
- How do I insert multiple values in a column with a single MySQL query?
- How do I query a MongoDB collection?
- (a) Write four negative integers greater than \( -20 \).(b) Write four integers less than $– 10$.
- Write five rational numbers greater than $-2$.
- Write a MySQL query where length of the records is longer than 1?
- How do I select data that does not have a null record in MySQL?
- Queries for greater than and not less than using C++
- How can I find all columns where the column name length is greater than 5 in MySQL?
- How do I detect if the ON UPDATE event fired with query in MySQL?
- How do I write JSON in Python?
- How can I stop a running MySQL query?
- How can I stop running a MySQL query?

Advertisements