dongwei1234 2014-05-08 00: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-08 01: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.'));

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

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用