The Greater Than Operator
The > operator finds values larger than a specified number.
Syntax
sql
1SELECT * FROM table_name
2WHERE column > value;Example: High Achievers
Find students with marks above 80:
sql
1SELECT * FROM students
2WHERE marks > 80;Result
| id | name | marks | grade |
|---|---|---|---|
| 1 | Alice | 85 | A |
| 3 | Carol | 92 | A |
| 5 | Eve | 88 | A |
More Examples
sql
1-- Students older than 13
2SELECT * FROM students WHERE age > 13;
3
4-- Marks above 90
5SELECT name, marks FROM students WHERE marks > 90;
6
7-- Age above 14
8SELECT * FROM students WHERE age > 14;Combining Concepts
sql
1-- High achievers in specific columns
2SELECT name, course, marks
3FROM students
4WHERE marks > 85;Greater Than with Strings
Works alphabetically:
sql
1-- Names after 'M' alphabetically
2SELECT * FROM students WHERE name > 'M';Returns names starting with N, O, P, etc.
Key Points
>excludes the boundary value> 80does NOT include 80- Works with numbers, dates, strings
