I have a task to create a table with the one new column with the difference between ages in current and next row. The ages should be in descending order. Is it possible to do with SQL? I don't know exactly what sql I should use and that wasn't specified in task.
I understand that there should be something in brackets
SELECT name, age, (...) AS difference
FROM Animals
ORDER BY age DESC;
The table "Animals" I have
id | name | age 1 | Molly | 4 2 | Jackson| 8 3 | Wonka | 38 4 | Polly | 7
The result table should look like this:
name | age | difference Wonka | 38 | 30 Jackson| 8 | 1 Polly | 7 | 3 Molly | 4 |