w3resource

MySQL greater than or equal operator

greater than or equal operator

MySQL greater than or equal operator checks whether one expression is either greater than or equal to another expression.

Syntax:

>=

MySQL Version: 8.0

Example: MySQL greater than or equal operator

The following MySQL statement will fetch those publishers from the publisher table who have more than or equal to 10 branch offices.

Sample table: publisher


Code:


-- This query selects specific columns from the 'publisher' table where the number of branches is 10 or more.
SELECT pub_name, country, pub_city, no_of_branch
-- This statement specifies the columns to be retrieved: 'pub_name', 'country', 'pub_city', and 'no_of_branch'.
FROM publisher
-- This part of the query specifies the table from which data is being retrieved, which is 'publisher'.
WHERE no_of_branch >= 10;
-- This clause filters the rows to include only those where the 'no_of_branch' column is greater than or equal to 10.

Explanation:

  • The purpose of this SQL query is to retrieve information about publishers that have 10 or more branches.

  • SELECT pub_name, country, pub_city, no_of_branch: This part of the query specifies the columns to be selected from the 'publisher' table. It includes the publisher's name (pub_name), country (country), city (pub_city), and the number of branches (no_of_branch).

  • FROM publisher: This part specifies the table from which the data is being selected, which is the 'publisher' table.

  • WHERE no_of_branch >= 10: This clause filters the results to include only those rows where the no_of_branch column is greater than or equal to 10. This ensures that only publishers with a significant number of branches are included in the results.

Output:

mysql> SELECT pub_name,country,pub_city,no_of_branch       
    -> FROM publisher           
    -> WHERE no_of_branch>=10;
+--------------------------+---------+-----------+--------------+
| pub_name                 | country | pub_city  | no_of_branch |
+--------------------------+---------+-----------+--------------+
| Jex Max Publication      | USA     | New York  |           15 | 
| BPP Publication          | India   | Mumbai    |           10 | 
| Mountain Publication     | USA     | Houstan   |           25 | 
| Summer Night Publication | USA     | New York  |           10 | 
| Novel Publisher Ltd.     | India   | New Delhi |           10 | 
+--------------------------+---------+-----------+--------------+
5 rows in set (0.00 sec)

Relational Algebra Expression:

Relational Algebra Expression: MySQL greater than or equal operator.

Relational Algebra Tree:

Relational Algebra Tree: MySQL greater than or equal operator.

Slideshow of MySQL Comparison Function and Operators

Previous: Equal operator(=)
Next: Greater than operator(>)



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/mysql/comparision-functions-and-operators/greater-than-or-equal-operator.php