Book Image

Mastering phpMyAdmin 2.11 for Effective MySQL Management

Book Image

Mastering phpMyAdmin 2.11 for Effective MySQL Management

Overview of this book

Table of Contents (25 chapters)
Mastering phpMyAdmin 2.11 for Effective MySQL Management
Credits
About the Author
About the Reviewers
Preface

ENUM and SET


Both these field types are intended to represent a list of possible values; the difference is that the user can choose only one value from a defined list of values with ENUM, and more than one value with SET. With SET, the multiple values all go into one cell; multiple values do not imply the creation of more than one row of data.

We add a field named genre to the book table and define it as an ENUM. For now, we choose to put short codes in the value list and make one of them,'F', into the default value:

In the value list, we have to enclose each value within single quotes, unlike in the default value field. In our design, we know that these values stand for Fantasy, Child, and Novel, but for now we want to see the interface's behavior with short codes. 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...