SQL Tutorial SQL Advanced SQL Database SQL Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

SQL AND Keyword



The SQL AND keyword is used to combine multiple conditions in a SQL WHERE clause and displays a record if all the conditions separated by AND keyword are true.

Syntax

The syntax for using AND keyword is given below:

SELECT column1, column2, column3, ...
FROM table_name
WHERE condition1 AND condition2 AND condtion3 ....;

Example:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeSalary
1JohnLondon253000
2MarryNew York242750
3JoParis272800
4KimAmsterdam303100
5RameshNew Delhi283000
6HuangBeijing282800

  • To select all records of the Employee table where Salary is greater than 2800 and Age is less than 30, the SQL code is mentioned below.

    SELECT * FROM Employee
    WHERE Salary > 2800 AND Age < 30;
    

    This result of the following code will be:

    EmpIDNameCityAgeSalary
    1JohnLondon253000
    5RameshNew Delhi283000

❮ SQL Keywords

5