In this short note, Listed some quick relevant WHERE Clause keywords and methods which will use in SQL query.
WHERE clause is used to add condition(s), so it returns data satisfying provided condition.
SELECT lastname, firstname, title FROM employee WHERE lastname = ‘Kumar’;
✅SQL provides various operators such as comparison operators, logical operators, etc., that allow you to construct the condition.
👉SQL WHERE with comparison operators
▪️= equal
▪️> greater than
▪️< less than
▪️>= greater than or equal
▪️<= less than or equal
▪️<> not equal
👉SQL WHERE with logical operators
▪️AND
▪️OR
▪️NOT
❇️ SELECT firstname, title, country, DATE(birthdate) FROM employee
WHERE birthdate > ‘1993-01-01’ AND country = ‘India’
❇️SELECT firstname, lastname, city FROM employee
WHERE NOT (city = ‘Delhi’ OR city = ‘Pune’)
📈 Besides those operators you can also use the BETWEEN, IN, LIKE, EXISTS, and IS operators in the WHERE clause.
Here is the one example of using where clause : –
SELECT * FROM employee WHERE Dept_name = ‘IT’;