SELECT all rows with sequential id after a specific id Is it possible to query all rows that their ids are sequential after a specific id? (id is an AUTO_INCREMENT column.)
For example, suppose my specific id is 5. Then I want all rows with these ids:
6, 7, 8, 9, ... until this sequence exists. E.g. if there is no row with id=12 then the sequence must be stopped at 11. So desired result would be rows with these ids:
6, 7, 8, 9, 10, 11.
I use MySQL.

EDIT:
An example:
This is my table:
mysql&gt; SELECT * FROM Inheritance ORDER BY id ASC;                     
+-------------+-------------------+------------+-------------+-------+
| classNS     | class             | super      | superNS     | id    |
+-------------+-------------------+------------+-------------+-------+
|             | Data              | Object     |             | 00002 |
|             | Thing             | Object     |             | 00003 |
| BUILD       | DATA              | Data       |             | 00004 |
|             | Dialable          | Data       |             | 00005 |
|             | Phone             | Data       |             | 00006 |
|             | Email             | Data       |             | 00007 |
|             | Place             | Data       |             | 00008 |
|             | Website           | Data       |             | 00009 |
|             | SocialNetworkLink | Data       |             | 00011 |
|             | Password          | Data       |             | 00012 |
|             | User              | Thing      |             | 00013 |
|             | Asset             | Thing      |             | 00014 |
|             | Collection        | Asset      |             | 00015 |
|             | Product           | Asset      |             | 00016 |
| collections | School            | Collection |             | 00017 |
| collections | LangSchool        | Collection |             | 00018 |
| BUILD       | OWNER             | DATA       | BUILD       | 00022 |
| BUILD       | OWNER_OF_PRODUCT  | DATA       | BUILD       | 00023 |
| BUILD       | OWNER_OF_EMAIL    | DATA       | BUILD       | 00024 |
| BUILD       | COUNTRY           | DATA       | BUILD       | 00025 |
| BUILD       | SOCIAL_NETWORK    | DATA       | BUILD       | 00026 |
| BUILD       | PROVINCE_IR       | DATA       | BUILD       | 00027 |
| collections | SchoolPlus        | School     | collections | 00028 |
+-------------+-------------------+------------+-------------+-------+
23 rows in set (0.00 sec) 

Then I want this result (when my specific id is 5):
+---------+----------+-------+---------+-------+
| classNS | class    | super | superNS | id    |
+---------+----------+-------+---------+-------+
|         | Phone    | Data  |         | 00006 |
|         | Email    | Data  |         | 00007 |
|         | Place    | Data  |         | 00008 |
|         | Website  | Data  |         | 00009 |
+---------+----------+-------+---------+-------+
                                        

Notice that the row with id=10 is absent in the source table.
A query that doesn't use recursive CTEs or window functions or variables:

SELECT i.* 
FROM Inheritance AS i
    JOIN
    ( SELECT ui.id 
      FROM Inheritance AS ui
      WHERE ui.id &gt; 5
        AND NOT EXISTS
            ( SELECT 1
              FROM Inheritance AS pi
              WHERE pi.id = ui.id - 1
            ) 
      ORDER BY ui.id
      LIMIT 1
    ) AS up
    ON  i.id &lt; up.id
WHERE i.id &gt; 5 ;