X

SQL Where Clause – Short note

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’;

Jamaley Hussain: Hello, I am Jamaley. I graduated from Staffordshire University and have always been passionate about Computers, Technology, and Generative AI. Currently, I work as a Senior Data Scientist (AI/ML) and I’m also the founder of TechJunkGigs, a platform dedicated to helping programming students with tutorials on Machine Learning, Data Science, Python, LLM, RAG, Generative AI, and NLP. What started as a blog has now evolved into a valuable resource for students, and I'm committed to sharing knowledge to help them stay updated with industry trends
Related Post