« MySQL/Types de données » : différence entre les versions

Contenu supprimé Contenu ajouté
Ligne 74 :
 
== SET et ENUM ==
<code>SET</code> est un type dont les valeurs sont prédéfinies dans une liste lors de la création de la table<ref>http://dev.mysql.com/doc/refman/5.0/fr/set.html</ref>.
A SET datatype can hold any number of strings from a predefined list of strings specified during table creation. The SET datatype is similar to the ENUM datatype in that they
 
both work with predefined sets of strings,
<code>ENUM</code> est similaire mais restreint à un seul membre, alors que <code>SET</code> autorise le stockage de n'importe lesquelles de ses valeurs ensemble.
but where the ENUM datatype restricts you to a single member of the set of predefined strings, the SET datatype allows you to store any of the values together, from none to all of them.
 
Exemple :
<source lang=sql>+
SET("madame", "monsieur") -- autorise un champ vide, "madame", "monsieur", "madame, monsieur", ou "monsieur, madame"
 
ENUM("madame", "monsieur") -- autorise un champ vide, "madame" ou "monsieur"
</source>
 
==Références==
<references/>
 
[[en:MySQL/Language/Data Types]]