ソースコード
select  d2.DISTRICT_CODE as CODE
        ,d2.DISTRICT_NAME as NAME
        ,L2.LATITUDE as LAT
        ,L2.LONGITUDE as LON
--        ,dd.dis
  from  DISTRICT d2,LOCATION_TBL L2,
(
select  d.DISTRICT_CODE as CODE
        ,min(
             power( power(cast(L.LATITUDE as real)  - cast(p.LATITUDE as real),2)
                  +power(cast(L.LONGITUDE as real) - cast(p.LONGITUDE as real),2) ,0.5 )
        ) as dis
  from  DISTRICT d,LOCATION_TBL L,
  (select LATITUDE,LONGITUDE from LOCATION_TBL where DISTRICT_CODE = '1101') p
 where  d.DISTRICT_CODE <> '1101'
    and d.DISTRICT_CODE = L.DISTRICT_CODE
group by d.DISTRICT_CODE
) dd
 where  L2.DISTRICT_CODE = dd.CODE
   and  d2.DISTRICT_CODE = L2.DISTRICT_CODE
 order by dd.dis desc,L2.DISTRICT_CODE
 
 
/*
select  d.DISTRICT_CODE as CODE
        ,d.DISTRICT_NAME as NAME
        ,L.LATITUDE as LAT
        ,L.LONGITUDE as LON
  from  DISTRICT d,LOCATION_TBL L,
*/
提出情報
提出日時2023/04/14 20:43:10
コンテスト第6回 SQLコンテスト
問題位置情報
受験者ksw_201815
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
88 MB
データパターン2
AC
91 MB
データパターン3
AC
94 MB