Summary - Operators
- SQL course
- Beginner
- Lesson 35/115
- 5 min
Combine arithmetic, comparison and logical operators in one query.
Summary - Operators
In this group you learned arithmetic, logical, comparison, NULL and range/list operators. Combine them to write complex conditions.
SELECT name FROM products
WHERE (price > 10 OR category = 'kitap')
AND stock IS NOT NULL;This query products with price over 10 or category book, and stock not null.
name is selected from products. WHERE keeps only the rows where (price > 10 OR category = 'kitap') AND stock IS NOT NULL holds.
Practice Summary - Operators
Select names from products where price > 10 AND stock > 0.
Starter code
-- summary query
SELECT name
FROM products
WHERESample solution
SELECT name
FROM products
WHERE price > 10 AND stock > 0Expected output
name Defter Çanta
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which operator has highest precedence?
- Parentheses Correct answer
- AND
- OR
- NOT
Explanation: parentheses are always evaluated first.
2 Summary - Operators: match the terms
| Term | Meaning |
|---|---|
AND |
combine |
OR |
alternative |
NOT |
negation |
parentheses |
precedence |