WHERE Clause का उपयोग
WHERE सिर्फ वे rows रखता है जो एक condition satisfy करती हैं।
In this page:
Syntax
SELECT columns
FROM table_name
WHERE condition;
WHERE Clause
Conditions columns को values से compare करती हैं और true, false, या NULL evaluate होती हैं, और सिर्फ true rows return होती हैं। Text values single quotes इस्तेमाल करती हैं। WHERE grouping से पहले और column aliases available होने से पहले चलता है। AND, OR, और NOT से conditions combine करें।
Note:
Strings के लिए single quotes और सिर्फ identifiers के लिए double quotes इस्तेमाल करें।
उदाहरण: WHERE clause
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, city TEXT, age INTEGER);
INSERT INTO users VALUES (1, 'Ada', 'London', 36), (2, 'Bob', 'Oslo', 25), (3, 'Cy', 'Oslo', 41), (4, 'Di', 'Rome', 30);
SELECT * FROM users WHERE city = 'Oslo';
SELECT name FROM users WHERE age > 30;
-- Output:
-- id | name | city | age
-- 2 | Bob | Oslo | 25
-- 3 | Cy | Oslo | 41
-- name
-- Ada
-- Cy
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- string values के लिए double quotes इस्तेमाल करना
- = से NULL compare करना
- WHERE में aliases इस्तेमाल करना
चैप्टर सारांश
- WHERE rows filter करता है
- Text को single quotes चाहिए
- NULL comparisons को IS NULL चाहिए
- सिर्फ true rows return होती हैं
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: