w3resource logo


MySQL greater than or equal operator

MySQL greater than or equal operator

rating Average rating 9 out of 10. Total 9 users rated.

<<PreviousNext>>

Description

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

Syntax

>=

MySQL Version : 5.6

Example : MySQL greater than or equal operator

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

SELECT pub_name,country,pub_city,no_of_branch       
FROM publisher           
WHERE no_of_branch>=10;

Sample table : publisher

Output

MySQL GREATER THAN OR EQUAL OPERATOR

PHP script

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>example-greater-than-or-equal-operator- php mysql examples | w3resource</title>
</head>
<body>
<?php
echo "<h2>A list of the publishers whose Number of branches are ten or more. List also includes their date of country,city, number of branches : </h2>";
echo "<table border='1' style='border-collapse: collapse;border-color: silver;'>";
echo "<tr style='font-weight: bold;'>";
echo "<td width='250' align='center'>Publishers</td><td width='200' align='center'>Country</td>
<td width='200' align='center'>City</td><td width='200' align='center'>Number of branches</td>";
echo "</tr>";
include("../dbopen.php");
$result = mysql_query("SELECT pub_name,country,pub_city,no_of_branch
FROM publisher
WHERE no_of_branch>=10");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td align='center' width='200'>" . $row['pub_name'] . "</td>";
echo "<td align='center' width='200'>" . $row['country'] . "</td>";
echo "<td align='center' width='200'>" . $row['pub_city'] . "</td>";
echo "<td align='center' width='200'>" . $row['no_of_branch'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>

View the example in browser

Slideshow of MySQL Comparison Function and Operators

MySQL Comparison Function and Operators, slide presentation



We have compiled a number of MySQL Questions and Answers. Check and assess you MySQL skill by visiting those questions and answers.

<<PreviousNext>>