-- Get the lowest and highest gdp country in single query
-- UNION operator is used to combine the result-set of two or more SELECT statements.
SELECT * FROM (select top(1) * from world order by gdp desc) a
UNION
SELECT * FROM (select top(1) * from world order by gdp asc) b
country | continent | area | population | gdp | |
---|---|---|---|---|---|
0 | Afghanistan | Asia | 647500 | 31056997 | 700 |
3 | United States | North America | 9631420 | 298444215 | 37800 |