Tutoriel MySQL

ACCUEIL MySQL Introduction à MySQL SGBDR MySQL

SQL MySQL

SQL MySQL MySQL SÉLECTIONNER MySQL OÙ MySQL ET, OU, PAS MySQL ORDRE PAR MySQL INSÉRER DANS Valeurs NULL MySQL MISE À JOUR MySQL SUPPRIMER MySQL LIMITE MySQL MySQL MIN et MAX MySQL COUNT, AVG, SOMME MySQL J'AIME Caractères génériques MySQL MySQL dans MySQL ENTRE Alias ​​MySQL MySQL rejoint JOINTURE INTERNE MySQL JOINTURE GAUCHE MySQL MySQL RIGHT JOIN JOINTURE CROISÉE MySQL Rejoindre MySQL UNION MySQL GROUPER PAR MySQL MySQL AYANT MySQL EXISTE MySQL TOUT, TOUS MySQL INSÉRER SÉLECTIONNER CAS MySQL Fonctions nulles MySQL Commentaires MySQL Opérateurs MySQL

Base de données MySQL

Créer une base de données MySQL Base de données de dépôt MySQL Créer une table MySQL Table de dépôt MySQL Table de modification MySQL Contraintes MySQL MySQL non nul MySQL unique Clé primaire MySQL Clé étrangère MySQL Vérification MySQL MySQL par défaut Créer un index MySQL Incrémentation automatique de MySQL Dates MySQL Vues MySQL

Références MySQL

Types de données MySQL Fonctions MySQL

Exemples MySQL

Exemples MySQL Questionnaire MySQL Exercices MySQL

Fonction MySQL SEMAINE()

❮ Fonctions MySQL

Exemple

Renvoie le numéro de semaine d'une date :

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

Définition et utilisation

La fonction WEEK() renvoie le numéro de semaine pour une date donnée (un nombre de 0 à 53).

Syntaxe

WEEK(date, firstdayofweek)

Valeurs des paramètres

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

Détails techniques

Travaille dans: Depuis MySQL 4.0

Plus d'exemples

Exemple

Renvoie le numéro de semaine d'une date :

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

Exemple

Renvoie le numéro de semaine pour la date système actuelle :

SELECT WEEK(CURDATE());

❮ Fonctions MySQL