another query# Database - 数据库
s*s
1 楼
List the serial number of the car which has the shortest life span.
My code like this:
select serialno, min(lifespan)
from
(select d.serialno as serialno,
(d.ddate - c.pyear) as lifespan
from destruction d, car c
where d.serialno = c.serialno)
result
group by serialno;
It displayed the following table, but the query required to only display the
third row. How to make it?
SERIALNO MIN(LIFESPAN)
My code like this:
select serialno, min(lifespan)
from
(select d.serialno as serialno,
(d.ddate - c.pyear) as lifespan
from destruction d, car c
where d.serialno = c.serialno)
result
group by serialno;
It displayed the following table, but the query required to only display the
third row. How to make it?
SERIALNO MIN(LIFESPAN)