And Operator in SQL

AND is an SQL operator. It serves a logical function in that it requires two or more conditions to be true in order for an operation to take place. It is often found in the WHERE clause and is closely associated with the OR operator which performs a similar function. "And" is an

AND is an SQL operator. It serves a logical function in that it requires two or more conditions to be true in order for an operation to take place. It is often found in the WHERE clause and is closely associated with the OR operator which performs a similar function. "And" is an operator that is familiar in all types of boolean logic. It is a simple construct based on the English language.

Syntax in a common statement:

SELECT * FROM table WHERE column2='datum' AND column3='another_datum';

Given the fict_char table, we want to find any rows where the author is Burroughs and the name is Jane Porter.

idnamedescbookauthor
1Jane Porter5 ft 4 in, blue eyesTarzanBurroughs
2Scarlet O'Hara5 ft 2 in, green eyesGone with the WindMitchell
3Hermione Granger5 ft 6 in, brown eyesHarry Potter SeriesRowling
SELECT * FROM fict_char WHERE name='Jane Porter' AND author = 'Burroughs';

The result in this case would be a single row:

idnamedescbookauthor
1Jane Porter5 ft 4 in, blue eyesTarzanBurroughs

< SQL Alter Table Statement | AUTO INCREMENT SQL >


Send notes in disappearing ink!

Interesting Pages