{"id":3908,"date":"2025-06-06T20:05:49","date_gmt":"2025-06-06T20:05:49","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=3908"},"modified":"2025-06-07T09:55:27","modified_gmt":"2025-06-07T09:55:27","slug":"sql-where","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/sql\/sql-where\/","title":{"rendered":"SQL WHERE"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>WHERE<\/code> clause lets you <strong>filter rows<\/strong> based on conditions, so you get only the data you want.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Basic Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT * FROM employees WHERE salary &gt; 50000;<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This returns employees with salary greater than 50,000.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Common Operators in WHERE<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>-- Comparison\n=, &lt;&gt;, &gt;, &lt;, &gt;=, &lt;=\n\n-- Logical\nAND, OR, NOT\n\n-- Between two values\nsalary BETWEEN 40000 AND 60000\n\n-- Match a list of values\ndepartment IN ('HR', 'Sales', 'IT')\n\n-- Pattern matching (see next topic for LIKE)\nname LIKE 'J%'\n\n-- Check for NULL\nmanager_id IS NULL<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Multiple Conditions<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT * FROM employees \nWHERE department = 'IT' AND salary &gt; 60000;<\/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><code>WHERE<\/code> filters rows based on condition(s)<\/li>\n\n\n\n<li>Use comparison and logical operators<\/li>\n\n\n\n<li>Supports <code>IN<\/code>, <code>BETWEEN<\/code>, <code>LIKE<\/code>, <code>IS NULL<\/code> for powerful filtering<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Master <code>WHERE<\/code> to get exactly the data you want!<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The WHERE clause lets you filter rows based on conditions, so you get only the data you want. \ud83d\udd39 Basic Syntax This returns employees with salary greater than 50,000. \ud83d\udd39 Common Operators in WHERE \ud83d\udd39 Multiple Conditions \ud83e\udde0 Quick Recap \u2705 Master WHERE to get exactly the data you want!<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[952,979],"class_list":["post-3908","cposts","type-cposts","status-publish","hentry","category-notes","category-sql"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/3908","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=3908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=3908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}