Learn SQL SELECT and WHERE clauses with simple filtering examples using equals, greater than, AND, OR and NOT.
SELECT chooses columns. WHERE chooses rows. Start with a small result set, then add conditions one at a time so you can see which rule changes the output.
Example
SELECT department, COUNT(*) AS student_count FROM students WHERE active = 1 GROUP BY department ORDER BY student_count DESC;Try it yourself
- Create a five-row table.
- Change one clause.
- Explain the result.
No comments:
Post a Comment
Please do not enter any spam link in the comment box.