SQL Keywords: AND



The AND keyword is used to create a logical conjunction. The formula to follow is:

SELECT WhatColumn(s)
FROM WhatObject
WHERE Condition1 AND Condition2

The WhatColumn(s) is the name of one or more columns.

The WhatObject is the name of a table or query.

Each condition is written as a SQL operation using the formula:

Column operator Value

In this case, the WHERE operator resembles a conditional statement. The Condition1 is the first that would be examined. If the first condition is false, the whole statement is false. If the first condition is true, then the second condition would be examined.


Here is an example:

SELECT Title, Director, CopyrightYear, Rating
FROM Videos
WHERE CopyrightYear = "1994" AND Rating = "PG-13";

To make the statement easy to use and read, you should include each part of the AND operation in its own parentheses. Here are examples:

SELECT Videos.Title, Videos.Director, Videos.CopyrightYear, Videos.Rating
FROM Videos
WHERE (Videos.CopyrightYear)="1994") AND ((Videos.Rating)="PG-13");

Here is an example that uses a BETWEEN operator:

BETWEEN [Enter a starting year] AND [Enter an ending year]



Home Copyright © 2009-2016, FunctionX, Inc.