[SQL문제풀기] Most Profitable Financial Company

silver's avatar
Jan 07, 2026
[SQL문제풀기] Most Profitable Financial Company

문제

내가 작성한 정답

MySQL

select company, continent from forbes_global_2010_2014 where sector = 'Financials' order by profits desc limit 1; -- 'Fiancials' sector에 rank 1이 존재해서 정답처리 됨 -- mysql에서는 rank는 예약어라 컬럼으로 사용하려면 `으로 감싸줘야함 select company, continent from forbes_global_2010_2014 where `rank` = 1 and sector = 'Fiancials';

PostgreSQL

select company, continent from forbes_global_2010_2014 where sector = 'Financials' order by profits desc fetch first 1 row only; select company, continent from forbes_global_2010_2014 where sector = 'Financials' order by profits desc limit 1; -- PostgreSQL에서는 예약어를 컬럼으로 사용하려면 "로 감싼다 select company, continent from forbes_global_2010_2014 where sector = 'Financials' and "rank" = 1;

Oracle

select company, continent from forbes_global_2010_2014 where sector = 'Financials' order by profits desc fetch first 1 row only; select * from (select company, continent from forbes_global_2010_2014 where sector = 'Financials' order by profits desc) where rownum = 1; -- Oracle에서는 예약어를 컬럼으로 사용하려면 "로 감싼다 select company, continent from forbes_global_2010_2014 where sector = 'Financials' and "rank" = 1;
Share article

silver