{"id":3913,"date":"2025-06-06T20:10:13","date_gmt":"2025-06-06T20:10:13","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=3913"},"modified":"2025-06-07T09:55:51","modified_gmt":"2025-06-07T09:55:51","slug":"sql-comparison-operators","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/sql\/sql-comparison-operators\/","title":{"rendered":"SQL Comparison Operators"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Comparison operators help you <strong>compare values<\/strong> in the <code>WHERE<\/code> clause to filter data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Common Comparison Operators<\/h2>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Operator<\/th><th>Meaning<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td><code>=<\/code><\/td><td>Equal to<\/td><td><code>WHERE salary = 50000<\/code><\/td><\/tr><tr><td><code>&lt;&gt;<\/code> or <code>!=<\/code><\/td><td>Not equal to<\/td><td><code>WHERE department &lt;&gt; 'HR'<\/code><\/td><\/tr><tr><td><code>&gt;<\/code><\/td><td>Greater than<\/td><td><code>WHERE salary &gt; 60000<\/code><\/td><\/tr><tr><td><code>&lt;<\/code><\/td><td>Less than<\/td><td><code>WHERE age &lt; 30<\/code><\/td><\/tr><tr><td><code>&gt;=<\/code><\/td><td>Greater than or equal to<\/td><td><code>WHERE experience &gt;= 5<\/code><\/td><\/tr><tr><td><code>&lt;=<\/code><\/td><td>Less than or equal to<\/td><td><code>WHERE age &lt;= 40<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Usage Example<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT * FROM employees WHERE salary &gt;= 50000 AND department &lt;&gt; 'Sales';<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udde0 Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <code>=<\/code> and <code>&lt;&gt;<\/code> (or <code>!=<\/code>) for equality and inequality<\/li>\n\n\n\n<li>Use <code>&lt;<\/code>, <code>&gt;<\/code>, <code>&lt;=<\/code>, <code>&gt;=<\/code> for range checks<\/li>\n\n\n\n<li>Essential for filtering rows in your queries<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Master these to control exactly which rows you get!<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Comparison operators help you compare values in the WHERE clause to filter data. \ud83d\udd39 Common Comparison Operators Operator Meaning Example = Equal to WHERE salary = 50000 &lt;&gt; or != Not equal to WHERE department &lt;&gt; &#8216;HR&#8217; &gt; Greater than WHERE salary &gt; 60000 &lt; Less than WHERE age &lt; 30 &gt;= Greater than or [&hellip;]<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[952,979],"class_list":["post-3913","cposts","type-cposts","status-publish","hentry","category-notes","category-sql"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/3913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/cposts"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=3913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=3913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}