MySQLチュートリアル

MySQLホーム MySQLイントロ MySQL RDBMS

MySQL SQL

MySQL SQL MySQL SELECT MySQL WHERE MySQL AND、OR、NOT MySQL ORDER BY MySQL INSERT INTO MySQLNULL値 MySQL UPDATE MySQLDELETE MySQL LIMIT MySQLMINおよびMAX MySQL COUNT、AVG、SUM MySQL LIKE MySQLワイルドカード MySQL IN MySQL BETWEEN MySQLエイリアス MySQLが参加します MySQL内部結合 MySQL LEFT JOIN MySQL RIGHT JOIN MySQL CROSS JOIN MySQL自己結合 MySQL UNION MySQL GROUP BY MySQL HAVING MySQLが存在します MySQL ANY、ALL MySQL INSERT SELECT MySQLケース MySQLヌル関数 MySQLコメント MySQL演算子

MySQLデータベース

MySQL Create DB MySQLドロップDB MySQLテーブルの作成 MySQLドロップテーブル MySQL ALTER TABLE MySQLの制約 MySQLはNullではありません MySQLユニーク MySQLプライマリキー MySQL外部キー MySQLチェック MySQLのデフォルト MySQL CreateIndex MySQL自動インクリメント MySQLの日付 MySQLビュー

MySQLリファレンス

MySQLデータ型 MySQL関数

MySQLの

MySQLの例 MySQLクイズ MySQL演習

MySQL WEEK()関数

❮MySQL関数

日付の週番号を返します。

SELECT WEEK("2017-06-15");

定義と使用法

WEEK()関数は、指定された日付の週番号(0から53までの数値)を返します。

構文

WEEK(date, firstdayofweek)

パラメータ値

Parameter Description
date Required.  The date or datetime to extract the week number form
firstdayofweek

Optional. Specifies what day the week starts on. Can be one of the following:

  • 0 - First day of week is Sunday
  • 1 - First day of week is Monday and the first week of the year has more than 3 days
  • 2 - First day of week is Sunday
  • 3 - First day of week is Monday and the first week of the year has more than 3 days
  • 4 - First day of week is Sunday and the first week of the year has more than 3 days
  • 5 - First day of week is Monday
  • 6 - First day of week is Sunday and the first week of the year has more than 3 days
  • 7 - First day of week is Monday

技術的な詳細

で動作します: MySQL4.0から

その他の例

日付の週番号を返します。

SELECT WEEK("2017-10-25");

現在のシステム日付の週番号を返します。

SELECT WEEK(CURDATE());

❮MySQL関数