Skip
Arish's avatar

13. Greater Than Operator


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

idnamemarksgrade
1Alice85A
3Carol92A
5Eve88A

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

  1. > excludes the boundary value
  2. > 80 does NOT include 80
  3. Works with numbers, dates, strings