Well, a possible solution would be to use LIMIT
For example, if you wanted to select the 3rd record only, which now has num=6, you could try:
SELECT * FROM tablename LIMIT 2, 1
This would skip the first 2 rows, then return 1 row, i.e. the 3rd row.
Another way of doing it, if you plan you go through all (or more than 1) row in your DB table would be to extract the rows required, then loop through them, picking out the ID number along with the other data needed.
For example, if you only needed all the id data in a particular table in a mysql db:
$query = mysql_query("SELECT id FROM tablename");
while ($row = mysql_fetch_assoc($query)) {
//access $row['id'];
}