sql first and last record code example
Example: select first and last row sql
select
(select <some_column> from <some_table>
order by <some_field> limit 1) as oldest,
(select <some_column> from <some_table>
order by <some_field> desc limit 1) as newest
;