ソースコード
with dist as (
    select
        -- a.district_code
        -- , a.latitude
        -- , a.longitude
        b.district_code
        , D.district_name
        , b.latitude
        , b.longitude
        , (
        6371 * ACOS(
        COS(RADIANS(a.latitude)) * COS(RADIANS(b.latitude)) * COS(RADIANS(b.longitude) - RADIANS(a.longitude))
        + SIN(RADIANS(a.latitude)) * SIN(RADIANS(b.latitude))
        )
        ) as distance
    from (
        select
            district_code
            , latitude
            , longitude
        from location_tbl
        where district_code = '1101'
    ) as a
    inner join location_tbl as b
        on a.district_code <> b.district_code
    inner join district as D
        on b.district_code = D.district_code
), format as (
    select
        district_code
        , district_name
        , latitude
        , longitude
        , distance
        , rank() over (order by distance desc) as rank
    from dist
)
select
    district_code as CODE
    , district_name as NAME
    , latitude as LAT
    , longitude as LON
from format
order by rank, district_code
;
提出情報
提出日時2023/04/15 22:44:43
コンテスト第6回 SQLコンテスト
問題位置情報
受験者s4wara_o
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
84 MB
データパターン3
WA
79 MB