I have a table with 2 columns:
- id INT PRIMARY_KEY
- y FLOAT
The value in column "y" is guaranteed to be in 2 ranges:
- small values: [0.18 - 0.20]
- big values: [2.3 - 2.4]
It is known what "y" column in table has the following pattern: several records with small values then several records with big values then again several small and several big and so on. The number of consecutive records with the same range is not known and it is not fixed (vary). I need to find the id's (PK column) for beginning and ends of all intervals. Is it possible to do it in SQL?
(1; 0.19) (2; 0.18) (3; 0.19) (4; 2.3) (5; 2.4) (6; 2.3) (7;0.19)
Expect output: (1, 'start of small'), (3, 'end of of small'), (4, 'start of big'), (6, 'end of big'), (7, 'start of small')