<

Description

The < operator returns true only if the left-hand operand is less than the right-hand operand.

Syntax

  1. > SELECT x < y;

Examples

  1. mysql> SELECT 2 < 2;
  2. +-------+
  3. | 2 < 2 |
  4. +-------+
  5. | false |
  6. +-------+
  7. 1 row in set (0.00 sec)
  1. create table t1 (spID smallint,userID bigint,score int);
  2. insert into t1 values (1,1,1);
  3. insert into t1 values (2,2,2);
  4. insert into t1 values (2,1,4);
  5. insert into t1 values (3,3,3);
  6. insert into t1 values (1,1,5);
  7. insert into t1 values (4,6,10);
  8. insert into t1 values (5,11,99);
  9. mysql> select spID,userID,score from t1 where (userID-1)<spID;
  10. +------+--------+-------+
  11. | spid | userid | score |
  12. +------+--------+-------+
  13. | 1 | 1 | 1 |
  14. | 2 | 2 | 2 |
  15. | 2 | 1 | 4 |
  16. | 3 | 3 | 3 |
  17. | 1 | 1 | 5 |
  18. +------+--------+-------+
  19. 5 rows in set (0.00 sec)
  20. mysql> select spID,userID,score from t1 where spID<(userID-1);
  21. +------+--------+-------+
  22. | spid | userid | score |
  23. +------+--------+-------+
  24. | 4 | 6 | 10 |
  25. | 5 | 11 | 99 |
  26. +------+--------+-------+
  27. 2 rows in set (0.00 sec)