Prev | Current Page 106 | Next

Marc Delisle

"Mastering phpMyAdmin 2.11 for Effective MySQL Management"

In
the Insert panel, we now see a radio box interface:
If we decide to have more self-describing codes, we can go back to Structure mode
and change the definition for the genre field. In the following example, we do not
see the complete value list because the field is not large enough, but what we entered
was 'Fantasy','Child','Novel'. We also have to change the default value to one of
the possible values, to avoid getting an error message while trying to save this file
structure modification.
Chapter 6
[ 105 ]
With the modified value list, the Insert panel now looks as follows:
Observe that the radio buttons have been replaced by a drop-down list because the
possible values are longer.
If we want more than one possible value selected, we have to change the field type to
SET. The same value list may be used, but now, using our browser's multiple value
selector (control-click on a Windows or Linux desktop, command-click on a Mac), we
can select more that one value:
For the previous example, we would store only the genre codes in the
book table, in a normalized data structure and would rely on another
table to store the description for each code. We would not be using SET or
ENUM in this case.
DATE, DATETIME, and TIMESTAMP
We could use a normal character field to store date or time information, but DATE,
DATETIME, and TIMESTAMP are more efficient for this purpose.


Pages:
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118