简体   繁体   中英

How to use not greater than operator in mysql

Does mysql support !<= or !>= operator!!! I am trying to fetch the data from the Person table where the age of a person is not greater than 30 (the age field may have null value).

You may phrase not greater than 30 as being aged 30 or younger:

SELECT *
FROM Person
WHERE age <= 30;

By default, those records with a null age would not be included in the above inequality.

If you really wanted to use NOT , then we could try:

SELECT *
FROM Person
WHERE NOT age > 30;

But typically you will just see the appropriate inequality being used, without an explicit NOT .

Not greater than can be written as <=

!<= is not an operator

Why not doing something like this :

SELECT * FROM table WHERE id <= 100

That mean the query will selecting the ID which not GREATER THAN 100. Or if you want to search something with specific value, you can try this :

SELECT * FROM table WHERE id >= 50 AND id <= 100

That mean the query will search data from table which ID is MORE THAN 50 AND NOT GREATER THAN 100 .

Hope this will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM