Free Newsletters:

SQLCourse
Interactive Online SQL Training

Search Database Journal:

HOME News MS SQL Oracle DB2 Access MySQL PHP SQL Etc Scripts Links Forums DBA Talk
SQL Courses
1
2
3
4
5
6
7
8
9
10
11
12
13
14


Combining Conditions and Boolean Operators Exercise Answers

Exercise #1

SELECT customerid, order_date, item
FROM items_ordered
WHERE (item <> 'Snow shoes') AND (item <> 'Ear muffs');

Note: Yes, that is correct, you do want to use an AND here. If you were to use an OR here, then either side of the OR will be true, and EVERY row will be displayed. For example, when it encounters 'Ear muffs', it will evaluate to True since 'Ear muffs' are not equal to 'Snow shoes'.

Exercise #2

SELECT item, price
FROM items_ordered
WHERE (item LIKE 'S%') OR (item LIKE 'P%') OR (item LIKE 'F%');

 

Go Back to previous Combining Conditions page


SQL Course Curriculum
<<previous 1234567891011121314 next>>