21.2.3/SQL/プログラマコードテスト


Today


学習内容

  • SQLプログラマコードテスト
  • group by/with recursive
  • SQL黄書1課16号
  • 結果


    再帰文の使用


    1)メモリに仮想テーブルを格納する
    2)再帰ライブラリを使用してテーブルを作成したり、データを保存したりすることなく、仮想テーブルを作成
    with recursiveテーブル名as(select初期値as column別名1 union all select column別名1計算式、テーブル名where制御文から)
    with recursive time as
    (select 0 as hour union all select hour+1 from time where hour<23)
    select hour, count(animal_id) count
    from time
    left outer join animal_outs on (hour = date_format(datetime, '%H') )
    group by hour;

    Tomorrow

  • SQLプログラマコードテスト
  • SQLの学習

    Summary

  • 眠いです.