SQL AND OR in WHERE query Commands and statementsSQL AND OR statement can be used with WHERE clause to list a set of records with matching combination of a table. We can use these logical operators in query with NOT combination also to filter out some records.
This is our table
We will apply AND command to display records of class Four with more than 70 mark.
SELECT * FROM student WHERE class='Four' AND mark >70
WE can see the record returned is class= Four and mark is more than 70. Here both the conditions are satisfied.
SELECT * FROM student WHERE class='Four' OR mark >70
Here the records returned are either belongs to class Four OR having mark more than 70. Any one of the two condition is to be satisfied.
Be the first to post comment on this article :