dongwei1234 2014-05-07 16:57
浏览 133
已采纳

我可以在MySQL中为列提供特定的可选值

Basically just as the title says, in MySQL can I specify a specific range of values for a column so a choice can be selected when a record is added.

I am only starting to understand MySQL and I know that you can do this MS-Access. I'm not sure but do I have to put something special in the 'Length/Values' column when designing? If I can do it, where do I specify what values would be selectable?

If not, is there a more efficient work around then creating a new table and relating the specified values as a foreign key.

Cheers

  • 写回答

1条回答 默认 最新

  • doyz51819 2014-05-07 17:03
    关注

    MS Access combines a few functionalities into a single program:

    • A database engine (MS Jet)
    • A programming environment with a programming language (VBA)
    • A table editor
    • A table data editor
    • A form editor
    • A report editor
    • A query editor
    • ... more

    MySQL is a database engine only. So there is no natural "Select Box" to input data. This would need to come from your programming environment or form generator.

    That said, there is support for such a data type: Use ENUM - e.g. CREATE TABLE test (saluation ENUM ('Mr.', 'Mrs.'));

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?