inblog logo
|
silver
    SQL문제풀기

    [SQL문제풀기] Most Profitable Financial Company

    silver's avatar
    silver
    Jan 07, 2026
    [SQL문제풀기] Most Profitable Financial Company
    Contents
    문제내가 작성한 정답

    문제

    StrataScratch - Most Profitable Financial Company
    StrataScratch
    StrataScratch - Most Profitable Financial Company
    https://platform.stratascratch.com/coding/9663-find-the-most-profitable-company-in-the-financial-sector-of-the-entire-world-along-with-its-continent?code_type=1

    내가 작성한 정답

    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

    RSS·Powered by Inblog