#author("2022-06-09T00:56:56+00:00","default:admin","admin") *スキーマ [#sb56edb0] -[[MySQLでインデックスが貼られているかを確認するSQL:https://qiita.com/pugiemonn/items/2edf5d7967fb45dd5196]] show index from [テーブル名]; *日時 [#j2a60374] -[[日時別の集計(日ごと, 月ごと, 曜日ごと):https://www.wakuwakubank.com/posts/667-mysql-sum-day/]] -曜日別 select date_format(insert_date, '%w') as day_of_week, count(*) from test_table group by day_of_week; -時間帯別 select date_format(insert_date, '%H') as hour, count(*) from test_table group by hour; *型変換 [#uc3ab5d6] -[[式評価での型変換:https://dev.mysql.com/doc/refman/5.6/ja/type-conversion.html]] -小数点の数字を文字列カラムに set した場合、勝手に浮動小数点に変換される ex) 150.023 -> 151.0229949951172 * [[DELETE:http://dev.mysql.com/doc/refman/5.1/ja/delete.html]] [#r42c5387] ** LIMIT row_count オプション [#u1c8a307] -MySQL 特有 -コントロールがクライアントに戻される前に、削除されるべき最大行数をサーバに伝える -与えられた DELETE ステートメントに時間がかかりすぎない事を保障します -影響される行数が LIMIT 値よりも少なくなるまで DELETE ステートメントを繰り返す